diff --git a/datastore/src/main/java/com/google/datastore/snippets/Concepts.java b/datastore/src/main/java/com/google/datastore/snippets/Concepts.java index 79b6484f62d..72a93b723b6 100644 --- a/datastore/src/main/java/com/google/datastore/snippets/Concepts.java +++ b/datastore/src/main/java/com/google/datastore/snippets/Concepts.java @@ -89,17 +89,25 @@ public class Concepts { @Rule public ExpectedException thrown = ExpectedException.none(); + /** + * Starts the local Datastore emulator. + * + * @throws IOException + * @throws InterruptedException + */ @BeforeClass public static void beforeClass() throws IOException, InterruptedException { - // Start the local Datastore emulator. if (!LocalGcdHelper.isActive(PROJECT_ID, PORT)) { gcdHelper = LocalGcdHelper.start(PROJECT_ID, PORT); } } + /** + * Initializes Datastore and cleans out any residual values. Also initializes global variables + * used for testing. + */ @Before public void setUp() { - // Initialize Datastore and clean out any residual values. datastore = DatastoreOptions.builder() .projectId(PROJECT_ID) .namespace("ghijklmnop") // for namespace metadata query @@ -109,8 +117,6 @@ public void setUp() { StructuredQuery query = Query.keyQueryBuilder().build(); QueryResults result = datastore.run(query); datastore.delete(Iterators.toArray(result, Key.class)); - - // Initialize global variables. keyFactory = datastore.newKeyFactory().kind("Task"); taskKey = keyFactory.newKey("some-arbitrary-key"); testEntity = Entity.builder(taskKey, TEST_FULL_ENTITY).build(); @@ -125,9 +131,14 @@ public void setUp() { includedDate = DateTime.copyFrom(includedCalendar); } + /** + * Stops the local Datastore emulator. + * + * @throws IOException + * @throws InterruptedException + */ @AfterClass public static void afterClass() throws IOException, InterruptedException { - // Stop the local Datastore emulator. if (gcdHelper != null) { gcdHelper.stop(); }