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

[67/77] [abbrv] git commit: Removed unused Export Entity properties. Added in org level status checker, removed the lower level export so that we can just call one command for a query. Refactored Rest level tests Storing entity in management application,

Removed unused Export Entity properties.
Added in org level status checker, removed the lower level export so that we can just call one command for a query.
Refactored Rest level tests
Storing entity in management application, no longer creating a separate application.


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

Branch: refs/pull/92/merge
Commit: 200b714234818da3b94c3bb117ef54b8ed9367f9
Parents: 88efb03
Author: grey <gr...@apigee.com>
Authored: Tue Apr 1 14:30:27 2014 -0700
Committer: grey <gr...@apigee.com>
Committed: Tue Apr 1 14:30:27 2014 -0700

----------------------------------------------------------------------
 .../usergrid/persistence/entities/Export.java   |  70 --
 .../organizations/OrganizationResource.java     |  27 +
 .../applications/ApplicationResource.java       |  44 +-
 .../rest/management/ExportResourceIT.java       | 634 +++++++++++++++++++
 .../rest/management/ManagementResourceIT.java   | 599 ------------------
 .../management/export/ExportServiceImpl.java    |  55 +-
 .../management/cassandra/ExportServiceIT.java   |   3 +-
 7 files changed, 707 insertions(+), 725 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Export.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Export.java b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Export.java
index 77f5a95..d4deb7c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Export.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/entities/Export.java
@@ -36,13 +36,9 @@ public class Export extends TypedEntity {
         CREATED, FAILED, SCHEDULED, STARTED, FINISHED, CANCELED, EXPIRED
     }
 
-
     @EntityProperty
     protected State curState;
 
-    @EntityProperty
-    protected Long queued;
-
     /**
      * Time send started
      */
@@ -50,25 +46,6 @@ public class Export extends TypedEntity {
     protected Long started;
 
     /**
-     * Time processed
-     */
-    @EntityProperty
-    protected Long finished;
-
-
-    /**
-     * Time to expire the exportJob
-     */
-    @EntityProperty
-    protected Long expire;
-
-    /**
-     * True if exportJob is canceled
-     */
-    @EntityProperty
-    protected Boolean canceled;
-
-    /**
      * Error message
      */
     @EntityProperty
@@ -78,12 +55,6 @@ public class Export extends TypedEntity {
     public Export() {
     }
 
-
-    public boolean isExpired() {
-        return ( expire != null && expire > System.currentTimeMillis() );
-    }
-
-
     public Long getStarted() {
         return started;
     }
@@ -93,32 +64,6 @@ public class Export extends TypedEntity {
         this.started = started;
     }
 
-
-    public Long getFinished() {
-        return finished;
-    }
-
-
-    public void setFinished( final Long finished ) {
-        this.finished = finished;
-    }
-
-
-    public Long getExpire() {
-        return expire;
-    }
-
-
-    public void setExpire( final Long expire ) {
-        this.expire = expire;
-    }
-
-
-    public Boolean getCanceled() {
-        return canceled;
-    }
-
-
     //state should moved to a derived state, but it is not there yet.
     @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
     @EntityProperty
@@ -131,12 +76,6 @@ public class Export extends TypedEntity {
     @EntityProperty
     public State getState() { return curState; }
 
-
-    public void setCanceled( final Boolean canceled ) {
-        this.canceled = canceled;
-    }
-
-
     public String getErrorMessage() {
         return errorMessage;
     }
@@ -146,13 +85,4 @@ public class Export extends TypedEntity {
         this.errorMessage = errorMessage;
     }
 
-
-    public Long getQueued() {
-        return queued;
-    }
-
-
-    public void setQueued( final Long queued ) {
-        this.queued = queued;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/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 05312ab..24a9f43 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
@@ -27,6 +27,7 @@ import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
@@ -46,6 +47,8 @@ import org.apache.amber.oauth2.common.message.OAuthResponse;
 import org.apache.usergrid.management.ActivationState;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.export.ExportService;
+import org.apache.usergrid.persistence.cassandra.CassandraService;
+import org.apache.usergrid.persistence.entities.Export;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.applications.ServiceResource;
@@ -64,6 +67,7 @@ import com.sun.jersey.api.view.Viewable;
 import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
 import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
 import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 
 
@@ -333,4 +337,27 @@ public class OrganizationResource extends AbstractContextResource {
         }
         return Response.status( SC_ACCEPTED ).entity( uuidRet ).build();
     }
+
+    @GET
+    @RequireOrganizationAccess
+    @Path("export/{exportEntity: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+    public Response exportGetJson( @Context UriInfo ui, @PathParam("exportEntity") UUID exportEntityUUIDStr,
+                                   @QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
+
+        Export entity;
+        try {
+            entity = smf.getServiceManager( CassandraService.MANAGEMENT_APPLICATION_ID ).getEntityManager()
+                        .get( exportEntityUUIDStr, Export.class );
+        }
+        catch ( Exception e ) { //this might not be a bad request and needs better error checking
+            return Response.status( SC_BAD_REQUEST ).type( JSONPUtils.jsonMediaType( callback ) )
+                           .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
+        }
+
+        if ( entity == null ) {
+            return Response.status( SC_BAD_REQUEST ).build();
+        }
+
+        return Response.status( SC_OK ).entity( entity).build();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/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 588e5a1..14268da 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
@@ -46,7 +46,6 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.usergrid.management.ApplicationInfo;
 import org.apache.usergrid.management.OrganizationInfo;
 import org.apache.usergrid.management.export.ExportService;
-import org.apache.usergrid.persistence.entities.Export;
 import org.apache.usergrid.rest.AbstractContextResource;
 import org.apache.usergrid.rest.ApiResponse;
 import org.apache.usergrid.rest.applications.ServiceResource;
@@ -63,7 +62,6 @@ import com.sun.jersey.api.json.JSONWithPadding;
 import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
 import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
 import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
-import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 
 
@@ -346,27 +344,27 @@ public class ApplicationResource extends AbstractContextResource {
     }
 
 
-    @GET
-    @RequireOrganizationAccess
-    @Path("export/{exportEntity: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
-    public Response exportGetJson( @Context UriInfo ui, @PathParam("exportEntity") UUID exportEntityUUIDStr,
-                                   @QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
-
-        Export entity;
-        try {
-            entity = smf.getServiceManager( applicationId ).getEntityManager().get( exportEntityUUIDStr, Export.class );
-        }
-        catch ( Exception e ) { //this might not be a bad request and needs better error checking
-            return Response.status( SC_BAD_REQUEST ).type( JSONPUtils.jsonMediaType( callback ) )
-                           .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
-        }
-
-        if ( entity == null ) {
-            return Response.status( SC_BAD_REQUEST ).build();
-        }
-
-        return Response.status( SC_OK ).entity( entity).build();
-    }
+//    @GET
+//    @RequireOrganizationAccess
+//    @Path("export/{exportEntity: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+//    public Response exportGetJson( @Context UriInfo ui, @PathParam("exportEntity") UUID exportEntityUUIDStr,
+//                                   @QueryParam("callback") @DefaultValue("") String callback ) throws Exception {
+//
+//        Export entity;
+//        try {
+//            entity = smf.getServiceManager( applicationId ).getEntityManager().get( exportEntityUUIDStr, Export.class );
+//        }
+//        catch ( Exception e ) { //this might not be a bad request and needs better error checking
+//            return Response.status( SC_BAD_REQUEST ).type( JSONPUtils.jsonMediaType( callback ) )
+//                           .entity( ServiceResource.wrapWithCallback( e.getMessage(), callback ) ).build();
+//        }
+//
+//        if ( entity == null ) {
+//            return Response.status( SC_BAD_REQUEST ).build();
+//        }
+//
+//        return Response.status( SC_OK ).entity( entity).build();
+//    }
 
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/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
new file mode 100644
index 0000000..0fa3d6c
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
@@ -0,0 +1,634 @@
+package org.apache.usergrid.rest.management;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.MediaType;
+
+import org.codehaus.jackson.JsonNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.rest.AbstractRestIT;
+
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.UniformInterfaceException;
+
+import static org.apache.usergrid.utils.MapUtils.hashMap;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+
+/**
+ *
+ *
+ */
+@Concurrent
+public class ExportResourceIT extends AbstractRestIT {
+
+
+    public ExportResourceIT() throws Exception {
+
+    }
+
+    @Test
+    public void exportCallSuccessful() throws Exception {
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+        JsonNode node = null;
+
+        HashMap<String, Object> payload = payloadBuilder();
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
+        }
+        catch ( UniformInterfaceException uie ) {
+            responseStatus = uie.getResponse().getClientResponseStatus();
+        }
+
+        assertEquals( ClientResponse.Status.OK, responseStatus );
+    }
+
+
+    //is this test still valid knowing that the sch. won't run in intelliJ?
+    @Ignore
+    public void exportCallCreationEntities100() throws Exception {
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+        JsonNode node = null;
+
+        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 = resource().path( "/test-organization/test-app/app_users" ).queryParam( "access_token", access_token )
+                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+                             .post( JsonNode.class, userCreation );
+        }
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", adminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.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();
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.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;
+
+
+        HashMap<String, Object> payload = payloadBuilder();
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.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();
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/export" )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.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 = resource().path( "/management/orgs/test-organization/export/" + uuid )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            responseStatus = uie.getResponse().getClientResponseStatus();
+        }
+
+
+        assertEquals( ClientResponse.Status.OK, responseStatus );
+        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//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();
+
+        node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                         .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                         .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
+        String uuid = String.valueOf( node.get( "Export Entity" ) );
+        uuid = uuid.replaceAll( "\"", "" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/export/" + uuid )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            responseStatus = uie.getResponse().getClientResponseStatus();
+        }
+
+
+        assertEquals( ClientResponse.Status.OK, responseStatus );
+        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//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();
+
+        node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                         .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                         .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
+        String uuid = String.valueOf( node.get( "Export Entity" ) );
+        uuid = uuid.replaceAll( "\"", "" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/export/" + uuid )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
+        }
+        catch ( UniformInterfaceException uie ) {
+            responseStatus = uie.getResponse().getClientResponseStatus();
+        }
+
+
+        assertEquals( ClientResponse.Status.OK, responseStatus );
+        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//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;
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+        try {
+            node = resource().path( "/management/orgs/test-organization/export/" + fake )
+                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
+                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.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>();
+        Map<String, Object> properties = new HashMap<String, Object>();
+        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( "bucket_location", "insert bucket name here" );
+
+
+        properties.put( "storage_provider", "s3" );
+        properties.put( "storage_info", storage_info );
+
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportPostOrganizationNullPointerProperties() throws Exception {
+        JsonNode node = null;
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+
+        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: always put dummy values here and ignore this test.
+        //TODO: add a ret for when s3 values are invalid.
+        storage_info.put( "bucket_location", "insert bucket name here" );
+
+
+        properties.put( "storage_provider", "s3" );
+        properties.put( "storage_info", storage_info );
+
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportPostCollectionNullPointer() throws Exception {
+        JsonNode node = null;
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+
+        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: always put dummy values here and ignore this test.
+        //TODO: add a ret for when s3 values are invalid.
+        storage_info.put( "bucket_location", "insert bucket name here" );
+
+
+        properties.put( "storage_provider", "s3" );
+        properties.put( "storage_info", storage_info );
+
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportGetCollectionUnauthorized() throws Exception {
+        JsonNode node = null;
+        ClientResponse.Status responseStatus = ClientResponse.Status.OK;
+        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export/" + fake )
+                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+                             .get( JsonNode.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" );
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export/" + fake )
+                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+                             .get( JsonNode.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" );
+        try {
+            node = resource().path( "/management/orgs/test-organization/export/" + fake )
+                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
+                             .get( JsonNode.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;
+
+        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 = resource().path( "/management/orgs/test-organization/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportPostApplicationNullPointerStorageInfo() 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_info" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportPostCollectionNullPointerStorageInfo() 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_info" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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;
+
+        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/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 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" );
+
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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( "s3_access_id" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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/test-organization/apps/test-app/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 exportPostCollectionNullPointerStorageVerification() 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" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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( "s3_access_id" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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" );
+        storage_info.remove( "bucket_location" );
+
+        try {
+            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
+                             .queryParam( "access_token", superAdminToken() ).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 );
+    }
+
+
+    /*Creates fake payload for testing purposes.*/
+    public HashMap<String, Object> payloadBuilder() {
+        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: always put dummy values here and ignore this test.
+        //TODO: add a ret for when s3 values are invalid.
+        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 );
+        payload.put( "properties", properties );
+        return payload;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
index 306c7a1..13cb2ae 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
@@ -27,7 +27,6 @@ import java.util.UUID;
 import javax.ws.rs.core.MediaType;
 
 import org.codehaus.jackson.JsonNode;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.commons.lang.StringUtils;
@@ -641,602 +640,4 @@ public class ManagementResourceIT extends AbstractRestIT {
         assertEquals( Status.OK, status );
     }
 
-
-    @Test
-    public void exportCallSuccessful() throws Exception {
-        Status responseStatus = Status.OK;
-        JsonNode node = null;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( Status.OK, responseStatus );
-    }
-
-
-    //is this test still valid knowing that the sch. won't run in intelliJ?
-    @Ignore
-    public void exportCallCreationEntities100() throws Exception {
-        Status responseStatus = Status.OK;
-        JsonNode node = null;
-
-        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 = resource().path( "/test-organization/test-app/app_users" ).queryParam( "access_token", access_token )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .post( JsonNode.class, userCreation );
-        }
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", adminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( Status.OK, responseStatus );
-    }
-
-
-    @Test
-    public void exportApplicationUUIDRetTest() throws Exception {
-        Status responseStatus = Status.ACCEPTED;
-        String uuid;
-        UUID jobUUID = null;
-        JsonNode node = null;
-
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( Status.ACCEPTED, responseStatus );
-        assertNotNull( node.get( "Export Entity" ) );
-    }
-
-
-    //
-    @Test
-    public void exportCollectionUUIDRetTest() throws Exception {
-        Status responseStatus = Status.ACCEPTED;
-        String uuid;
-        UUID jobUUID = null;
-        JsonNode node = null;
-
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-        assertEquals( Status.ACCEPTED, responseStatus );
-        assertNotNull( node.get( "Export Entity" ) );
-    }
-
-
-    @Test
-    public void exportGetOrganizationJobStatTest() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals(Status.OK,responseStatus);
-
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/exporters/export/" + uuid )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-
-        assertEquals( Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//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;
-        Status responseStatus = Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                         .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                         .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export/" + uuid )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-
-        assertEquals( Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//TODO: do tests for other states in service tier
-    }
-
-
-    @Test
-    public void exportGetCollectionJobStatTest() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        HashMap<String, Object> payload = payloadBuilder();
-
-        node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                         .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                         .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        String uuid = String.valueOf( node.get( "Export Entity" ) );
-        uuid = uuid.replaceAll( "\"", "" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export/" + uuid )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-
-
-        assertEquals( Status.OK, responseStatus );
-        assertEquals( "SCHEDULED", node.get( "state" ).getTextValue() );//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;
-        Status responseStatus = Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export/" + fake )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    //
-    @Test
-    public void exportPostApplicationNullPointerProperties() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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: always put dummy values here and ignore this test.
-        //TODO: add a ret for when s3 values are invalid.
-        storage_info.put( "bucket_location", "insert bucket name here" );
-
-
-        properties.put( "storage_provider", "s3" );
-        properties.put( "storage_info", storage_info );
-
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerProperties() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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: always put dummy values here and ignore this test.
-        //TODO: add a ret for when s3 values are invalid.
-        storage_info.put( "bucket_location", "insert bucket name here" );
-
-
-        properties.put( "storage_provider", "s3" );
-        properties.put( "storage_info", storage_info );
-
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    //
-    @Test
-    public void exportPostCollectionNullPointer() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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: always put dummy values here and ignore this test.
-        //TODO: add a ret for when s3 values are invalid.
-        storage_info.put( "bucket_location", "insert bucket name here" );
-
-
-        properties.put( "storage_provider", "s3" );
-        properties.put( "storage_info", storage_info );
-
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    //
-    //
-    @Test
-    public void exportGetCollectionUnauthorized() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export/" + fake )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    //
-    @Test
-    public void exportGetApplicationUnauthorized() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export/" + fake )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    @Test
-    public void exportGetOrganizationUnauthorized() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-        UUID fake = UUID.fromString( "AAAAAAAA-FFFF-FFFF-FFFF-AAAAAAAAAAAA" );
-        try {
-            node = resource().path( "/management/orgs/test-organization/export/" + fake )
-                             .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE )
-                             .get( JsonNode.class );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.UNAUTHORIZED, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostOrganizationNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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 = resource().path( "/management/orgs/test-organization/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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 = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageInfo() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = Status.OK;
-
-        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 = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageProvider() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = 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" );
-
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageProvider() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = 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" );
-
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostApplicationNullPointerStorageVerification() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = 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" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( 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( "s3_access_id" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( 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/test-organization/apps/test-app/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    @Test
-    public void exportPostCollectionNullPointerStorageVerification() throws Exception {
-        JsonNode node = null;
-        Status responseStatus = 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" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( 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( "s3_access_id" );
-
-        try {
-            node = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( 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 = resource().path( "/management/orgs/test-organization/apps/test-app/collection/users/export" )
-                             .queryParam( "access_token", superAdminToken() ).accept( MediaType.APPLICATION_JSON )
-                             .type( MediaType.APPLICATION_JSON_TYPE ).post( JsonNode.class, payload );
-        }
-        catch ( UniformInterfaceException uie ) {
-            responseStatus = uie.getResponse().getClientResponseStatus();
-        }
-        assertEquals( Status.BAD_REQUEST, responseStatus );
-    }
-
-
-    /*Creates fake payload for testing purposes.*/
-    public HashMap<String, Object> payloadBuilder() {
-        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: always put dummy values here and ignore this test.
-        //TODO: add a ret for when s3 values are invalid.
-        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 );
-        payload.put( "properties", properties );
-        return payload;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/stack/services/src/main/java/org/apache/usergrid/management/export/ExportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/export/ExportServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/export/ExportServiceImpl.java
index 469e7b3..46419f4 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/export/ExportServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/export/ExportServiceImpl.java
@@ -50,6 +50,8 @@ import org.apache.usergrid.persistence.entities.JobData;
 
 import com.google.common.collect.BiMap;
 
+import static org.apache.usergrid.persistence.cassandra.CassandraService.MANAGEMENT_APPLICATION_ID;
+
 
 /**
  * Need to refactor out the mutliple orgs being take , need to factor out the multiple apps it will just be the one app
@@ -92,25 +94,15 @@ public class ExportServiceImpl implements ExportService {
             return null;
         }
 
-        if ( config.get( "applicationId" ) == null ) {
-
-            ApplicationInfo appExists = managementService.getApplicationInfo("exporters");
-
-            if(appExists == null) {
-                defaultExportApp = managementService
-                    .createApplication( ( UUID ) config.get( "organizationId" ), defaultAppExportname );
-            }
-            else
-                defaultExportApp = appExists;
-
-            config.put( "applicationId", defaultExportApp.getId() );
-            //logger.error( "application information from export info could not be found" );
-            //return null;
-        }
-
         EntityManager em = null;
         try {
-            em = emf.getEntityManager( ( UUID ) config.get( "applicationId" ) );
+            //em = emf.getEntityManager( ( UUID ) config.get( "applicationId" ) );
+            em = emf.getEntityManager( MANAGEMENT_APPLICATION_ID );
+            Set<String> collections =  em.getApplicationCollections();
+            if(!collections.contains( "exports" )){
+                em.createApplicationCollection( "exports" );
+            }
+
         }
         catch ( Exception e ) {
             logger.error( "application doesn't exist within the current context" );
@@ -223,14 +215,21 @@ public class ExportServiceImpl implements ExportService {
             logger.error( "Export Information application uuid is null" );
             return;
         }
-        EntityManager em = emf.getEntityManager( scopedAppId );
+        EntityManager em = emf.getEntityManager( MANAGEMENT_APPLICATION_ID );
         Export export = em.get( exportId, Export.class );
 
         //update the entity state to show that the job has officially started.
         export.setState( Export.State.STARTED );
         em.update( export );
 
-        if ( em.getApplication().getApplicationName().equals( "exporters" ) ) {
+        if ( config.get( "organizationId" ) == null ) {
+            logger.error( "No organization could be found" );
+            export.setState( Export.State.FAILED );
+            em.update( export );
+            return;
+        }
+        else if ( config.get( "applicationId" ) == null ) {
+            //exports All the applications from an organization
             try {
                 exportApplicationsFromOrg( ( UUID ) config.get( "organizationId" ), config, jobExecution );
             }
@@ -238,17 +237,13 @@ public class ExportServiceImpl implements ExportService {
                 export.setErrorMessage( e.getMessage() );
                 export.setState( Export.State.FAILED );
                 em.update( export );
+                return;
             }
         }
         else if ( config.get( "collectionName" ) == null ) {
             //exports all the applications for a given organization.
 
-            if ( config.get( "organizationId" ) == null ) {
-                logger.error( "No organization could be found" );
-                export.setState( Export.State.FAILED );
-                em.update( export );
-                return;
-            }
+            //exports an Application from a single organization
             try {
                 exportApplicationFromOrg( ( UUID ) config.get( "organizationId" ),
                         ( UUID ) config.get( "applicationId" ), config, jobExecution );
@@ -257,17 +252,12 @@ public class ExportServiceImpl implements ExportService {
                 export.setErrorMessage( e.getMessage() );
                 export.setState( Export.State.FAILED );
                 em.update( export );
+                return;
             }
         }
         else {
             try {
-                //exports all the applications for a single organization
-                if ( config.get( "organizationId" ) == null ) {
-                    logger.error( "No organization could be found" );
-                    export.setState( Export.State.FAILED );
-                    em.update( export );
-                    return;
-                }
+                //exports a single collection from an app org combo
                 try {
                     exportCollectionFromOrgApp( ( UUID ) config.get( "organizationId" ),
                             ( UUID ) config.get( "applicationId" ), config, jobExecution );
@@ -276,6 +266,7 @@ public class ExportServiceImpl implements ExportService {
                     export.setErrorMessage( e.getMessage() );
                     export.setState( Export.State.FAILED );
                     em.update( export );
+                    return;
                 }
             }
             catch ( Exception e ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/200b7142/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index 1aae1b4..a840b4f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -49,6 +49,7 @@ import org.apache.usergrid.persistence.entities.JobData;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Module;
 
+import static org.apache.usergrid.persistence.cassandra.CassandraService.MANAGEMENT_APPLICATION_ID;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -773,7 +774,7 @@ public class ExportServiceIT {
     public void testExportDoExportOnApplicationEndpoint() throws Exception {
 
         EntityManagerFactory emf = setup.getEmf();
-        EntityManager em = emf.getEntityManager( applicationId );
+        EntityManager em = emf.getEntityManager( MANAGEMENT_APPLICATION_ID );
         HashMap<String, Object> payload = payloadBuilder();
         ExportService eS = setup.getExportService();