usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [2/2] incubator-usergrid git commit: fix put test
Date Mon, 05 Jan 2015 22:34:34 GMT
fix put test


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4d86a953
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4d86a953
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4d86a953

Branch: refs/heads/Usergrid-310
Commit: 4d86a9531e3ab5f35bb90ea2e8ca5d6e46865887
Parents: 68ca344
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Mon Jan 5 15:33:48 2015 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Mon Jan 5 15:33:48 2015 -0700

----------------------------------------------------------------------
 .../collection/activities/PutTest.java          | 33 ++++++++++----------
 1 file changed, 17 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4d86a953/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
index 850bd0e..2df73a2 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
@@ -21,11 +21,14 @@ import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
-import org.apache.usergrid.rest.AbstractRestIT;
-import org.apache.usergrid.rest.TestContextSetup;
-import org.apache.usergrid.rest.test.resource.CustomCollection;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.assertEquals;
+
+import org.apache.usergrid.rest.test.resource.CollectionResource;
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource2point0.model.Collection;
+import org.apache.usergrid.rest.test.resource2point0.model.Entity;
 import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -38,13 +41,11 @@ import org.slf4j.LoggerFactory;
 public class PutTest extends AbstractRestIT {
     private static final Logger log= LoggerFactory.getLogger( PutTest.class );
     
-    @Rule
-    public TestContextSetup context = new TestContextSetup( this );
 
     @Test //USERGRID-545
     public void putMassUpdateTest() throws IOException {
 
-        CustomCollection activities = context.customCollection( "activities" );
+        CollectionEndpoint activities = this.app().collection("activities");
 
         Map actor = hashMap( "displayName", "Erin" );
         Map newActor = hashMap( "displayName", "Bob" );
@@ -57,24 +58,24 @@ public class PutTest extends AbstractRestIT {
 
         for ( int i = 0; i < 5; i++ ) {
             props.put( "ordinal", i );
-            JsonNode activity = activities.create( props );
+            Entity activity = activities.post(new Entity(props));
         }
 
-        refreshIndex(context.getOrgName(), context.getAppName());
+        refreshIndex();
 
         String query = "select * ";
 
-        JsonNode node = activities.withQuery( query ).get();
-        String uuid = node.get( "entities" ).get( 0 ).get( "uuid" ).textValue();
+        Collection collection = activities.get();
+        String uuid = collection.getResponse().getEntities().get( 0 ).getUuid().toString();
         StringBuilder buf = new StringBuilder( uuid );
-
-        activities.addToUrlEnd( buf );
+        buf.append( "/" );
+        buf.append( buf );
         props.put( "actor", newActor );
-        node = activities.put( props );
+        Entity activity = activities.post(new Entity(props));
 
-        refreshIndex(context.getOrgName(), context.getAppName());
+        refreshIndex();
 
-        node = activities.withQuery( query ).get();
-        assertEquals( 6, node.get( "entities" ).size() );
+        collection = activities.get(  );
+        assertEquals( 6, collection.getResponse().getEntities().size() );
     }
 }


Mime
View raw message