@@ -89,17 +89,25 @@ public class Concepts {
89
89
@ Rule
90
90
public ExpectedException thrown = ExpectedException .none ();
91
91
92
+ /**
93
+ * Starts the local Datastore emulator.
94
+ *
95
+ * @throws IOException
96
+ * @throws InterruptedException
97
+ */
92
98
@ BeforeClass
93
99
public static void beforeClass () throws IOException , InterruptedException {
94
- // Start the local Datastore emulator.
95
100
if (!LocalGcdHelper .isActive (PROJECT_ID , PORT )) {
96
101
gcdHelper = LocalGcdHelper .start (PROJECT_ID , PORT );
97
102
}
98
103
}
99
104
105
+ /**
106
+ * Initializes Datastore and cleans out any residual values. Also initializes global variables
107
+ * used for testing.
108
+ */
100
109
@ Before
101
110
public void setUp () {
102
- // Initialize Datastore and clean out any residual values.
103
111
datastore = DatastoreOptions .builder ()
104
112
.projectId (PROJECT_ID )
105
113
.namespace ("ghijklmnop" ) // for namespace metadata query
@@ -109,8 +117,6 @@ public void setUp() {
109
117
StructuredQuery <Key > query = Query .keyQueryBuilder ().build ();
110
118
QueryResults <Key > result = datastore .run (query );
111
119
datastore .delete (Iterators .toArray (result , Key .class ));
112
-
113
- // Initialize global variables.
114
120
keyFactory = datastore .newKeyFactory ().kind ("Task" );
115
121
taskKey = keyFactory .newKey ("some-arbitrary-key" );
116
122
testEntity = Entity .builder (taskKey , TEST_FULL_ENTITY ).build ();
@@ -125,9 +131,14 @@ public void setUp() {
125
131
includedDate = DateTime .copyFrom (includedCalendar );
126
132
}
127
133
134
+ /**
135
+ * Stops the local Datastore emulator.
136
+ *
137
+ * @throws IOException
138
+ * @throws InterruptedException
139
+ */
128
140
@ AfterClass
129
141
public static void afterClass () throws IOException , InterruptedException {
130
- // Stop the local Datastore emulator.
131
142
if (gcdHelper != null ) {
132
143
gcdHelper .stop ();
133
144
}
0 commit comments