@@ -104,7 +104,7 @@ public class Concepts {
104104 @ BeforeClass
105105 public static void beforeClass () throws IOException , InterruptedException {
106106 if (!LocalGcdHelper .isActive (PROJECT_ID , PORT )) {
107- gcdHelper = LocalGcdHelper .start (PROJECT_ID , PORT );
107+ gcdHelper = LocalGcdHelper .start (PROJECT_ID , PORT , 1.0 );
108108 }
109109 }
110110
@@ -232,8 +232,8 @@ public void testProperties() {
232232 public void testArrayValue () {
233233 // [START array_value]
234234 Entity task = Entity .builder (taskKey )
235- .set ("tags" , StringValue . of ( "fun" ), StringValue . of ( "programming" ) )
236- .set ("collaborators" , StringValue . of ( "alice" ), StringValue . of ( "bob" ) )
235+ .set ("tags" , "fun" , "programming" )
236+ .set ("collaborators" , "alice" , "bob" )
237237 .build ();
238238 // [END array_value]
239239 assertValidEntity (task );
@@ -374,7 +374,7 @@ private void setUpQueryTests() {
374374 .set ("created" , includedDate )
375375 .set ("percent_complete" , 10.0 )
376376 .set ("description" , StringValue .builder ("Learn Cloud Datastore" ).indexed (false ).build ())
377- .set ("tag" , StringValue . of ( "fun" ), StringValue . of ( "l" ), StringValue . of ( "programming" ) )
377+ .set ("tag" , "fun" , "l" , "programming" )
378378 .build ());
379379 }
380380
@@ -748,9 +748,8 @@ public void testUnindexedPropertyQuery() {
748748 public void testExplodingProperties () {
749749 // [START exploding_properties]
750750 Entity task = Entity .builder (taskKey )
751- .set ("tags" , StringValue .of ("fun" ), StringValue .of ("programming" ), StringValue .of ("learn" ))
752- .set ("collaborators" , StringValue .of ("alice" ), StringValue .of ("bob" ),
753- StringValue .of ("charlie" ))
751+ .set ("tags" , "fun" , "programming" , "learn" )
752+ .set ("collaborators" , "alice" , "bob" , "charlie" )
754753 .set ("created" , DateTime .now ())
755754 .build ();
756755 // [END exploding_properties]
@@ -912,12 +911,12 @@ public void testPropertyRunQuery() {
912911 setUpQueryTests ();
913912 // [START property_run_query]
914913 Query <Key > query = Query .keyQueryBuilder ().kind ("__property__" ).build ();
915- QueryResults <Key > results = datastore .run (query );
914+ QueryResults <Key > keys = datastore .run (query );
916915 Map <String , Collection <String >> propertiesByKind = new HashMap <>();
917- while (results .hasNext ()) {
918- Key property = results .next ();
919- String kind = property . ancestors (). get ( property . ancestors (). size () - 1 ).name ();
920- String propertyName = property .name ();
916+ while (keys .hasNext ()) {
917+ Key key = keys .next ();
918+ String kind = key . parent ( ).name ();
919+ String propertyName = key .name ();
921920 Collection <String > properties = propertiesByKind .get (kind );
922921 if (properties == null ) {
923922 properties = new HashSet <>();
@@ -943,10 +942,9 @@ public void testPropertyByKindRunQuery() {
943942 QueryResults <Entity > results = datastore .run (query );
944943 Map <String , Collection <String >> representationsByProperty = new HashMap <>();
945944 while (results .hasNext ()) {
946- Entity property = results .next ();
947- String propertyName = property .key ().name ();
948- List <StringValue > representations =
949- (List <StringValue >) property .getList ("property_representation" );
945+ Entity result = results .next ();
946+ String propertyName = result .key ().name ();
947+ List <StringValue > representations = result .getList ("property_representation" );
950948 Collection <String > currentRepresentations = representationsByProperty .get (propertyName );
951949 if (currentRepresentations == null ) {
952950 currentRepresentations = new HashSet <>();
@@ -973,20 +971,20 @@ public void testPropertyByKindRunQuery() {
973971 public void testPropertyFilteringRunQuery () {
974972 setUpQueryTests ();
975973 // [START property_filtering_run_query]
976- Key key = datastore .newKeyFactory ()
974+ Key startKey = datastore .newKeyFactory ()
977975 .kind ("__property__" )
978976 .ancestors (PathElement .of ("__kind__" , "Task" ))
979977 .newKey ("priority" );
980978 Query <Key > query = Query .keyQueryBuilder ()
981979 .kind ("__property__" )
982- .filter (PropertyFilter .ge ("__key__" , key ))
980+ .filter (PropertyFilter .ge ("__key__" , startKey ))
983981 .build ();
984982 Map <String , Collection <String >> propertiesByKind = new HashMap <>();
985- QueryResults <Key > results = datastore .run (query );
986- while (results .hasNext ()) {
987- Key property = results .next ();
988- String kind = property . ancestors (). get ( property . ancestors (). size () - 1 ).name ();
989- String propertyName = property .name ();
983+ QueryResults <Key > keys = datastore .run (query );
984+ while (keys .hasNext ()) {
985+ Key key = keys .next ();
986+ String kind = key . parent ( ).name ();
987+ String propertyName = key .name ();
990988 Collection <String > properties = propertiesByKind .get (kind );
991989 if (properties == null ) {
992990 properties = new HashSet <String >();
0 commit comments