usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [07/17] incubator-usergrid git commit: tests passing
Date Mon, 05 Jan 2015 19:36:00 GMT
tests passing


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

Branch: refs/heads/two-dot-o
Commit: a098726217e09d20a35815507cdb5e88d69404ab
Parents: 2a5b4c7
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Tue Dec 23 15:49:43 2014 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Tue Dec 23 15:49:43 2014 -0700

----------------------------------------------------------------------
 .../applications/assets/AssetResourceIT.java    |  9 ++-
 .../collection/users/UserResourceIT.java        | 60 ++++----------------
 .../test/resource2point0/model/ApiResponse.java |  4 ++
 .../test/resource2point0/model/Collection.java  |  2 +-
 4 files changed, 22 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a0987262/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
index c1212e2..6875a13 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.MediaType;
 import com.fasterxml.jackson.databind.JsonNode;
 import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -47,12 +48,14 @@ import static org.apache.usergrid.utils.MapUtils.hashMap;
 @Concurrent()
 public class AssetResourceIT extends AbstractRestIT {
 
-    private final String access_token;
+    private String access_token;
     private Logger LOG = LoggerFactory.getLogger( AssetResourceIT.class );
     UserRepo userRepo;
-    public AssetResourceIT(){
+
+    @Before
+    public void setup(){
         userRepo = new UserRepo(this.clientSetup);
-         access_token = this.getAdminToken().getAccessToken();
+        access_token = this.getAdminToken().getAccessToken();
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a0987262/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
index 1d39bd4..072e1c4 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
@@ -31,8 +31,8 @@ import org.apache.usergrid.rest.test.resource.CollectionResource;
 import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
 import org.apache.usergrid.rest.test.resource2point0.endpoints.EntityEndpoint;
 import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.aspectj.lang.annotation.Before;
 import org.jclouds.rest.annotations.Api;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -71,36 +71,31 @@ public class UserResourceIT extends org.apache.usergrid.rest.test.resource2point
     CollectionEndpoint usersResource;
     CollectionEndpoint userResource;
 
-    @Before("Before users")
+    @Before
     public void setup(){
         userRepo = new UserRepo(clientSetup);
         userRepo.load();
         usersResource = this.app().collection("users");
-        usersResource = this.app().collection("user");
+        userResource = this.app().collection("user");
 
         clientSetup.refreshIndex();
     }
 
     @Test
     public void usernameQuery() throws IOException {
-
-
-        String ql = "username = 'unq_user*'";
+        String ql = "username = 'user*'";
         Collection collection =usersResource.get(new QueryParameters().setQuery(ql));
-        assertEquals(userRepo.getByUserName("unq_user1"), getIdFromSearchResults(collection,
0));
-        assertEquals(userRepo.getByUserName("unq_user2"), getIdFromSearchResults(collection,
1));
-        assertEquals(userRepo.getByUserName("unq_user3"), getIdFromSearchResults(collection,
2));
+        assertEquals(userRepo.getByUserName("user1"), getIdFromSearchResults(collection,
0));
+        assertEquals(userRepo.getByUserName("user2"), getIdFromSearchResults(collection,
1));
+        assertEquals(userRepo.getByUserName("user3"), getIdFromSearchResults(collection,
2));
     }
 
 
     @Test
     public void nameQuery() throws IOException {
-
         String ql = "name = 'John*'";
 
         Collection collection =usersResource.get(new QueryParameters().setQuery(ql));
-
-
         assertEquals( userRepo.getByUserName( "user2" ), getIdFromSearchResults( collection,
0 ) );
         assertEquals( userRepo.getByUserName( "user3" ), getIdFromSearchResults( collection,
1 ) );
     }
@@ -108,20 +103,16 @@ public class UserResourceIT extends org.apache.usergrid.rest.test.resource2point
 
     @Test
     public void nameQueryByUUIDs() throws Exception {
-        this.refreshIndex();
         String ql = "select uuid name = 'John*'";
-        this.app().collection("users").get(new QueryParameters().setQuery(ql));
+        Collection response = this.app().collection("users").get(new QueryParameters().setQuery(ql));
+        assertNotNull(response.getResponse().list());
     }
 
 
     @Test
     public void nameFullTextQuery() throws IOException {
-
-
         String ql = "name contains 'Smith' order by name ";
-
         Collection collection =usersResource.get(new QueryParameters().setQuery(ql));
-
         assertEquals( userRepo.getByUserName( "user1" ), getIdFromSearchResults( collection,
0 ) );
         assertEquals( userRepo.getByUserName( "user2" ), getIdFromSearchResults( collection,
1 ) );
         assertEquals( userRepo.getByUserName( "user3" ), getIdFromSearchResults( collection,
2 ) );
@@ -129,35 +120,6 @@ public class UserResourceIT extends org.apache.usergrid.rest.test.resource2point
 
 
     /**
-     * Tests that when a full text index is run on a field that isn't full text indexed an
error is thrown
-     */
-    @Ignore("No longer relevant because all text fields are full-text indexed with Core Persistence")
-    @Test(expected = UniformInterfaceException.class)
-    public void fullTextQueryNotFullTextIndexed() throws IOException {
-
-        String ql = "username contains 'user' ";
-
-        Collection collection =usersResource.get(new QueryParameters().setQuery(ql));
-
-    }
-
-
-    /**
-     * Tests that when a full text index is run on a field that isn't full text indexed an
error is thrown
-     */
-    @Ignore("This test is being ignored as users ")
-    @Test(expected = UniformInterfaceException.class)
-    public void fullQueryNotIndexed() throws IOException {
-
-
-        String ql = "picture = 'foo' ";
-
-        Collection collection =usersResource.get(new QueryParameters().setQuery(ql));
-
-    }
-
-
-    /**
      * Test that when activity is pushed with not actor, it's set to the user who created
it
      */
     @Test
@@ -1111,8 +1073,8 @@ public class UserResourceIT extends org.apache.usergrid.rest.test.resource2point
         {
             final Collection response = usersResource.get(new QueryParameters().setQuery("select
uuid"));
 
-            assertNotNull( "List must exist", response.getResponse().getEntities(  ) );
-            assertTrue("Must be some list items", response.getResponse().getEntities(  ).size()>0);
+            assertNotNull( "List must exist", response.getResponse().list(  ) );
+            assertTrue("Must be some list items", response.getResponse().list(  ).size()>0);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a0987262/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
index 13897d2..fc55c8b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
@@ -185,6 +185,10 @@ public class ApiResponse {
         this.entities = entities;
     }
 
+    public List<String> list(){
+        return (List<String>)getProperties().get("list");
+    }
+
 
     public int getEntityCount() {
         if ( entities == null ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a0987262/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
index e55bbfe..bb7c41f 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
@@ -55,7 +55,7 @@ public class Collection implements Iterable<Entity>, Iterator<Entity>
{
     public Collection(ApiResponse response) {
         this.response = response;
         this.cursor = response.getCursor();
-        this.entities = response.getEntities().iterator();
+        this.entities = response.getEntities()!=null?  response.getEntities().iterator():null;
     }
 
 


Mime
View raw message