You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/02/16 23:01:11 UTC

[04/50] incubator-usergrid git commit: Fixed includes file endpoint. Fixed tests that depended on that endpoint along with error tests.

Fixed includes file endpoint.
Fixed tests that depended on that endpoint along with error 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/6c95b449
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6c95b449
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6c95b449

Branch: refs/heads/USERGRID-365
Commit: 6c95b449d50f88ffa2fdef89f7c2bdb39b37e2d8
Parents: 1c14ee5
Author: grey <gr...@apigee.com>
Authored: Wed Feb 11 14:22:54 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Wed Feb 11 14:22:54 2015 -0800

----------------------------------------------------------------------
 .../applications/imports/FileIncludesResource.java      |  1 -
 .../applications/imports/ImportsResource.java           |  2 +-
 .../usergrid/rest/management/ImportResourceIT.java      |  8 ++++++++
 .../usergrid/management/importer/ImportServiceImpl.java | 12 +++++++++---
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6c95b449/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
index c0cfe79..bf69df7 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/FileIncludesResource.java
@@ -143,7 +143,6 @@ public class FileIncludesResource extends AbstractContextResource {
 
 
 
-    @GET
     @Path( RootResource.ENTITY_ID_PATH + "/errors" )
     public FileErrorsResource getIncludes( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
         throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6c95b449/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
index 82d491c..cb61a1c 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
@@ -210,7 +210,7 @@ public class ImportsResource extends AbstractContextResource {
         return new JSONWithPadding( response );
     }
 
-    
+
     @Path( RootResource.ENTITY_ID_PATH + "/includes" )
     public FileIncludesResource getIncludes( @Context UriInfo ui, @PathParam( "entityId" ) PathSegment entityId )
         throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6c95b449/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
index f23e488..52f03cd 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
@@ -436,7 +436,15 @@ public class ImportResourceIT extends AbstractRestIT {
             .addToPath( "import" ).addToPath( importEntity.getUuid().toString() ).get();
 
 
+        refreshIndex();
+
+        Entity importGetIncludes = this.management().orgs().organization(org).app().addToPath(app)
+                                       .addToPath("import" ).addToPath(importEntity.getUuid().toString() )
+                                       .addToPath("includes" ).get();
+
         assertNotNull(importGet);
+        assertNotNull( importGetIncludes );
+        assertEquals( 1,importGetIncludes.size());
 
         assertEquals("FINISHED", importGet.get("state"));
         assertEquals(1, importGet.get("fileCount"));

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6c95b449/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
index d549dba..6662c0e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importer/ImportServiceImpl.java
@@ -208,11 +208,14 @@ public class ImportServiceImpl implements ImportService {
 
             Query query = Query.fromQLNullSafe( ql );
             query.setCursor( cursor );
+            query.setConnectionType( IMPORT_FILE_INCLUDES_CONNECTION );
+            query.setResultsLevel( Level.ALL_PROPERTIES );
+
 
             //set our entity type
-            query.setEntityType( Schema.getDefaultSchema().getEntityType( Import.class ) );
+            query.setEntityType( Schema.getDefaultSchema().getEntityType( FileImport.class ) );
 
-            return rootEm.searchCollection( importEntity, IMPORT_FILE_INCLUDES_CONNECTION, query );
+            return rootEm.searchConnectedEntities( importEntity, query );
         }
         catch ( Exception e ) {
             throw new RuntimeException( "Unable to get import entity", e );
@@ -265,11 +268,14 @@ public class ImportServiceImpl implements ImportService {
 
             Query query = Query.fromQLNullSafe( ql );
             query.setCursor( cursor );
+            query.setConnectionType( FileImportTracker.ERRORS_CONNECTION_NAME );
+            query.setResultsLevel( Level.ALL_PROPERTIES );
+
 
             //set our entity type
             query.setEntityType( Schema.getDefaultSchema().getEntityType( FailedImportEntity.class ) );
 
-            return rootEm.searchCollection( importEntity, FileImportTracker.ERRORS_CONNECTION_NAME, query );
+            return rootEm.searchConnectedEntities( importEntity,  query );
         }
         catch ( Exception e ) {
             throw new RuntimeException( "Unable to get import entity", e );