You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/03/26 21:36:50 UTC

[05/21] incubator-usergrid git commit: [USERGRID-335] Fixed logic-wise what was wrong with the collectionResourceIT tests.

[USERGRID-335] Fixed logic-wise what was wrong with the collectionResourceIT tests.


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

Branch: refs/heads/USERGRID-509
Commit: edbda76f29494cc78ca59afe04138af8a4ecfebf
Parents: 298bfcf
Author: GERey <gr...@apigee.com>
Authored: Thu Mar 19 16:11:01 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Thu Mar 19 16:11:01 2015 -0700

----------------------------------------------------------------------
 .../collection/CollectionsResourceIT.java        | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/edbda76f/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index 192fd84..0a0133a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -21,12 +21,17 @@ import java.io.IOException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.UniformInterfaceException;
 import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource2point0.model.Collection;
 
+import org.apache.usergrid.rest.test.resource2point0.model.Credentials;
 import org.apache.usergrid.rest.test.resource2point0.model.Entity;
 import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource2point0.model.Token;
+
 import org.junit.Ignore;
 import org.junit.Test;
+import org.mortbay.jetty.security.Credential;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -125,6 +130,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
     /**
      * Test posts with a user level token on a path with permissions
      */
+    //TODO: App level permissions aren't functioning.
     @Test
     public void permissionWithMeInString() throws Exception {
 
@@ -154,7 +160,9 @@ public class CollectionsResourceIT extends AbstractRestIT {
         this.app().collection("role").uniqueID("Default").delete();
 
         //log our new user in
-        this.getAppUserToken(username, password);
+        //TODO:App Level token is broken it seems. Test won't work with it.
+        Token appToken = this.getAppUserToken(username, password);
+        management().token().setToken( appToken );
 
         //now post data
         payload = new Entity();
@@ -184,8 +192,9 @@ public class CollectionsResourceIT extends AbstractRestIT {
         Entity payload = new Entity();
         payload.put("summaryOverview", summaryOverview);
         payload.put("caltype", calType);
-        Entity calendarlistOne = this.app().collection(collection).post(payload);
-        assertEquals(calendarlistOne.get("summaryOverview"), summaryOverview);
+
+        Entity calendarlistOne = this.app().collection(collection).post(payload );
+        assertEquals( calendarlistOne.get( "summaryOverview" ), summaryOverview );
         assertEquals(calendarlistOne.get("caltype"), calType);
 
         this.refreshIndex();
@@ -197,7 +206,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         payload.put("summaryOverview", summaryOverviewTwo);
         payload.put("caltype", calTypeTwo);
         Entity calendarlistTwo = this.app().collection(collection).post(payload);
-        assertEquals(calendarlistTwo.get("summaryOverview"), summaryOverviewTwo);
+        assertEquals( calendarlistTwo.get( "summaryOverview" ), summaryOverviewTwo );
         assertEquals(calendarlistTwo.get("caltype"), calTypeTwo);
 
 
@@ -205,7 +214,7 @@ public class CollectionsResourceIT extends AbstractRestIT {
         String query = "summaryOverview = 'My Summary'";
         QueryParameters queryParameters = new QueryParameters().setQuery(query);
         Collection calendarListCollection = this.app().collection(collection).get(queryParameters);
-        assertEquals(calendarListCollection.hasNext(), false);
+        assertEquals(calendarListCollection.hasNext(), true);
 
     }