23
23
import static org .junit .Assert .assertNotNull ;
24
24
import static org .junit .Assert .assertNull ;
25
25
26
+ import com .google .cloud .Timestamp ;
26
27
import com .google .cloud .datastore .Cursor ;
27
28
import com .google .cloud .datastore .Datastore ;
28
29
import com .google .cloud .datastore .DatastoreException ;
29
- import com .google .cloud .datastore .DateTime ;
30
30
import com .google .cloud .datastore .Entity ;
31
31
import com .google .cloud .datastore .EntityQuery ;
32
32
import com .google .cloud .datastore .FullEntity ;
51
51
import com .google .common .collect .ImmutableSet ;
52
52
import com .google .common .collect .Iterators ;
53
53
54
- import org .joda .time .Duration ;
55
54
import org .junit .AfterClass ;
56
55
import org .junit .Before ;
57
56
import org .junit .BeforeClass ;
60
59
import org .junit .rules .ExpectedException ;
61
60
import org .junit .runner .RunWith ;
62
61
import org .junit .runners .JUnit4 ;
62
+ import org .threeten .bp .Duration ;
63
63
64
64
import java .io .IOException ;
65
65
import java .util .ArrayList ;
@@ -88,9 +88,9 @@ public class ConceptsTest {
88
88
private KeyFactory keyFactory ;
89
89
private Key taskKey ;
90
90
private Entity testEntity ;
91
- private DateTime startDate ;
92
- private DateTime endDate ;
93
- private DateTime includedDate ;
91
+ private Timestamp startDate ;
92
+ private Timestamp endDate ;
93
+ private Timestamp includedDate ;
94
94
95
95
@ Rule
96
96
public ExpectedException thrown = ExpectedException .none ();
@@ -121,11 +121,11 @@ public void setUp() {
121
121
testEntity = Entity .newBuilder (taskKey , TEST_FULL_ENTITY ).build ();
122
122
Calendar calendar = Calendar .getInstance (TimeZone .getTimeZone ("UTC" ));
123
123
calendar .set (1990 , JANUARY , 1 );
124
- startDate = DateTime . copyFrom (calendar );
124
+ startDate = Timestamp . of (calendar . getTime () );
125
125
calendar .set (2000 , JANUARY , 1 );
126
- endDate = DateTime . copyFrom (calendar );
126
+ endDate = Timestamp . of (calendar . getTime () );
127
127
calendar .set (1999 , DECEMBER , 31 );
128
- includedDate = DateTime . copyFrom (calendar );
128
+ includedDate = Timestamp . of (calendar . getTime () );
129
129
}
130
130
131
131
/**
@@ -136,7 +136,7 @@ public void setUp() {
136
136
*/
137
137
@ AfterClass
138
138
public static void afterClass () throws IOException , InterruptedException , TimeoutException {
139
- HELPER .stop (Duration .standardMinutes (1 ));
139
+ HELPER .stop (Duration .ofMinutes (1 ));
140
140
}
141
141
142
142
private void assertValidKey (Key taskKey ) {
@@ -209,7 +209,7 @@ public void testProperties() {
209
209
// [START properties]
210
210
Entity task = Entity .newBuilder (taskKey )
211
211
.set ("category" , "Personal" )
212
- .set ("created" , DateTime .now ())
212
+ .set ("created" , Timestamp .now ())
213
213
.set ("done" , false )
214
214
.set ("priority" , 4 )
215
215
.set ("percent_complete" , 10.0 )
@@ -752,7 +752,7 @@ public void testExplodingProperties() {
752
752
Entity task = Entity .newBuilder (taskKey )
753
753
.set ("tags" , "fun" , "programming" , "learn" )
754
754
.set ("collaborators" , "alice" , "bob" , "charlie" )
755
- .set ("created" , DateTime .now ())
755
+ .set ("created" , Timestamp .now ())
756
756
.build ();
757
757
// [END exploding_properties]
758
758
assertValidEntity (task );
0 commit comments