You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/03/24 23:10:09 UTC

[1/3] incubator-usergrid git commit: [USERGRID-348] Added first working test under ExportResourseIT. Found bug using management gets with AppName so I created the ability to get with the stored application uuid instead.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-348 [created] 66fdc6123


[USERGRID-348] Added first working test under ExportResourseIT. Found bug using management gets with AppName so I created the ability to get with the stored application uuid instead.


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

Branch: refs/heads/USERGRID-348
Commit: 2ad1c045343f746b201187d0f5165ce32099f191
Parents: fb90854
Author: GERey <gr...@apigee.com>
Authored: Mon Mar 23 16:35:57 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Mon Mar 23 16:35:57 2015 -0700

----------------------------------------------------------------------
 .../rest/management/ExportResourceIT.java       | 1436 +++++++++---------
 .../rest/test/resource2point0/ClientSetup.java  |    9 +-
 .../endpoints/mgmt/ApplicationResource.java     |    8 +-
 3 files changed, 729 insertions(+), 724 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ad1c045/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
index c8c221b..fbfc2b9 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
@@ -30,8 +30,10 @@ import java.util.UUID;
 import javax.ws.rs.core.MediaType;
 
 
-import org.apache.usergrid.rest.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+
 import org.apache.usergrid.rest.TestContextSetup;
+import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
 
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.assertEquals;
@@ -52,7 +54,6 @@ public class ExportResourceIT extends AbstractRestIT {
 
     }
 
-
     @Test
     public void exportCallSuccessful() throws Exception {
         ClientResponse.Status responseStatus = ClientResponse.Status.OK;
@@ -60,734 +61,729 @@ public class ExportResourceIT extends AbstractRestIT {
 
         HashMap<String, Object> payload = payloadBuilder();
 
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token )
-                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                              .post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-    }
-
-
-    @Ignore( "is this test still valid knowing that the sch. won't run in intelliJ?" )
-    public void exportCallCreationEntities100() throws Exception {
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        JsonNode node = null;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = new HashMap<String, Object>();
-        Map<String, Object> properties = new HashMap<String, Object>();
-        Map<String, Object> storage_info = new HashMap<String, Object>();
-        //TODO: make sure to put a valid admin token here.
-        //TODO: always put dummy values here and ignore this test.
-
-
-        properties.put( "storage_provider", "s3" );
-        properties.put( "storage_info", storage_info );
-
-        payload.put( "properties", properties );
-
-        for ( int i = 0; i < 100; i++ ) {
-            Map<String, String> userCreation = hashMap( "type", "app_user" ).map( "name", "fred" + i );
-
-            node = mapper.readTree( resource().path( "/test-organization/" + appName + "/app_users" )
-                                              .queryParam( "access_token", access_token )
-                                              .accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE )
-                                              .post( String.class, userCreation ) );
-        }
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/test-organization/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", adminToken() )
-                                              .accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-    }
-
-
-    @Test
-    public void exportApplicationUUIDRetTest() throws Exception {
-        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
-        String uuid;
-        UUID jobUUID = null;
-        JsonNode node = null;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
-        assertNotNull( node.get( "Export Entity" ) );
-    }
-
-
-    //
-    @Test
-    public void exportCollectionUUIDRetTest() throws Exception {
-        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
-        String uuid;
-        UUID jobUUID = null;
-        JsonNode node = null;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/"+orgName+"/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
-        assertNotNull( node.get( "Export Entity" ) );
-    }
-
-
-    @Test
-    public void exportGetOrganizationJobStatTest() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                              .post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-    }
-
-
-    //all tests should be moved to OrganizationResourceIT ( *not* Organizations there is a difference)
-    @Test
-    public void exportGetApplicationJobStatTest() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-    }
-
-
-    @Test
-    public void exportGetCollectionJobStatTest() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        node = mapper.readTree(
-                resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
 
         try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid()).addToPath( "collection" )
+                        .addToPath( "users" ).addToPath( "export" ).postWithToken(ApiResponse.class,payload  );
         }
         catch ( UniformInterfaceException uie ) {
             responseStatus = uie.getResponse().getClientResponseStatus();
         }
 
-
         assertEquals( ClientResponse.Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-    }
-
-
-    //    //do an unauthorized test for both post and get
-    @Test
-    public void exportGetWrongUUID() throws Exception {
-        JsonNode node = null;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    //
-    @Test
-    public void exportPostApplicationNullPointerProperties() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = new HashMap<String, Object>();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerProperties() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = new HashMap<String, Object>();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                              .post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    //
-    @Test
-    public void exportPostCollectionNullPointer() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = new HashMap<String, Object>();
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportGetCollectionUnauthorized() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree( resource()
-                    .path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export/" + fake )
-                    .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    @Test
-    public void exportGetApplicationUnauthorized() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export/" + fake )
-                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                              .get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    @Test
-    public void exportGetOrganizationUnauthorized() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
-                                              .accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_info" );
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                              .post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_info" );
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_info" );
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerStorageProvider() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_provider" );
-
-
-        try {
-            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageProvider() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_provider" );
-
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageProvider() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        //remove storage_info field
-        properties.remove( "storage_provider" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerStorageVerification() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( "s3_key" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
-
-        try {
-            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( "bucket_location" );
-
-        try {
-            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageVerification() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( "s3_key" );
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( "bucket_location" );
-
-        try {
-            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageVerification() throws Exception {
-        JsonNode node = null;
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-
-        String orgName = context.getOrgName();
-        String appName = context.getAppName();
-        String token = context.getActiveUser().getToken();
-
-        HashMap<String, Object> payload = payloadBuilder();
-        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( "s3_key" );
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        //remove storage_key field
-        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-
-        payload = payloadBuilder();
-        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-        storage_info.remove( "bucket_location" );
-
-        try {
-            node = mapper.readTree(
-                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
     }
 
-
+//
+//    @Ignore( "is this test still valid knowing that the sch. won't run in intelliJ?" )
+//    public void exportCallCreationEntities100() throws Exception {
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//        JsonNode node = null;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = new HashMap<String, Object>();
+//        Map<String, Object> properties = new HashMap<String, Object>();
+//        Map<String, Object> storage_info = new HashMap<String, Object>();
+//        //TODO: make sure to put a valid admin token here.
+//        //TODO: always put dummy values here and ignore this test.
+//
+//
+//        properties.put( "storage_provider", "s3" );
+//        properties.put( "storage_info", storage_info );
+//
+//        payload.put( "properties", properties );
+//
+//        for ( int i = 0; i < 100; i++ ) {
+//            Map<String, String> userCreation = hashMap( "type", "app_user" ).map( "name", "fred" + i );
+//
+//            node = mapper.readTree( resource().path( "/test-organization/" + appName + "/app_users" )
+//                                              .queryParam( "access_token", access_token )
+//                                              .accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE )
+//                                              .post( String.class, userCreation ) );
+//        }
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/test-organization/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", adminToken() )
+//                                              .accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//        assertEquals( ClientResponse.Status.OK, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportApplicationUUIDRetTest() throws Exception {
+//        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
+//        String uuid;
+//        UUID jobUUID = null;
+//        JsonNode node = null;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
+//        assertNotNull( node.get( "Export Entity" ) );
+//    }
+//
+//
+//    //
+//    @Test
+//    public void exportCollectionUUIDRetTest() throws Exception {
+//        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
+//        String uuid;
+//        UUID jobUUID = null;
+//        JsonNode node = null;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/"+orgName+"/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
+//        assertNotNull( node.get( "Export Entity" ) );
+//    }
+//
+//
+//    @Test
+//    public void exportGetOrganizationJobStatTest() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                              .post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.OK, responseStatus );
+//
+//        String uuid = String.valueOf( node.get( "Export Entity" ) );
+//        uuid = uuid.replaceAll( "\"", "" );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//
+//        assertEquals( ClientResponse.Status.OK, responseStatus );
+//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
+//    }
+//
+//
+//    //all tests should be moved to OrganizationResourceIT ( *not* Organizations there is a difference)
+//    @Test
+//    public void exportGetApplicationJobStatTest() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        String uuid = String.valueOf( node.get( "Export Entity" ) );
+//        uuid = uuid.replaceAll( "\"", "" );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//
+//        assertEquals( ClientResponse.Status.OK, responseStatus );
+//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
+//    }
+//
+//
+//    @Test
+//    public void exportGetCollectionJobStatTest() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        node = mapper.readTree(
+//                resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        String uuid = String.valueOf( node.get( "Export Entity" ) );
+//        uuid = uuid.replaceAll( "\"", "" );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//
+//
+//        assertEquals( ClientResponse.Status.OK, responseStatus );
+//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
+//    }
+//
+//
+//    //    //do an unauthorized test for both post and get
+//    @Test
+//    public void exportGetWrongUUID() throws Exception {
+//        JsonNode node = null;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    //
+//    @Test
+//    public void exportPostApplicationNullPointerProperties() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = new HashMap<String, Object>();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostOrganizationNullPointerProperties() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = new HashMap<String, Object>();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                              .post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    //
+//    @Test
+//    public void exportPostCollectionNullPointer() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = new HashMap<String, Object>();
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportGetCollectionUnauthorized() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree( resource()
+//                    .path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export/" + fake )
+//                    .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportGetApplicationUnauthorized() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export/" + fake )
+//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                              .get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportGetOrganizationUnauthorized() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
+//                                              .accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostOrganizationNullPointerStorageInfo() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_info" );
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                              .post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostApplicationNullPointerStorageInfo() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_info" );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostCollectionNullPointerStorageInfo() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_info" );
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostOrganizationNullPointerStorageProvider() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_provider" );
+//
+//
+//        try {
+//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                             .post( JsonNode.class, payload );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostApplicationNullPointerStorageProvider() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_provider" );
+//
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostCollectionNullPointerStorageProvider() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        //remove storage_info field
+//        properties.remove( "storage_provider" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostOrganizationNullPointerStorageVerification() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( "s3_key" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                             .post( JsonNode.class, payload );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
+//
+//        try {
+//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                             .post( JsonNode.class, payload );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( "bucket_location" );
+//
+//        try {
+//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
+//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+//                             .post( JsonNode.class, payload );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostApplicationNullPointerStorageVerification() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( "s3_key" );
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( "bucket_location" );
+//
+//        try {
+//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
+//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
+//    @Test
+//    public void exportPostCollectionNullPointerStorageVerification() throws Exception {
+//        JsonNode node = null;
+//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+//
+//        String orgName = context.getOrgName();
+//        String appName = context.getAppName();
+//        String token = context.getActiveUser().getToken();
+//
+//        HashMap<String, Object> payload = payloadBuilder();
+//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( "s3_key" );
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        //remove storage_key field
+//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//
+//        payload = payloadBuilder();
+//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+//        storage_info.remove( "bucket_location" );
+//
+//        try {
+//            node = mapper.readTree(
+//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
+//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
+//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
+//        }
+//        catch ( UniformInterfaceException uie ) {
+//            responseStatus = uie.getResponse().getClientResponseStatus();
+//        }
+//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
+//    }
+//
+//
     /*Creates fake payload for testing purposes.*/
     public HashMap<String, Object> payloadBuilder() {
         HashMap<String, Object> payload = new HashMap<String, Object>();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ad1c045/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
index 65f6749..207a962 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
@@ -23,6 +23,7 @@ package org.apache.usergrid.rest.test.resource2point0;
 
 import java.io.IOException;
 
+import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource2point0.model.Application;
 import org.apache.usergrid.rest.test.resource2point0.model.Credentials;
 import org.apache.usergrid.rest.test.resource2point0.model.Entity;
@@ -48,6 +49,7 @@ public class ClientSetup implements TestRule {
     protected String password;
     protected String orgName;
     protected String appName;
+    protected String appUuid;
     protected Token superuserToken;
     protected String superuserName = "superuser";
     protected String superuserPassword = "superpassword";
@@ -112,7 +114,8 @@ public class ClientSetup implements TestRule {
 
         //restClient.management().token().post(Token.class,new Token(username,password));
 
-        restClient.management().orgs().organization(organization.getName()).app().post(new Application(appName));
+        ApiResponse appResponse = restClient.management().orgs().organization(organization.getName()).app().post(new Application(appName));
+        appUuid = ( String ) appResponse.getEntities().get( 0 ).get( "uuid" );
         refreshIndex();
 
     }
@@ -129,6 +132,10 @@ public class ClientSetup implements TestRule {
 
     public String getAppName() {return appName;}
 
+    public String getAppUuid() {
+        return appUuid;
+    }
+
     public Token getSuperuserToken() {
         return superuserToken;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ad1c045/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
index be480f8..90e2c64 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
@@ -22,6 +22,7 @@ package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
 
 import javax.ws.rs.core.MediaType;
 
+import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
 import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource;
 import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource;
 import org.apache.usergrid.rest.test.resource2point0.model.Application;
@@ -46,9 +47,10 @@ public class ApplicationResource extends NamedResource {
     }
 
 
-    public void post(Application application) {
-        getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).post(application);
+    public ApiResponse post(Application application) {
+        ApiResponse apiResponse =getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON).post(ApiResponse.class,application);
+        return apiResponse;
     }
 
 //    public Entity post(Entity payload){


[2/3] incubator-usergrid git commit: [USERGRID-348] Fixed around half the tests for export rules

Posted by gr...@apache.org.
[USERGRID-348] Fixed around half the tests for export rules


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

Branch: refs/heads/USERGRID-348
Commit: ee48768e7cf7c21621899ac0a7d31cf195832c86
Parents: 2ad1c04
Author: GERey <gr...@apigee.com>
Authored: Tue Mar 24 12:25:17 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Tue Mar 24 12:25:17 2015 -0700

----------------------------------------------------------------------
 .../rest/management/ExportResourceIT.java       | 359 +++++++++----------
 1 file changed, 160 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ee48768e/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
index fbfc2b9..020fce1 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
@@ -38,6 +38,7 @@ import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -54,26 +55,6 @@ public class ExportResourceIT extends AbstractRestIT {
 
     }
 
-    @Test
-    public void exportCallSuccessful() throws Exception {
-        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-        JsonNode node = null;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-
-        try {
-            management().orgs().organization( clientSetup.getOrganizationName() )
-                        .app().addToPath( clientSetup.getAppUuid()).addToPath( "collection" )
-                        .addToPath( "users" ).addToPath( "export" ).postWithToken(ApiResponse.class,payload  );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( ClientResponse.Status.OK, responseStatus );
-    }
-
 //
 //    @Ignore( "is this test still valid knowing that the sch. won't run in intelliJ?" )
 //    public void exportCallCreationEntities100() throws Exception {
@@ -120,190 +101,170 @@ public class ExportResourceIT extends AbstractRestIT {
 //    }
 //
 //
-//    @Test
-//    public void exportApplicationUUIDRetTest() throws Exception {
-//        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
-//        String uuid;
-//        UUID jobUUID = null;
-//        JsonNode node = null;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//
-//        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
-//        assertNotNull( node.get( "Export Entity" ) );
-//    }
-//
-//
-//    //
-//    @Test
-//    public void exportCollectionUUIDRetTest() throws Exception {
-//        ClientResponse.Status responseStatus = ClientResponse.Status.ACCEPTED;
-//        String uuid;
-//        UUID jobUUID = null;
-//        JsonNode node = null;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/"+orgName+"/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//
-//        assertEquals( ClientResponse.Status.ACCEPTED, responseStatus );
-//        assertNotNull( node.get( "Export Entity" ) );
-//    }
-//
-//
-//    @Test
-//    public void exportGetOrganizationJobStatTest() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                              .post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.OK, responseStatus );
-//
-//        String uuid = String.valueOf( node.get( "Export Entity" ) );
-//        uuid = uuid.replaceAll( "\"", "" );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//
-//
-//        assertEquals( ClientResponse.Status.OK, responseStatus );
-//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-//    }
-//
-//
-//    //all tests should be moved to OrganizationResourceIT ( *not* Organizations there is a difference)
-//    @Test
-//    public void exportGetApplicationJobStatTest() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        String uuid = String.valueOf( node.get( "Export Entity" ) );
-//        uuid = uuid.replaceAll( "\"", "" );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//
-//
-//        assertEquals( ClientResponse.Status.OK, responseStatus );
-//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-//    }
-//
-//
-//    @Test
-//    public void exportGetCollectionJobStatTest() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        node = mapper.readTree(
-//                resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                          .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                          .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        String uuid = String.valueOf( node.get( "Export Entity" ) );
-//        uuid = uuid.replaceAll( "\"", "" );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + uuid )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
+    @Test
+    public void exportApplicationUUIDRetTest() throws Exception {
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() ).addToPath( "export" );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail("We got back " + uie.getResponse().getClientResponseStatus() + " instead of having a successful call" );
+        }
+
+    }
+
+
+    //
+    @Test
+    public void exportCollectionUUIDRetTest() throws Exception {
+
+        HashMap<String, Object> payload = payloadBuilder();
+        ApiResponse exportEntity = null;
+
+        try {
+
+
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid()).addToPath( "collection" )
+                        .addToPath( "users" ).addToPath( "export" ).postWithToken(ApiResponse.class,payloadBuilder() );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+        assertNotNull( exportEntity );
+        assertNotNull( exportEntity.getProperties().get( "Export Entity" ));
+    }
+
+
+    /**
+     * Check that you can get the org export uuid returned and that you can check the status of the job using that uuid.
+     * @throws Exception
+     */
+    @Test
+    public void exportGetOrganizationJobStatTest() throws Exception {
+
+        ApiResponse exportEntity = null;
+
+
+        try {
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .addToPath( "export" ).postWithToken( ApiResponse.class, payloadBuilder() );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+        assertNotNull( exportEntity );
+        String uuid = ( String ) exportEntity.getProperties().get( "Export Entity" );
+        assertNotNull( uuid );
+
+        exportEntity = null;
+        try {
+
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+        assertNotNull( exportEntity );
+        String state = (String) exportEntity.getProperties().get( "state" );
+        assertEquals( "SCHEDULED", state);
+    }
 //
 //
-//        assertEquals( ClientResponse.Status.OK, responseStatus );
-//        assertEquals( "SCHEDULED", node.get( "state" ).textValue() );//TODO: do tests for other states in service tier
-//    }
+
+
+    /**
+     * Check that you can get the app export uuid returned and that you can check the status of the job using that uuid.
+     * @throws Exception
+     */
+
+    @Test
+    public void exportGetApplicationJobStatTest() throws Exception {
+
+        ApiResponse exportEntity = null;
+
+
+        try {
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .app().addToPath( clientSetup.getAppUuid() )
+                                       .addToPath( "export" ).postWithToken( ApiResponse.class, payloadBuilder() );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+        assertNotNull( exportEntity );
+        String uuid = ( String ) exportEntity.getProperties().get( "Export Entity" );
+        assertNotNull( uuid );
+
+        exportEntity = null;
+        refreshIndex();
+        try {
+
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+        assertNotNull( exportEntity );
+        String state = (String) exportEntity.getProperties().get( "state" );
+        assertEquals( "SCHEDULED", state);
+    }
+
+
+    @Test
+    public void exportGetCollectionJobStatTest() throws Exception {
+
+        ApiResponse exportEntity = null;
+
+        exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                   .app().addToPath( clientSetup.getAppUuid()).addToPath( "collection" )
+                                   .addToPath( "users" ).addToPath( "export" )
+                                   .postWithToken( ApiResponse.class, payloadBuilder() );
+
+        assertNotNull( exportEntity );
+        String uuid = ( String ) exportEntity.getProperties().get( "Export Entity" );
+        assertNotNull( uuid );
+
+        exportEntity = null;
+        try {
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            fail( "We got back "+uie.getResponse().getClientResponseStatus()+" instead of having a successful call" );
+        }
+
+
+        assertNotNull( exportEntity );
+        String state = (String) exportEntity.getProperties().get( "state" );
+        assertEquals( "SCHEDULED", state);
+    }
 //
 //
 //    //    //do an unauthorized test for both post and get
-//    @Test
-//    public void exportGetWrongUUID() throws Exception {
-//        JsonNode node = null;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
+    @Test
+    public void exportGetWrongUUID() throws Exception {
+        ApiResponse exportEntity = null;
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+        try {
+            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .addToPath( "export" ).addToPath( fake.toString() ).get( ApiResponse.class );
+            fail( "Should not have been able to get fake uuid" );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+
+        }
+    }
+
 //
 //    //
 //    @Test


[3/3] incubator-usergrid git commit: [USERGRID-348] Added fixes for ExportResourceIT and changed Export endpoint t use the old method of looking for payloads so that it is consistent with imports.

Posted by gr...@apache.org.
[USERGRID-348] Added fixes for ExportResourceIT and changed Export endpoint t use the old method of looking for payloads so that it is consistent with imports.


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

Branch: refs/heads/USERGRID-348
Commit: 66fdc61237923809b47d496e3bfbd9db2ca80735
Parents: ee48768
Author: GERey <gr...@apigee.com>
Authored: Tue Mar 24 15:10:07 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Tue Mar 24 15:10:07 2015 -0700

----------------------------------------------------------------------
 .../organizations/OrganizationResource.java     |  26 +-
 .../applications/ApplicationResource.java       |  44 +-
 .../applications/imports/ImportsResource.java   |   4 -
 .../rest/management/ExportResourceIT.java       | 931 ++++++++-----------
 .../endpoints/NamedResource.java                |  12 +-
 5 files changed, 438 insertions(+), 579 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66fdc612/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
index 988af0b..9f32f03 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationResource.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.rest.management.organizations;
 import com.sun.jersey.api.json.JSONWithPadding;
 import com.sun.jersey.api.view.Viewable;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
+import org.apache.commons.lang.NullArgumentException;
 
 import org.apache.usergrid.corepersistence.util.CpNamingUtils;
 import org.apache.usergrid.management.ActivationState;
@@ -292,40 +293,45 @@ public class OrganizationResource extends AbstractContextResource {
 
         try {
             if((properties = ( Map<String, Object> )  json.get( "properties" )) == null){
-                throw new NullPointerException("Could not find 'properties'");
+                throw new NullArgumentException("Could not find 'properties'");
             }
             storage_info = ( Map<String, Object> ) properties.get( "storage_info" );
             String storage_provider = ( String ) properties.get( "storage_provider" );
             if(storage_provider == null) {
-                throw new NullPointerException( "Could not find field 'storage_provider'" );
+                throw new NullArgumentException( "Could not find field 'storage_provider'" );
             }
             if(storage_info == null) {
-                throw new NullPointerException( "Could not find field 'storage_info'" );
+                throw new NullArgumentException( "Could not find field 'storage_info'" );
             }
 
-
             String bucketName = ( String ) storage_info.get( "bucket_location" );
-            uac.getAWSAccessKeyIdJson( storage_info );
-            uac.getAWSSecretKeyJson( storage_info );
+            String accessId = ( String ) storage_info.get( "s3_access_id" );
+            String secretKey = ( String ) storage_info.get( "s3_key" );
 
-            if(bucketName == null) {
-                throw new NullPointerException( "Could not find field 'bucketName'" );
+            if ( bucketName == null ) {
+                throw new NullArgumentException( "Could not find field 'bucketName'" );
+            }
+            if ( accessId == null ) {
+                throw new NullArgumentException( "Could not find field 's3_access_id'" );
             }
+            if ( secretKey == null ) {
 
+                throw new NullArgumentException( "Could not find field 's3_key'" );
+            }
 
             json.put( "organizationId",organization.getUuid());
 
             jobUUID = exportService.schedule( json );
             uuidRet.put( "Export Entity", jobUUID.toString() );
         }
-        catch ( NullPointerException e ) {
+        catch ( NullArgumentException e ) {
             return Response.status( SC_BAD_REQUEST ).type( JSONPUtils.jsonMediaType( callback ) )
                            .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
         }
         catch ( Exception e ) {
             //TODO:throw descriptive error message and or include on in the response
             //TODO:fix below, it doesn't work if there is an exception. Make it look like the OauthResponse.
-            return Response.status( SC_INTERNAL_SERVER_ERROR ).type( JSONPUtils.jsonMediaType( callback ) )
+            return Response.status(  SC_INTERNAL_SERVER_ERROR ).type( JSONPUtils.jsonMediaType( callback ) )
                            .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
         }
         return Response.status( SC_ACCEPTED ).entity( uuidRet ).build();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66fdc612/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index 639c41b..d7dcd87 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@ -24,6 +24,7 @@ import com.google.common.base.Preconditions;
 import com.sun.jersey.api.json.JSONWithPadding;
 import org.apache.amber.oauth2.common.exception.OAuthSystemException;
 import org.apache.amber.oauth2.common.message.OAuthResponse;
+import org.apache.commons.lang.NullArgumentException;
 import org.apache.commons.lang.StringUtils;
 
 import org.apache.usergrid.corepersistence.util.CpNamingUtils;
@@ -243,25 +244,31 @@ public class ApplicationResource extends AbstractContextResource {
 
         try {
             if((properties = ( Map<String, Object> )  json.get( "properties" )) == null){
-                throw new NullPointerException("Could not find 'properties'");
+                throw new NullArgumentException("Could not find 'properties'");
             }
             storage_info = ( Map<String, Object> ) properties.get( "storage_info" );
             String storage_provider = ( String ) properties.get( "storage_provider" );
             if(storage_provider == null) {
-                throw new NullPointerException( "Could not find field 'storage_provider'" );
+                throw new NullArgumentException( "Could not find field 'storage_provider'" );
             }
             if(storage_info == null) {
-                throw new NullPointerException( "Could not find field 'storage_info'" );
+                throw new NullArgumentException( "Could not find field 'storage_info'" );
             }
 
 
             String bucketName = ( String ) storage_info.get( "bucket_location" );
+            String accessId = ( String ) storage_info.get( "s3_access_id" );
+            String secretKey = ( String ) storage_info.get( "s3_key" );
 
-            uac.getAWSAccessKeyIdJson( storage_info );
-            uac.getAWSSecretKeyJson( storage_info );
+            if ( bucketName == null ) {
+                throw new NullArgumentException( "Could not find field 'bucketName'" );
+            }
+            if ( accessId == null ) {
+                throw new NullArgumentException( "Could not find field 's3_access_id'" );
+            }
+            if ( secretKey == null ) {
 
-            if(bucketName == null) {
-                throw new NullPointerException( "Could not find field 'bucketName'" );
+                throw new NullArgumentException( "Could not find field 's3_key'" );
             }
 
             json.put("organizationId", organization.getUuid());
@@ -270,7 +277,7 @@ public class ApplicationResource extends AbstractContextResource {
             jobUUID = exportService.schedule( json );
             uuidRet.put( "Export Entity", jobUUID.toString() );
         }
-        catch ( NullPointerException e ) {
+        catch ( NullArgumentException e ) {
             return Response.status( SC_BAD_REQUEST )
                 .type( JSONPUtils.jsonMediaType( callback ) )
                 .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
@@ -307,25 +314,30 @@ public class ApplicationResource extends AbstractContextResource {
         try {
             //checkJsonExportProperties(json);
             if((properties = ( Map<String, Object> )  json.get( "properties" )) == null){
-                throw new NullPointerException("Could not find 'properties'");
+                throw new NullArgumentException("Could not find 'properties'");
             }
             storage_info = ( Map<String, Object> ) properties.get( "storage_info" );
             String storage_provider = ( String ) properties.get( "storage_provider" );
             if(storage_provider == null) {
-                throw new NullPointerException( "Could not find field 'storage_provider'" );
+                throw new NullArgumentException( "Could not find field 'storage_provider'" );
             }
             if(storage_info == null) {
-                throw new NullPointerException( "Could not find field 'storage_info'" );
+                throw new NullArgumentException( "Could not find field 'storage_info'" );
             }
 
             String bucketName = ( String ) storage_info.get( "bucket_location" );
+            String accessId = ( String ) storage_info.get( "s3_access_id" );
+            String secretKey = ( String ) storage_info.get( "s3_key" );
 
-            //check to make sure that access key and secret key are there.
-            uac.getAWSAccessKeyIdJson( storage_info );
-            uac.getAWSSecretKeyJson( storage_info );
+            if ( accessId == null ) {
+                throw new NullArgumentException( "Could not find field 's3_access_id'" );
+            }
+            if ( secretKey == null ) {
+                throw new NullArgumentException( "Could not find field 's3_key'" );
+            }
 
             if(bucketName == null) {
-                throw new NullPointerException( "Could not find field 'bucketName'" );
+                throw new NullArgumentException( "Could not find field 'bucketName'" );
             }
 
             json.put( "organizationId",organization.getUuid() );
@@ -335,7 +347,7 @@ public class ApplicationResource extends AbstractContextResource {
             jobUUID = exportService.schedule( json );
             uuidRet.put( "Export Entity", jobUUID.toString() );
         }
-        catch ( NullPointerException e ) {
+        catch ( NullArgumentException e ) {
             return Response.status( SC_BAD_REQUEST )
                 .type( JSONPUtils.jsonMediaType( callback ) )
                 .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66fdc612/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 900b7b0..bb5f958 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
@@ -113,10 +113,6 @@ public class ImportsResource extends AbstractContextResource {
 
         Map<String, Object> properties;
         Map<String, Object> storage_info;
-        // UsergridAwsCredentialsProvider uacp = new UsergridAwsCredentialsProvider();
-
-        //             try {
-        //checkJsonExportProperties(json);
 
 
             if ( ( properties = ( Map<String, Object> ) json.get( "properties" ) ) == null ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66fdc612/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
index 020fce1..0465d69 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
@@ -18,32 +18,24 @@
 package org.apache.usergrid.rest.management;
 
 
-import com.amazonaws.SDKGlobalConfiguration;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
-import javax.ws.rs.core.MediaType;
-
-
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.junit.Rule;
+import org.junit.Test;
 
 import org.apache.usergrid.rest.TestContextSetup;
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
 
-import static org.apache.usergrid.utils.MapUtils.hashMap;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.UniformInterfaceException;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
 
 public class ExportResourceIT extends AbstractRestIT {
 
@@ -55,52 +47,6 @@ public class ExportResourceIT extends AbstractRestIT {
 
     }
 
-//
-//    @Ignore( "is this test still valid knowing that the sch. won't run in intelliJ?" )
-//    public void exportCallCreationEntities100() throws Exception {
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//        JsonNode node = null;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = new HashMap<String, Object>();
-//        Map<String, Object> properties = new HashMap<String, Object>();
-//        Map<String, Object> storage_info = new HashMap<String, Object>();
-//        //TODO: make sure to put a valid admin token here.
-//        //TODO: always put dummy values here and ignore this test.
-//
-//
-//        properties.put( "storage_provider", "s3" );
-//        properties.put( "storage_info", storage_info );
-//
-//        payload.put( "properties", properties );
-//
-//        for ( int i = 0; i < 100; i++ ) {
-//            Map<String, String> userCreation = hashMap( "type", "app_user" ).map( "name", "fred" + i );
-//
-//            node = mapper.readTree( resource().path( "/test-organization/" + appName + "/app_users" )
-//                                              .queryParam( "access_token", access_token )
-//                                              .accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE )
-//                                              .post( String.class, userCreation ) );
-//        }
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/test-organization/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", adminToken() )
-//                                              .accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//
-//        assertEquals( ClientResponse.Status.OK, responseStatus );
-//    }
-//
-//
     @Test
     public void exportApplicationUUIDRetTest() throws Exception {
 
@@ -113,9 +59,7 @@ public class ExportResourceIT extends AbstractRestIT {
         }
 
     }
-
-
-    //
+    
     @Test
     public void exportCollectionUUIDRetTest() throws Exception {
 
@@ -252,10 +196,9 @@ public class ExportResourceIT extends AbstractRestIT {
 //    //    //do an unauthorized test for both post and get
     @Test
     public void exportGetWrongUUID() throws Exception {
-        ApiResponse exportEntity = null;
         UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
         try {
-            exportEntity = management().orgs().organization( clientSetup.getOrganizationName() )
+            management().orgs().organization( clientSetup.getOrganizationName() )
                                        .addToPath( "export" ).addToPath( fake.toString() ).get( ApiResponse.class );
             fail( "Should not have been able to get fake uuid" );
         }
@@ -265,486 +208,380 @@ public class ExportResourceIT extends AbstractRestIT {
         }
     }
 
-//
-//    //
-//    @Test
-//    public void exportPostApplicationNullPointerProperties() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = new HashMap<String, Object>();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostOrganizationNullPointerProperties() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = new HashMap<String, Object>();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                              .post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    //
-//    @Test
-//    public void exportPostCollectionNullPointer() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = new HashMap<String, Object>();
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportGetCollectionUnauthorized() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree( resource()
-//                    .path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export/" + fake )
-//                    .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportGetApplicationUnauthorized() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export/" + fake )
-//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                              .get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportGetOrganizationUnauthorized() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/export/" + fake )
-//                                              .accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.UNAUTHORIZED, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostOrganizationNullPointerStorageInfo() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_info" );
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                              .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                              .post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostApplicationNullPointerStorageInfo() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_info" );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostCollectionNullPointerStorageInfo() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_info" );
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostOrganizationNullPointerStorageProvider() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_provider" );
-//
-//
-//        try {
-//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                             .post( JsonNode.class, payload );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostApplicationNullPointerStorageProvider() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_provider" );
-//
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostCollectionNullPointerStorageProvider() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        //remove storage_info field
-//        properties.remove( "storage_provider" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostOrganizationNullPointerStorageVerification() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( "s3_key" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                             .post( JsonNode.class, payload );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
-//
-//        try {
-//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                             .post( JsonNode.class, payload );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( "bucket_location" );
-//
-//        try {
-//            node = resource().path( "/management/orgs/" + orgName + "/export" ).queryParam( "access_token", token )
-//                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-//                             .post( JsonNode.class, payload );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostApplicationNullPointerStorageVerification() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( "s3_key" );
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( "bucket_location" );
-//
-//        try {
-//            node = mapper.readTree( resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/export" )
-//                                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
-//    @Test
-//    public void exportPostCollectionNullPointerStorageVerification() throws Exception {
-//        JsonNode node = null;
-//        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
-//
-//        String orgName = context.getOrgName();
-//        String appName = context.getAppName();
-//        String token = context.getActiveUser().getToken();
-//
-//        HashMap<String, Object> payload = payloadBuilder();
-//        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( "s3_key" );
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        //remove storage_key field
-//        storage_info.remove( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//
-//        payload = payloadBuilder();
-//        properties = ( HashMap<String, Object> ) payload.get( "properties" );
-//        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
-//        storage_info.remove( "bucket_location" );
-//
-//        try {
-//            node = mapper.readTree(
-//                    resource().path( "/management/orgs/" + orgName + "/apps/" + appName + "/collection/users/export" )
-//                              .queryParam( "access_token", token ).accept( MediaType.APPLICATION_JSON )
-//                              .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ) );
-//        }
-//        catch ( UniformInterfaceException uie ) {
-//            responseStatus = uie.getResponse().getClientResponseStatus();
-//        }
-//        assertEquals( ClientResponse.Status.BAD_REQUEST, responseStatus );
-//    }
-//
-//
+
+    //
+    @Test
+    public void exportPostApplicationNullPointerProperties() throws Exception {
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                                       .app().addToPath( clientSetup.getAppUuid() )
+                                       .addToPath( "export" ).postWithToken( ApiResponse.class,
+                new HashMap<String, Object>() );
+            fail( "Should not have passed, The payload is empty." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+
+    @Test
+    public void exportPostOrganizationNullPointerProperties() throws Exception {
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, new HashMap<String, Object>()  );
+            fail( "Should not have passed, The payload is empty." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    //
+    @Test
+    public void exportPostCollectionNullPointer() throws Exception {
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, new HashMap<String, Object>()  );
+
+            fail( "Should not have passed, The payload is empty." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportGetCollectionUnauthorized() throws Exception {
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).addToPath( fake.toString() ).getWithoutToken( ApiResponse.class );
+            fail( "Should not have passed as we didn't have an access token." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.UNAUTHORIZED, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportGetApplicationUnauthorized() throws Exception {
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).addToPath( fake.toString() ).getWithoutToken( ApiResponse.class );
+            fail( "Should not have passed as we didn't have an access token." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.UNAUTHORIZED, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportGetOrganizationUnauthorized() throws Exception {
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).addToPath( fake.toString() ).getWithoutToken( ApiResponse.class );
+            fail( "Should not have passed as we didn't have an access token." );
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.UNAUTHORIZED, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostOrganizationNullPointerStorageInfo() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_info" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+
+    @Test
+    public void exportPostApplicationNullPointerStorageInfo() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_info" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class,
+                payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostCollectionNullPointerStorageInfo() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_info" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class,
+                payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostOrganizationNullPointerStorageProvider() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_provider" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+
+    @Test
+    public void exportPostApplicationNullPointerStorageProvider() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_provider" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class,
+                payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostCollectionNullPointerStorageProvider() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        //remove storage_info field
+        properties.remove( "storage_provider" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class,
+                payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+
+    @Test
+    public void exportPostOrganizationNullPointerStorageVerification() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_key" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_access_id");
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "bucket_location" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostApplicationNullPointerStorageVerification() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_key" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_access_id" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "bucket_location" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+    @Test
+    public void exportPostCollectionNullPointerStorageVerification() throws Exception {
+        HashMap<String, Object> payload = payloadBuilder();
+        HashMap<String, Object> properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        HashMap<String, Object> storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_key" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "s3_access_id" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+
+        payload = payloadBuilder();
+        properties = ( HashMap<String, Object> ) payload.get( "properties" );
+        storage_info = ( HashMap<String, Object> ) properties.get( "storage_info" );
+        //remove storage_key field
+        storage_info.remove( "bucket_location" );
+
+        try {
+            management().orgs().organization( clientSetup.getOrganizationName() )
+                        .app().addToPath( clientSetup.getAppUuid() )
+                        .addToPath( "collection" ).addToPath( "users" )
+                        .addToPath( "export" ).postWithToken( ApiResponse.class, payload );
+            fail( "Should not have passed as we were missing an important part of the payload" );
+
+        }
+        catch ( UniformInterfaceException uie ) {
+            assertEquals( ClientResponse.Status.BAD_REQUEST, uie.getResponse().getClientResponseStatus() );
+        }
+    }
+
+
     /*Creates fake payload for testing purposes.*/
     public HashMap<String, Object> payloadBuilder() {
         HashMap<String, Object> payload = new HashMap<String, Object>();
@@ -752,8 +589,8 @@ public class ExportResourceIT extends AbstractRestIT {
         Map<String, Object> storage_info = new HashMap<String, Object>();
         //TODO: always put dummy values here and ignore this test.
         //TODO: add a ret for when s3 values are invalid.
-        storage_info.put( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR, "insert key here" );
-        storage_info.put( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR, "insert access id here" );
+        storage_info.put( "s3_key", "insert key here" );
+        storage_info.put( "s3_access_id", "insert access id here" );
         storage_info.put( "bucket_location", "insert bucket name here" );
         properties.put( "storage_provider", "s3" );
         properties.put( "storage_info", storage_info );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/66fdc612/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java
index daf3502..fe9d73e 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java
@@ -193,8 +193,16 @@ public abstract class NamedResource implements UrlResource {
     public <T> T get(Class<T> type) {
         GenericType<T> gt = new GenericType<>((Class) type);
         return getResource( true ).type(MediaType.APPLICATION_JSON_TYPE)
-                            .accept( MediaType.APPLICATION_JSON )
-                            .get( gt.getRawClass() );
+                                  .accept( MediaType.APPLICATION_JSON )
+                                  .get( gt.getRawClass() );
+
+    }
+
+    public <T> T getWithoutToken(Class<T> type) {
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return getResource().type(MediaType.APPLICATION_JSON_TYPE)
+                                  .accept( MediaType.APPLICATION_JSON )
+                                  .get( gt.getRawClass() );
 
     }