You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/07/15 19:51:44 UTC

[1/9] incubator-usergrid git commit: remove abstract rest it

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev ae11d89e0 -> b3a8c97d3


remove abstract rest it


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

Branch: refs/heads/two-dot-o-dev
Commit: 62b23e1fcb60a637f69d6cca280a13b8e351a3d7
Parents: f62f053
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Jul 15 10:45:14 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Jul 15 10:45:14 2015 -0600

----------------------------------------------------------------------
 .../apache/usergrid/rest/AbstractRestIT.java    | 509 -------------------
 .../applications/events/EventsResourceIT.java   |  41 +-
 .../applications/queries/BasicGeoTests.java     |   2 +-
 .../rest/management/ManagementResourceIT.java   |   8 +-
 .../applications/ApplicationsIT.java            |   4 +-
 .../rest/test/PropertiesResourceIT.java         |  80 ---
 .../rest/test/resource2point0/ClientSetup.java  |   4 +-
 7 files changed, 31 insertions(+), 617 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
deleted file mode 100644
index 1b3ee65..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.usergrid.java.client.Client;
-import org.apache.usergrid.management.ApplicationInfo;
-import org.apache.usergrid.management.OrganizationInfo;
-import org.apache.usergrid.management.OrganizationOwnerInfo;
-
-import org.apache.usergrid.persistence.exceptions.ApplicationAlreadyExistsException;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
-import static org.apache.usergrid.utils.MapUtils.hashMap;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-
-/**
- * Base class for testing Usergrid Jersey-based REST API. Implementations should model the
- * paths mapped, not the method names. For example, to test the the "password" mapping on
- * applications.users.UserResource for a PUT method, the test method(s) should following the
- * following naming convention: test_[HTTP verb]_[action mapping]_[ok|fail][_[specific
- * failure condition if multiple]
- */
-//@ArquillianSuiteDeployment
-//@RunWith(Arquillian.class)
-public abstract class AbstractRestIT extends JerseyTest {
-    private static final Logger LOG = LoggerFactory.getLogger( AbstractRestIT.class );
-    private static boolean usersSetup = false;
-
-    protected static TomcatRuntime tomcatRuntime = TomcatRuntime.getInstance();
-
-    protected static final ITSetup setup = ITSetup.getInstance();
-
-    private static ClientConfig clientConfig = new DefaultClientConfig();
-
-    protected static String access_token;
-
-    protected static String adminAccessToken;
-
-    protected static Client client;
-
-    protected static final AppDescriptor descriptor;
-
-
-    //private static final URI baseURI = setup.getBaseURI();
-
-    protected ObjectMapper mapper = new ObjectMapper();
-
-
-    public AbstractRestIT() {
-        super( descriptor );
-    }
-
-
-    static {
-        clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE );
-        descriptor = new WebAppDescriptor.Builder( "org.apache.usergrid.rest" )
-                .clientConfig( clientConfig ).build();
-        dumpClasspath( AbstractRestIT.class.getClassLoader() );
-    }
-
-
-//    // We set testable = false so we deploy the archive to the server and test it locally
-//    @org.jboss.arquillian.container.test.api.Deployment( testable = false )
-//    public static WebArchive createTestArchive() {
-//
-//        // we use the MavenImporter from shrinkwrap to just produce whatever maven would build then test with it
-//
-//        // set maven to be in offline mode
-//
-//        System.setProperty( "org.apache.maven.offline", "true" );
-//        return ShrinkWrap.create(MavenImporter.class)
-//            .loadPomFromFile( "pom.xml", "arquillian-tomcat" )
-//            .importBuildOutput()
-//            .as( WebArchive.class );
-//    }
-
-
-    @AfterClass
-    public static void teardown() {
-        access_token = null;
-        usersSetup = false;
-        adminAccessToken = null;
-    }
-
-
-    public ApplicationInfo appInfo = null;
-    public OrganizationInfo orgInfo = null;
-    public String orgAppPath = null;
-    public String username = null;
-    public String userEmail = null;
-
-    /** Quick fix to get old style test working again. We need them! */
-    @Before
-    public void setupOrgApp() throws Exception {
-
-        setup.getMgmtSvc().setup();
-
-        String rand = RandomStringUtils.randomAlphanumeric(5);
-
-        orgInfo = setup.getMgmtSvc().getOrganizationByName("test-organization");
-        if ( orgInfo == null  ) {
-            OrganizationOwnerInfo orgOwnerInfo = setup.getMgmtSvc().createOwnerAndOrganization(
-                "test-organization" + rand, "test", "test", "test@usergrid.org", rand, false, false);
-            orgInfo = orgOwnerInfo.getOrganization();
-        }
-
-        String appname =  "app-" + rand;
-        try {
-            appInfo = setup.getMgmtSvc().createApplication(orgInfo.getUuid(),appname);
-        }catch(ApplicationAlreadyExistsException e){
-            LOG.error("Failed to create application"+appname+", maybe this is ok", e);
-        }
-        refreshIndex( orgInfo.getName(), appInfo.getName() );
-
-        orgAppPath = appInfo.getName() + "/";
-        adminToken();
-
-        setupUsers();
-        refreshIndex( orgInfo.getName(), appInfo.getName() );
-
-        loginClient();
-        refreshIndex( orgInfo.getName(), appInfo.getName() );
-
-        LOG.info( "acquiring token" );
-        access_token = userToken( userEmail, "sesame" );
-        LOG.info( "with token: {}", access_token );
-
-    }
-
-
-    public static void dumpClasspath( ClassLoader loader ) {
-        System.out.println( "Classloader " + loader + ":" );
-
-        if ( loader instanceof URLClassLoader ) {
-            URLClassLoader ucl = ( URLClassLoader ) loader;
-            System.out.println( "\t" + Arrays.toString( ucl.getURLs() ) );
-        }
-        else {
-            System.out.println( "\t(cannot display components as not a URLClassLoader)" );
-        }
-
-        if ( loader.getParent() != null ) {
-            dumpClasspath( loader.getParent() );
-        }
-    }
-
-
-    protected void setupUsers() throws Exception {
-
-        LOG.info("Entering setupUsers");
-
-//        if ( usersSetup ) {
-//            LOG.info("Leaving setupUsers: already setup");
-//            return;
-//        }
-
-        String rand = RandomStringUtils.randomAlphanumeric(5);
-        username = "user-" + rand;
-        userEmail = username + "@example.com";
-
-        createUser( username, userEmail, "sesame", "User named " + rand);
-
-        //usersSetup = true;
-        LOG.info("Leaving setupUsers, setup user: " + userEmail );
-    }
-
-
-    public void loginClient() throws Exception {
-
-        String appNameOnly = appInfo.getName().split("/")[1];
-
-        client = new Client( "test-organization", appNameOnly ).withApiUrl(
-                UriBuilder.fromUri( "http://localhost/" ).port(tomcatRuntime.getPort() ).build().toString() );
-
-        org.apache.usergrid.java.client.response.ApiResponse response =
-            client.authorizeAppUser( userEmail, "sesame" );
-
-        assertTrue( response != null && response.getError() == null );
-    }
-
-
-    @Override
-    protected TestContainerFactory getTestContainerFactory() {
-        // return new
-        // com.sun.jersey.test.framework.spi.container.grizzly2.web.GrizzlyWebTestContainerFactory();
-        return new com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory();
-    }
-
-
-    @Override
-    protected URI getBaseURI() {
-        try {
-            return new URI("http://localhost:" + tomcatRuntime.getPort());
-        } catch (URISyntaxException e) {
-            throw new RuntimeException("Error determining baseURI", e);
-        }
-    }
-
-
-    public static void logNode( JsonNode node ) {
-        if ( LOG.isInfoEnabled() ) // - protect against unnecessary call to formatter
-        {
-            LOG.info("Node: " + mapToFormattedJsonString( node ) );
-        }
-    }
-
-
-    protected String userToken( String name, String password ) throws Exception {
-
-        try {
-            JsonNode node = mapper.readTree( resource().path( orgAppPath + "token" )
-                    .queryParam("grant_type", "password")
-                    .queryParam( "username", name )
-                    .queryParam( "password", password ).accept( MediaType.APPLICATION_JSON )
-                    .get( String.class ));
-
-            String userToken = node.get( "access_token" ).textValue();
-            LOG.info( "returning user token: {}", userToken );
-            return userToken;
-
-        } catch ( Exception e ) {
-            LOG.debug("Error getting user token", e);
-            throw e;
-        }
-    }
-
-
-    public void createUser( String username, String email, String password, String name ) {
-
-        try {
-            JsonNode node = mapper.readTree( resource().path( orgAppPath + "token" )
-                .queryParam( "grant_type", "password" )
-                .queryParam( "username", username )
-                .queryParam( "password", password )
-                .accept( MediaType.APPLICATION_JSON )
-                .get( String.class ));
-            if ( getError( node ) == null ) {
-                return;
-            }
-        }
-        catch ( Exception ex ) {
-            LOG.error( "Miss on user. Creating." );
-        }
-
-        adminToken();
-
-        Map<String, Object> payload = (Map<String, Object>)
-            hashMap( "email", (Object)email )
-            .map( "username", username )
-            .map( "name", name )
-            .map( "password", password )
-            .map( "pin", "1234" );
-
-        resource().path( orgAppPath + "users" )
-            .queryParam( "access_token", adminAccessToken )
-            .accept( MediaType.APPLICATION_JSON )
-            .type( MediaType.APPLICATION_JSON )
-            .post( payload );
-    }
-
-
-    public void setUserPassword( String username, String password ) throws IOException {
-        Map<String, String> data = new HashMap<String, String>();
-        data.put( "newpassword", password );
-
-        adminToken();
-
-        // change the password as admin. The old password isn't required
-        JsonNode node = mapper.readTree(
-            resource().path( String.format( orgAppPath + "users/%s/password", username ) )
-                .queryParam("access_token", adminAccessToken)
-                .accept(MediaType.APPLICATION_JSON)
-                .type(MediaType.APPLICATION_JSON_TYPE)
-                .post(String.class, data));
-    }
-
-
-    /** Acquire the management token for the test@usergrid.com user with the default password */
-    protected String adminToken() {
-        adminAccessToken = mgmtToken( "test@usergrid.com", "test" );
-        return adminAccessToken;
-    }
-
-
-    /** Get the super user's access token */
-    protected String superAdminToken() {
-        return mgmtToken( "superuser", "test" );
-    }
-
-
-    /** Acquire the management token for the test@usergrid.com user with the given password */
-    protected String mgmtToken( String user, String password ) {
-
-        ObjectMapper mapper = new ObjectMapper();
-
-        JsonNode node;
-        try {
-            node = mapper.readTree( resource().path( "/management/token" )
-                .queryParam( "grant_type", "password" )
-                .queryParam( "username", user )
-                .queryParam( "password", password )
-                .accept( MediaType.APPLICATION_JSON )
-                .get( String.class ));
-
-        } catch (IOException ex) {
-            throw new RuntimeException("Unable to parse response", ex);
-        }
-
-        String mgmToken = node.get( "access_token" ).textValue();
-        LOG.info( "got mgmt token: {}", mgmToken );
-        return mgmToken;
-    }
-
-
-    /** Get the entity from the entity array in the response */
-    protected JsonNode getEntity( JsonNode response, int index ) {
-        if ( response == null ) {
-            return null;
-        }
-
-        JsonNode entities = response.get( "entities" );
-
-        if ( entities == null ) {
-            return null;
-        }
-
-        int size = entities.size();
-
-        if ( size <= index ) {
-            return null;
-        }
-
-        return entities.get( index );
-    }
-
-
-    /** Get the entity from the entity array in the response */
-    protected JsonNode getEntity( JsonNode response, String name ) {
-        return response.get( "entities" ).get( name );
-    }
-
-
-    /** Get the uuid from the entity at the specified index */
-    protected UUID getEntityId( JsonNode response, int index ) {
-        return UUID.fromString( getEntity( response, index ).get( "uuid" ).asText() );
-    }
-
-
-    /**
-     * Get the property "name" from the entity at the specified index
-     * @param response
-     * @param index
-     * @return
-     */
-    protected String getEntityName(JsonNode response, int index){
-        return getEntity(response, index).get( "name" ).asText();
-    }
-
-
-    /** Get the error response */
-    protected JsonNode getError( JsonNode response ) {
-        return response.get( "error" );
-    }
-
-
-    /** convenience to return a ready WebResource.Builder in a single call */
-    protected WebResource.Builder appPath( String path ) {
-        return resource().path( orgAppPath + "" + path )
-                .queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE );
-    }
-
-
-    /** convenience to return a ready WebResource.Builder in a single call */
-    protected WebResource.Builder path( String path ) {
-        return resource().path( path )
-                .queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE );
-    }
-
-
-    /** Sets a management service property locally and remotely. */
-    public void setTestProperty( String key, String value ) {
-
-        // set the value locally (in the Usergrid instance here in the JUnit classloader
-        setup.getMgmtSvc().getProperties().setProperty( key, value );
-
-        // set the value remotely (in the Usergrid instance running in Tomcat classloader)
-        Map<String, String> props = new HashMap<String, String>();
-        props.put( key, value );
-        resource().path( "/testproperties" ).queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE ).post( props );
-    }
-
-
-    /** Set a management service properties locally and remotely. */
-    public void setTestProperties( Map<String, String> props ) {
-
-        // set the values locally (in the Usergrid instance here in the JUnit classloader
-        for ( String key : props.keySet() ) {
-            setup.getMgmtSvc().getProperties().setProperty( key, props.get( key ) );
-        }
-
-        // set the values remotely (in the Usergrid instance running in Tomcat classloader)
-        resource().path( "/testproperties" ).queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE ).post( props );
-    }
-
-
-    /** Get all management service properties from the Tomcat instance of the service. */
-    public Map<String, String> getRemoteTestProperties() {
-        return resource().path( "/testproperties" ).queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE ).get( Map.class );
-    }
-
-
-    protected void refreshIndex( UUID appId ) {
-
-        LOG.debug("Refreshing index for appId {}", appId );
-
-        try {
-
-            resource().path( "/refreshindex" )
-                .queryParam( "app_id", appId.toString() )
-                .accept( MediaType.APPLICATION_JSON )
-                .post();
-
-        } catch ( Exception e) {
-            LOG.debug("Error refreshing index", e);
-            return;
-        }
-
-        LOG.debug("Refreshed index for appId {}", appId );
-    }
-
-    //TODO: move refresh index into context so that we automatically refresh the indexs without needing to call
-    //different values of context.
-    public void refreshIndex( String orgName, String appName ) {
-
-        LOG.debug("Refreshing index for app {}/{}", orgName, appName );
-
-        // be nice if somebody accidentally passed in orgName/appName
-        appName = appName.contains("/") ? appInfo.getName().split("/")[1] : appName;
-
-        try {
-
-            resource().path( "/refreshindex" )
-                .queryParam( "org_name", orgName )
-                .queryParam( "app_name", appName )
-                .accept( MediaType.APPLICATION_JSON )
-                .post();
-
-        } catch ( Exception e) {
-            LOG.debug("Error refreshing index", e);
-            return;
-        }
-
-        LOG.debug("Refreshed index for app {}/{}", orgName, appName );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
index 4eca687..a6a473e 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
@@ -24,11 +24,13 @@ import javax.ws.rs.core.MediaType;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
+
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource2point0.model.Token;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.rest.AbstractRestIT;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -47,22 +49,23 @@ public class EventsResourceIT extends AbstractRestIT {
         Map<String, Object> payload = new LinkedHashMap<String, Object>();
         payload.put( "timestamp", 0 );
         payload.put( "category", "advertising" );
-        payload.put( "counters", new LinkedHashMap<String, Object>() {
+        payload.put("counters", new LinkedHashMap<String, Object>() {
             {
-                put( "ad_clicks", 5 );
+                put("ad_clicks", 5);
             }
-        } );
+        });
 
+        Token token = getAppUserToken(clientSetup.getUsername(),clientSetup.getPassword());
         JsonNode node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
-                .queryParam( "access_token", access_token )
-                .accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE )
-                .post( String.class, payload ));
+                .queryParam( "access_token", token.getAccessToken() )
+            .accept(MediaType.APPLICATION_JSON )
+            .type(MediaType.APPLICATION_JSON_TYPE )
+            .post(String.class, payload ));
 
         assertNotNull( node.get( "entities" ) );
         String advertising = node.get( "entities" ).get( 0 ).get( "uuid" ).asText();
 
-        refreshIndex("test-organization","test-app");
+        refreshIndex();
 
         payload = new LinkedHashMap<String, Object>();
         payload.put( "timestamp", 0 );
@@ -74,7 +77,7 @@ public class EventsResourceIT extends AbstractRestIT {
         } );
 
         node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
-                .queryParam( "access_token", access_token )
+                .queryParam( "access_token", token.getAccessToken() )
                 .accept( MediaType.APPLICATION_JSON )
                 .type( MediaType.APPLICATION_JSON_TYPE )
                 .post( String.class, payload ));
@@ -82,7 +85,7 @@ public class EventsResourceIT extends AbstractRestIT {
         assertNotNull( node.get( "entities" ) );
         String sales = node.get( "entities" ).get( 0 ).get( "uuid" ).asText();
 
-        refreshIndex("test-organization","test-app");
+        refreshIndex( );
 
         payload = new LinkedHashMap<String, Object>();
         payload.put( "timestamp", 0 );
@@ -94,7 +97,7 @@ public class EventsResourceIT extends AbstractRestIT {
         } );
 
         node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
-                .queryParam( "access_token", access_token )
+                .queryParam( "access_token", token.getAccessToken() )
                 .accept( MediaType.APPLICATION_JSON )
                 .type( MediaType.APPLICATION_JSON_TYPE )
                 .post( String.class, payload ));
@@ -102,7 +105,7 @@ public class EventsResourceIT extends AbstractRestIT {
         assertNotNull( node.get( "entities" ) );
         String marketing = node.get( "entities" ).get( 0 ).get( "uuid" ).asText();
 
-        refreshIndex("test-organization","test-app");
+        refreshIndex();
 
         String lastId = null;
 
@@ -110,11 +113,11 @@ public class EventsResourceIT extends AbstractRestIT {
         for ( int i = 0; i < 3; i++ ) {
 
             node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
-                    .queryParam( "access_token", access_token )
+                    .queryParam( "access_token", token.getAccessToken() )
                     .accept( MediaType.APPLICATION_JSON )
                     .type( MediaType.APPLICATION_JSON_TYPE )
                     .get( String.class ));
-            logNode( node );
+
             assertEquals( "Expected Advertising", advertising, node.get( "messages" ).get( 0 ).get( "uuid" ).asText() );
             lastId = node.get( "last" ).asText();
         }
@@ -122,12 +125,12 @@ public class EventsResourceIT extends AbstractRestIT {
         // check sales event in queue
         node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
                 .queryParam( "last", lastId )
-                .queryParam( "access_token", access_token )
+                .queryParam( "access_token", token.getAccessToken() )
                 .accept( MediaType.APPLICATION_JSON )
                 .type( MediaType.APPLICATION_JSON_TYPE )
                 .get( String.class ));
 
-        logNode( node );
+
         assertEquals( "Expected Sales", sales, node.get( "messages" ).get( 0 ).get( "uuid" ).asText() );
         lastId = node.get( "last" ).asText();
 
@@ -135,12 +138,12 @@ public class EventsResourceIT extends AbstractRestIT {
         // check marketing event in queue
         node = mapper.readTree( resource().path( "/test-organization/test-app/events" )
                 .queryParam( "last", lastId )
-                .queryParam( "access_token", access_token )
+                .queryParam( "access_token", token.getAccessToken() )
                 .accept( MediaType.APPLICATION_JSON )
                 .type( MediaType.APPLICATION_JSON_TYPE )
                 .get( String.class ));
 
-        logNode( node );
+
         assertEquals( "Expected Marketing", marketing, node.get( "messages" ).get( 0 ).get( "uuid" ).asText() );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
index d2343a1..232f3c3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
@@ -21,10 +21,10 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.usergrid.rest.AbstractRestIT;
 import org.apache.usergrid.rest.TestContextSetup;
 
 import com.fasterxml.jackson.databind.JsonNode;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/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 580d629..cd4d3dc 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
@@ -37,7 +37,6 @@ import javax.ws.rs.core.MediaType;
 import java.io.IOException;
 import java.util.*;
 
-import static org.apache.usergrid.rest.AbstractRestIT.logNode;
 import static org.apache.usergrid.rest.management.ManagementResource.USERGRID_CENTRAL_URL;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.*;
@@ -411,7 +410,7 @@ public class ManagementResourceIT extends AbstractRestIT {
 
         JsonNode node = management.me().post( JsonNode.class, payload );
 
-        logNode( node );
+        logger.info("node:", node);
         String token = node.get( "access_token" ).textValue();
 
         assertNotNull( token );
@@ -429,15 +428,16 @@ public class ManagementResourceIT extends AbstractRestIT {
         form.add( "password", clientSetup.getPassword() );
 
         JsonNode node = management.me().post( JsonNode.class, form );
+        logger.info("node:", node);
 
-        logNode( node );
         String token = node.get( "access_token" ).textValue();
 
         assertNotNull( token );
 
         node = resource().path( "/management/me" ).queryParam( "access_token", token )
                          .accept( MediaType.APPLICATION_JSON ).get( JsonNode.class );
-        logNode( node );
+        logger.info("node:", node );
+
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
index b55e3f7..5ea556b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
@@ -22,10 +22,11 @@ import java.util.Set;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
+
+import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.usergrid.rest.AbstractRestIT;
 import org.apache.usergrid.rest.TestContextSetup;
 
 import static org.junit.Assert.assertEquals;
@@ -58,7 +59,6 @@ public class ApplicationsIT extends AbstractRestIT {
             appNames.add( name );
 
             context.withApp( name ).createAppForOrg();
-            refreshIndex(context.getOrgName(), name);
         }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/stack/rest/src/test/java/org/apache/usergrid/rest/test/PropertiesResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/PropertiesResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/PropertiesResourceIT.java
deleted file mode 100644
index 505ed0d..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/PropertiesResourceIT.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.apache.usergrid.rest.AbstractRestIT;
-import org.apache.usergrid.services.ServiceManagerFactory;
-
-import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
-
-
-public class PropertiesResourceIT extends AbstractRestIT {
-    static final Logger logger = LoggerFactory.getLogger( PropertiesResourceIT.class );
-
-
-    @Ignore("breaks other tests")
-    @Test
-    public void testBasicOperation() {
-
-        // set property locally
-        setup.getMgmtSvc().getProperties().put( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
-
-        // verify that it is set locally
-        Assert.assertTrue( setup.getMgmtSvc().newAdminUsersRequireConfirmation() );
-
-        // verify that is is not set in Jetty
-        {
-            Map map = resource().path( "/testproperties" )
-                    .queryParam( "access_token", access_token )
-                    .accept( MediaType.APPLICATION_JSON )
-                    .type( MediaType.APPLICATION_JSON_TYPE ).get(Map.class);
-            Assert.assertFalse( Boolean.parseBoolean(
-                    map.get( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION ).toString() ) );
-        }
-
-        // set property in Jetty
-        {
-            Map<String, String> props = new HashMap<String, String>();
-            props.put( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
-            resource().path( "/testproperties" )
-                    .queryParam( "access_token", access_token )
-                    .accept( MediaType.APPLICATION_JSON )
-                    .type( MediaType.APPLICATION_JSON_TYPE ).post( props );
-        }
-
-        // verify that it is set in Jetty
-        {
-            Map map = resource().path( "/testproperties" ).queryParam( "access_token", access_token )
-                    .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE ).get( Map.class );
-
-            Assert.assertTrue( Boolean.parseBoolean(
-                    map.get( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION ).toString() ) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62b23e1f/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 d9bda7c..be0e28d 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
@@ -109,7 +109,7 @@ public class ClientSetup implements TestRule {
         appName = "app_"+name+UUIDUtils.newTimeUUID();
 
         organization = restClient.management().orgs().post(
-            new Organization( orgName, username, username + "@usergrid.com", username, username, null ) );
+            new Organization( orgName, username, username + "@usergrid.com", username, password, null ) );
 
         restClient.management().token().get(username,password);
 
@@ -121,7 +121,7 @@ public class ClientSetup implements TestRule {
         application = new Application( appResponse );
         refreshIndex();
 
-        restClient.management().token().post(new Token(username,username));
+        ApiResponse response = restClient.management().token().post(new Token(username, password));
         refreshIndex();
     }
 


[9/9] incubator-usergrid git commit: Merge branch 'USERGRID-854' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o-dev

Posted by to...@apache.org.
Merge branch 'USERGRID-854' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o-dev


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

Branch: refs/heads/two-dot-o-dev
Commit: b3a8c97d3b0e3c9386bb470433c1f5dcc94e3137
Parents: ae11d89 876dc8d
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Jul 15 11:43:54 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Jul 15 11:43:54 2015 -0600

----------------------------------------------------------------------
 .../apache/usergrid/rest/AbstractRestIT.java    | 509 -------------------
 .../java/org/apache/usergrid/rest/BasicIT.java  |   6 +-
 .../apache/usergrid/rest/IndexResourceIT.java   |  15 +-
 .../apache/usergrid/rest/NotificationsIT.java   |  10 +-
 .../apache/usergrid/rest/PartialUpdateTest.java |   4 +-
 .../apache/usergrid/rest/SystemResourceIT.java  |   8 +-
 .../apache/usergrid/rest/TestContextSetup.java  |  81 ---
 .../rest/applications/ApplicationCreateIT.java  |  12 +-
 .../rest/applications/ApplicationDeleteIT.java  |  12 +-
 .../applications/ApplicationResourceIT.java     |   6 +-
 .../applications/assets/AssetResourceIT.java    |   6 +-
 .../collection/BrowserCompatibilityTest.java    |  11 +-
 .../collection/CollectionsResourceIT.java       |  16 +-
 .../collection/DuplicateNameIT.java             |   4 +-
 .../activities/ActivityResourceIT.java          |   6 +-
 .../collection/activities/PutTest.java          |  11 +-
 .../collection/devices/DevicesResourceIT.java   |   8 +-
 .../collection/groups/GroupResourceIT.java      |   6 +-
 .../collection/paging/PagingResourceIT.java     |  12 +-
 .../users/ConnectionResourceTest.java           |   8 +-
 .../collection/users/OwnershipResourceIT.java   |   6 +-
 .../collection/users/PermissionsResourceIT.java |   4 +-
 .../collection/users/RetrieveUsersTest.java     |  10 +-
 .../collection/users/UserResourceIT.java        |   6 +-
 .../events/ApplicationRequestCounterIT.java     |   8 +-
 .../applications/events/EventsResourceIT.java   |  41 +-
 .../applications/queries/AndOrQueryTest.java    |   6 +-
 .../queries/BadGrammarQueryTest.java            |   6 +-
 .../applications/queries/BasicGeoTests.java     |  38 +-
 .../applications/queries/GeoPagingTest.java     |   8 +-
 .../applications/queries/MatrixQueryTests.java  |  10 +-
 .../rest/applications/queries/OrderByTest.java  |   6 +-
 .../applications/queries/QueryTestBase.java     |   4 +-
 .../rest/applications/utils/TestUtils.java      |   4 +-
 .../rest/applications/utils/UserRepo.java       |   4 +-
 .../rest/filters/ContentTypeResourceIT.java     |   8 +-
 .../usergrid/rest/management/AccessTokenIT.java |  10 +-
 .../usergrid/rest/management/AdminUsersIT.java  |   6 +-
 .../rest/management/ExportResourceIT.java       |   7 +-
 .../rest/management/ImportResourceIT.java       |  12 +-
 .../rest/management/ManagementResourceIT.java   |  16 +-
 .../rest/management/OrganizationsIT.java        |   6 +-
 .../rest/management/RegistrationIT.java         |   4 +-
 .../organizations/AdminEmailEncodingIT.java     |  10 +-
 .../applications/ApplicationsIT.java            |  91 ----
 .../rest/test/PropertiesResourceIT.java         |  80 ---
 .../rest/test/resource/AbstractRestIT.java      | 184 +++++++
 .../rest/test/resource/ClientSetup.java         | 172 +++++++
 .../rest/test/resource/CollectionResource.java  |  27 -
 .../usergrid/rest/test/resource/Connection.java |  61 ---
 .../rest/test/resource/CustomCollection.java    |  32 --
 .../usergrid/rest/test/resource/DumbClient.java |  58 +++
 .../rest/test/resource/EntityResource.java      | 110 ----
 .../rest/test/resource/MatrixResource.java      |  64 ---
 .../apache/usergrid/rest/test/resource/Me.java  |  36 --
 .../rest/test/resource/NamedResource.java       | 195 -------
 .../usergrid/rest/test/resource/README.md       | 110 ++++
 .../usergrid/rest/test/resource/RestClient.java | 134 +++++
 .../rest/test/resource/RootResource.java        |  65 ---
 .../rest/test/resource/SetResource.java         |  96 ----
 .../rest/test/resource/TestContext.java         | 256 ----------
 .../rest/test/resource/TestOrganization.java    |  55 --
 .../test/resource/TestPropertiesResource.java   |  47 ++
 .../rest/test/resource/ValueResource.java       | 328 ------------
 .../rest/test/resource/app/Application.java     |  86 ----
 .../rest/test/resource/app/Collection.java      |  81 ---
 .../usergrid/rest/test/resource/app/Device.java |  49 --
 .../usergrid/rest/test/resource/app/Group.java  |  56 --
 .../test/resource/app/GroupsCollection.java     |  66 ---
 .../usergrid/rest/test/resource/app/Role.java   |  56 --
 .../rest/test/resource/app/RolesCollection.java |  64 ---
 .../usergrid/rest/test/resource/app/User.java   |  55 --
 .../rest/test/resource/app/UsersCollection.java |  86 ----
 .../resource/app/queue/DevicesCollection.java   |  37 --
 .../rest/test/resource/app/queue/Queue.java     | 193 -------
 .../resource/app/queue/QueuesCollection.java    |  36 --
 .../app/queue/SubscribersCollection.java        |  61 ---
 .../test/resource/app/queue/Transaction.java    |  84 ---
 .../app/queue/TransactionsCollection.java       |  36 --
 .../endpoints/ApplicationsResource.java         |  73 +++
 .../resource/endpoints/CollectionEndpoint.java  | 355 +++++++++++++
 .../resource/endpoints/DatabaseResource.java    |  39 ++
 .../test/resource/endpoints/EntityEndpoint.java | 174 +++++++
 .../test/resource/endpoints/NamedResource.java  | 358 +++++++++++++
 .../endpoints/OrganizationResource.java         |  49 ++
 .../test/resource/endpoints/RootResource.java   |  86 ++++
 .../test/resource/endpoints/SetupResource.java  |  52 ++
 .../test/resource/endpoints/SystemResource.java |  57 +++
 .../test/resource/endpoints/TokenResource.java  |  89 ++++
 .../test/resource/endpoints/UrlResource.java    |  44 ++
 .../endpoints/mgmt/ApplicationResource.java     | 105 ++++
 .../endpoints/mgmt/ApplicationsResource.java    |  65 +++
 .../endpoints/mgmt/AuthorizeResource.java       |  59 +++
 .../endpoints/mgmt/ConfirmResource.java         |  46 ++
 .../endpoints/mgmt/CredentialsResource.java     |  53 ++
 .../resource/endpoints/mgmt/FeedResource.java   |  49 ++
 .../endpoints/mgmt/ManagementResource.java      |  60 +++
 .../endpoints/mgmt/ManagementResponse.java      |  72 +++
 .../resource/endpoints/mgmt/MeResource.java     |  36 ++
 .../resource/endpoints/mgmt/OrgResource.java    | 167 ++++++
 .../mgmt/OrganizationApplicationResponse.java   |  60 +++
 .../endpoints/mgmt/OrganizationResource.java    |  80 +++
 .../endpoints/mgmt/PasswordResource.java        |  45 ++
 .../endpoints/mgmt/ReactivateResource.java      |  46 ++
 .../resource/endpoints/mgmt/ResetResource.java  |  42 ++
 .../endpoints/mgmt/RevokeTokenResource.java     |  32 ++
 .../endpoints/mgmt/RevokeTokensResource.java    |  33 ++
 .../resource/endpoints/mgmt/TokenResource.java  |  71 +++
 .../resource/endpoints/mgmt/UserResource.java   |  88 ++++
 .../resource/endpoints/mgmt/UsersResource.java  |  57 +++
 .../rest/test/resource/mgmt/Application.java    |  49 --
 .../resource/mgmt/ApplicationsCollection.java   |  53 --
 .../rest/test/resource/mgmt/Management.java     |  98 ----
 .../rest/test/resource/mgmt/Organization.java   |  60 ---
 .../resource/mgmt/OrganizationsCollection.java  |  74 ---
 .../test/resource/model/ActivityEntity.java     |  49 ++
 .../rest/test/resource/model/ApiResponse.java   | 223 ++++++++
 .../rest/test/resource/model/Application.java   |  39 ++
 .../resource/model/ChangePasswordEntity.java    |  33 ++
 .../rest/test/resource/model/Collection.java    |  98 ++++
 .../rest/test/resource/model/Credentials.java   |  47 ++
 .../rest/test/resource/model/Entity.java        | 213 ++++++++
 .../rest/test/resource/model/Organization.java  | 119 +++++
 .../test/resource/model/QueryParameters.java    |  93 ++++
 .../rest/test/resource/model/Token.java         |  81 +++
 .../usergrid/rest/test/resource/model/User.java | 101 ++++
 .../rest/test/resource/state/ClientContext.java |  39 ++
 .../test/resource2point0/AbstractRestIT.java    | 184 -------
 .../rest/test/resource2point0/ClientSetup.java  | 172 -------
 .../rest/test/resource2point0/DumbClient.java   |  58 ---
 .../rest/test/resource2point0/README.md         | 111 ----
 .../rest/test/resource2point0/RestClient.java   | 134 -----
 .../resource2point0/TestPropertiesResource.java |  47 --
 .../endpoints/ApplicationsResource.java         |  77 ---
 .../endpoints/CollectionEndpoint.java           | 357 -------------
 .../endpoints/DatabaseResource.java             |  39 --
 .../endpoints/EntityEndpoint.java               | 174 -------
 .../endpoints/NamedResource.java                | 356 -------------
 .../endpoints/OrganizationResource.java         |  49 --
 .../resource2point0/endpoints/RootResource.java |  86 ----
 .../endpoints/SetupResource.java                |  52 --
 .../endpoints/SystemResource.java               |  57 ---
 .../endpoints/TokenResource.java                |  89 ----
 .../resource2point0/endpoints/UrlResource.java  |  44 --
 .../endpoints/mgmt/ApplicationResource.java     | 105 ----
 .../endpoints/mgmt/ApplicationsResource.java    |  65 ---
 .../endpoints/mgmt/AuthorizeResource.java       |  59 ---
 .../endpoints/mgmt/ConfirmResource.java         |  46 --
 .../endpoints/mgmt/CredentialsResource.java     |  53 --
 .../endpoints/mgmt/FeedResource.java            |  49 --
 .../endpoints/mgmt/ManagementResource.java      |  60 ---
 .../endpoints/mgmt/ManagementResponse.java      |  72 ---
 .../endpoints/mgmt/MeResource.java              |  36 --
 .../endpoints/mgmt/OrgResource.java             | 167 ------
 .../mgmt/OrganizationApplicationResponse.java   |  60 ---
 .../endpoints/mgmt/OrganizationResource.java    |  80 ---
 .../endpoints/mgmt/PasswordResource.java        |  45 --
 .../endpoints/mgmt/ReactivateResource.java      |  46 --
 .../endpoints/mgmt/ResetResource.java           |  42 --
 .../endpoints/mgmt/RevokeTokenResource.java     |  32 --
 .../endpoints/mgmt/RevokeTokensResource.java    |  33 --
 .../endpoints/mgmt/TokenResource.java           |  71 ---
 .../endpoints/mgmt/UserResource.java            |  88 ----
 .../endpoints/mgmt/UsersResource.java           |  57 ---
 .../resource2point0/model/ActivityEntity.java   |  49 --
 .../test/resource2point0/model/ApiResponse.java | 219 --------
 .../test/resource2point0/model/Application.java |  39 --
 .../model/ChangePasswordEntity.java             |  33 --
 .../test/resource2point0/model/Collection.java  |  98 ----
 .../test/resource2point0/model/Credentials.java |  47 --
 .../rest/test/resource2point0/model/Entity.java | 212 --------
 .../resource2point0/model/Organization.java     | 119 -----
 .../resource2point0/model/QueryParameters.java  |  93 ----
 .../rest/test/resource2point0/model/Token.java  |  81 ---
 .../rest/test/resource2point0/model/User.java   | 101 ----
 .../resource2point0/state/ClientContext.java    |  39 --
 .../rest/test/security/TestAdminUser.java       |  63 ---
 .../rest/test/security/TestAppUser.java         |  63 ---
 .../usergrid/rest/test/security/TestUser.java   | 132 -----
 179 files changed, 4677 insertions(+), 8412 deletions(-)
----------------------------------------------------------------------



[5/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
new file mode 100644
index 0000000..dbf653d
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationResource.java
@@ -0,0 +1,105 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import javax.ws.rs.core.MediaType;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.Application;
+import org.apache.usergrid.rest.test.resource.model.*;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+
+/**
+ * Classy class class.
+ */
+public class ApplicationResource extends NamedResource {
+
+    private static final Logger logger = LoggerFactory.getLogger(ApplicationResource.class);
+
+    ObjectMapper mapper = new ObjectMapper();
+
+    public ApplicationResource(ClientContext context, UrlResource parent) {
+        super("applications", context, parent);
+    }
+
+    public ApplicationResource( final String name, final ClientContext context, final UrlResource parent ) {
+        super( name, context, parent );
+    }
+
+    public ApplicationResource addToPath( String pathPart ) {
+        return new ApplicationResource( pathPart, context, this );
+    }
+
+
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse post(Application application) {
+        org.apache.usergrid.rest.test.resource.model.ApiResponse apiResponse =getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON).post(org.apache.usergrid.rest.test.resource.model.ApiResponse.class, application);
+        return apiResponse;
+    }
+
+    public org.apache.usergrid.rest.test.resource.model.Entity post(org.apache.usergrid.rest.test.resource.model.Entity payload) {
+
+        String responseString = getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(MediaType.APPLICATION_JSON)
+            .post(String.class, payload);
+
+        logger.debug("Response from post: " + responseString);
+
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue(new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return new org.apache.usergrid.rest.test.resource.model.Entity(response);
+    }
+
+
+    public org.apache.usergrid.rest.test.resource.model.Entity get() {
+
+        String responseString = getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(MediaType.APPLICATION_JSON)
+            .get(String.class);
+
+        logger.debug("Response from post: " + responseString);
+
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue(new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return new org.apache.usergrid.rest.test.resource.model.Entity(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationsResource.java
new file mode 100644
index 0000000..caf93e8
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ApplicationsResource.java
@@ -0,0 +1,65 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+import java.io.StringReader;
+
+
+/**
+ * Management end-point for getting list of applications in organization.
+ */
+public class ApplicationsResource extends NamedResource {
+    private static final Logger logger = LoggerFactory.getLogger(ApplicationsResource.class);
+    ObjectMapper mapper = new ObjectMapper();
+
+    public ApplicationsResource( final ClientContext context, final UrlResource parent ) {
+        super( "apps", context, parent );
+    }
+
+    public ManagementResponse getOrganizationApplications() throws IOException {
+
+        String responseString = this.getResource()
+            .queryParam( "access_token", context.getToken().getAccessToken() )
+            .type(MediaType.APPLICATION_JSON)
+            .get(String.class);
+
+        logger.info("Response: " + responseString);
+
+        return mapper.readValue(
+            new StringReader(responseString), ManagementResponse.class);
+    }
+
+
+
+    public ApplicationResource app( final String appName ){
+        return new ApplicationResource( appName,context,this );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/AuthorizeResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/AuthorizeResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/AuthorizeResource.java
new file mode 100644
index 0000000..694f9c4
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/AuthorizeResource.java
@@ -0,0 +1,59 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import com.sun.jersey.api.client.GenericType;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+/**
+ * OAuth authorization resource
+ */
+public class AuthorizeResource extends NamedResource {
+    public AuthorizeResource(final ClientContext context, final UrlResource parent) {
+        super("authorize", context, parent);
+    }
+
+    /**
+     * Obtains an OAuth authorization
+     *
+     * @param requestEntity
+     * @return
+     */
+    public Object post(Object requestEntity) {
+        return getResource().post(Object.class, requestEntity);
+
+    }
+
+    /**
+     * Obtains an OAuth authorization
+     *
+     * @param type
+     * @param requestEntity
+     * @return
+     */
+    public <T> T post(Class<T> type, Object requestEntity) {
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return getResource().post(gt.getRawClass(), requestEntity);
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ConfirmResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ConfirmResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ConfirmResource.java
new file mode 100644
index 0000000..0a35353
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ConfirmResource.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * For confirming users
+ */
+public class ConfirmResource extends NamedResource {
+    public ConfirmResource( final ClientContext context, final UrlResource parent ) {
+        super( "confirm", context, parent );
+    }
+
+    public void get(QueryParameters queryParameters){
+        WebResource resource = getResource();
+        resource = addParametersToResource( resource, queryParameters );
+        String obj = resource.type( MediaType.TEXT_HTML_TYPE )
+                                       .accept( MediaType.TEXT_HTML).get( String.class );
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/CredentialsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/CredentialsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/CredentialsResource.java
new file mode 100644
index 0000000..073d6d6
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/CredentialsResource.java
@@ -0,0 +1,53 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Credentials;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ */
+public class CredentialsResource extends NamedResource {
+
+    public CredentialsResource(final ClientContext context, final UrlResource parent) {
+        super("credentials", context, parent);
+    }
+
+    public Credentials get(final QueryParameters parameters, final boolean useToken) {
+        WebResource resource = getResource(useToken);
+        resource = addParametersToResource(resource, parameters);
+        ApiResponse response = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+            .get(ApiResponse.class);
+        return new Credentials(response);
+    }
+
+    public Credentials get(final QueryParameters parameters) {
+        return get(parameters, true);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/FeedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/FeedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/FeedResource.java
new file mode 100644
index 0000000..8fd873b
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/FeedResource.java
@@ -0,0 +1,49 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Contains the REST methods to interacting with the ManagementEndpoints
+ * and the user feeds
+ */
+public class FeedResource extends NamedResource {
+    public FeedResource(final ClientContext context, final UrlResource parent) {
+        super ( "feed",context, parent);
+    }
+
+    public ApiResponse get() {
+        return getResource( true ).type( MediaType.APPLICATION_JSON_TYPE )
+            .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class);
+
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResource.java
new file mode 100644
index 0000000..bc31d34
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResource.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.*;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Contains the REST methods to interacting with the ManagementEndpoints
+ */
+public class ManagementResource extends NamedResource {
+    public ManagementResource( final ClientContext context, final UrlResource parent ) {
+        super( "management", context, parent );
+    }
+
+    public TokenResource token(){
+        return new TokenResource( context, this );
+    }
+
+    public MeResource me(){
+        return new MeResource( context, this );
+    }
+
+    public AuthorizeResource authorize(){
+        return new AuthorizeResource( context, this );
+    }
+
+    public OrgResource orgs() {
+        return new OrgResource( context, this );
+    }
+
+    public UsersResource users() {
+        return new UsersResource( context, this );
+    }
+
+    public EntityEndpoint externaltoken(){
+        return new EntityEndpoint("externaltoken",context,this);
+    }
+
+    public EntityEndpoint get(final String identifier){
+        return new EntityEndpoint(identifier, context, this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResponse.java
new file mode 100644
index 0000000..addd0db
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ManagementResponse.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import java.util.Map;
+
+
+/**
+ * Represents response from management end-points.
+ */
+public class ManagementResponse {
+    private String action;
+    private Map<String, Object> data;
+    private long timestamp;
+    private long duration;
+    private String uri;
+
+    public long getDuration() {
+        return duration;
+    }
+
+    public void setDuration(long duration) {
+        this.duration = duration;
+    }
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Map<String, Object> getData() {
+        return data;
+    }
+
+    public void setData(Map<String, Object> data) {
+        this.data = data;
+    }
+
+    public String getAction() {
+        return action;
+    }
+
+    public void setAction(String action) {
+        this.action = action;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/MeResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/MeResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/MeResource.java
new file mode 100644
index 0000000..1e5955e
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/MeResource.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Calls the management/me endpoints
+ */
+public class MeResource extends NamedResource {
+    public MeResource( final ClientContext context, final UrlResource parent ) {
+        super( "me", context, parent );
+    }
+
+    public TokenResource token(){
+        return new TokenResource(context,this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
new file mode 100644
index 0000000..2a5b813
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import javax.ws.rs.core.MediaType;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.model.User;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+import com.sun.jersey.api.representation.Form;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+
+//TODO: add error checking to each of the REST calls.
+/**
+ * Manages the Management/ORG endpoint.
+ */
+public class OrgResource  extends NamedResource {
+    private static final Logger logger = LoggerFactory.getLogger(OrgResource.class);
+
+    public OrgResource( final ClientContext context, final UrlResource parent ) {
+        super( "organizations", context, parent );
+    }
+
+
+    public OrganizationResource org( final String orgname ){
+        return new OrganizationResource( orgname,context,this );
+    }
+
+    /**
+     * This post is for the POST params case, where the entire call is made using queryParameters.
+     */
+    public Organization post(Form form){
+
+        // Seems like an apiresponse can't handle what gets returned from the from urlended media type
+
+        ApiResponse response = getResource().type( MediaType.APPLICATION_FORM_URLENCODED )
+            .accept(MediaType.APPLICATION_JSON)
+            .post(ApiResponse.class, form);
+
+        Organization organization = new Organization(response);
+        organization.setOwner( response );
+        return organization;
+    }
+
+    /**
+     * This post is for the POST params case, where the entire call is made using queryParameters.
+     */
+    public Organization post(QueryParameters parameters){
+
+        // Seems like an ApiResponse can't handle what gets returned from the from URL encoded media type
+        WebResource resource = addParametersToResource( getResource(), parameters);
+
+        // use string type so we can log actual response from server
+        String responseString = resource.type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON)
+            .post(String.class);
+
+        logger.debug("Response from post: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        Organization org = new Organization(response);
+        org.setOwner( response );
+
+        return org;
+    }
+
+    public Organization post(Organization organization){
+
+        // use string type so we can log actual response from server
+        String responseString = getResource(false).type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(MediaType.APPLICATION_JSON)
+            .post(String.class, organization);
+
+        logger.debug("Response from post: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        Organization org = new Organization(response);
+        org.setOwner( response );
+
+        return org;
+    }
+    public Organization post(Organization organization, Token token){
+        ApiResponse response = getResource(true,token).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
+                                            .post( ApiResponse.class,organization );
+
+        Organization org = new Organization(response);
+        org.setOwner( response );
+
+        return org;
+    }
+
+    public Organization put(Organization organization){
+
+        // use string type so we can log actual response from server
+        String responseString = getResource().type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(MediaType.APPLICATION_JSON)
+            .put(String.class, organization);
+
+        logger.debug("Response from put: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        Organization org = new Organization(response);
+        org.setOwner( response );
+
+        return org;
+
+    }
+
+    public Organization get(){
+        throw new UnsupportedOperationException("service doesn't exist");
+    }
+
+    public CredentialsResource credentials(){
+        return new CredentialsResource(  context ,this );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationApplicationResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationApplicationResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationApplicationResponse.java
new file mode 100644
index 0000000..9afe084
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationApplicationResponse.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import java.util.Map;
+
+public class OrganizationApplicationResponse {
+    private String action;
+    private Map<String, Object> data;
+    private long timestamp;
+    private long duration;
+
+    public long getDuration() {
+        return duration;
+    }
+
+    public void setDuration(long duration) {
+        this.duration = duration;
+    }
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public Map<String, Object> getData() {
+        return data;
+    }
+
+    public void setData(Map<String, Object> data) {
+        this.data = data;
+    }
+
+    public String getAction() {
+        return action;
+    }
+
+    public void setAction(String action) {
+        this.action = action;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
new file mode 100644
index 0000000..cf0987e
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrganizationResource.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+import java.util.Map;
+
+
+/**
+ * This is for the Management endpoint.
+ * Holds the information required for building and chaining organization objects to applications.
+ * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
+ */
+public class OrganizationResource extends NamedResource {
+
+    public OrganizationResource(final String name, final ClientContext context, final UrlResource parent) {
+        super(name, context, parent);
+    }
+
+    public UsersResource users() {
+        return new UsersResource(context, this);
+    }
+
+    public Organization get() {
+        ApiResponse rep = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON).get(ApiResponse.class);
+
+        //TODO: not sure if this will work for multiple users.
+        Organization org = new Organization(rep);
+        org.setUserOwner(rep);
+        return org;
+    }
+
+    // Doesn't return anything useful server side so this was made as a void. .
+    public void put(Organization organization) {
+        Map<String, Object> response = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON).put(Organization.class,
+                organization);
+
+    }
+
+    public ApplicationResource app(){
+        return new ApplicationResource(  context ,this );
+    }
+
+    public CredentialsResource credentials() {
+        return new CredentialsResource(context, this);
+    }
+
+    public ApplicationsResource apps() {
+        return new ApplicationsResource( context, this );
+    }
+
+
+    public ApplicationResource addToPath( String pathPart ) {
+        return new ApplicationResource( pathPart, context, this );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
new file mode 100644
index 0000000..59121ab
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/PasswordResource.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * Relations to the following endpoint
+ * /management/users/"username"/password
+ * Allows admin users to change their passwords
+ */
+public class PasswordResource extends NamedResource {
+
+    public PasswordResource( final ClientContext context, final UrlResource parent ) {
+        super( "password", context, parent );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
new file mode 100644
index 0000000..3959b3e
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ReactivateResource.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * handles the * /reactivate endpoints
+ */
+public class ReactivateResource extends NamedResource {
+    public ReactivateResource(final ClientContext context, final UrlResource parent) {
+        super("reactivate",context, parent);
+    }
+
+    public Entity get(){
+        WebResource resource = getResource(true);
+        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
+                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class);
+        return new Entity(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
new file mode 100644
index 0000000..076e284
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/ResetResource.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.representation.Form;
+
+
+/**
+ * Handles /resetpw endpoints for the user resource.
+ */
+public class ResetResource extends NamedResource {
+
+    public ResetResource( final ClientContext context, final UrlResource parent ) {
+        super( "resetpw", context, parent );
+    }
+
+    public String post(Form formPayload) {
+        return getResource().type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
+            .accept( MediaType.TEXT_HTML ).post( String.class, formPayload);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokenResource.java
new file mode 100644
index 0000000..8a73114
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokenResource.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Handles /revokeToken endpoint ( as opposed to revokeTokens
+ */
+public class RevokeTokenResource extends NamedResource {
+    public RevokeTokenResource( final ClientContext context, final UrlResource parent ) {
+        super( "revoketoken", context, parent );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokensResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokensResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokensResource.java
new file mode 100644
index 0000000..dcd3e5d
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/RevokeTokensResource.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Handles endpoints against /revoketokens
+ */
+public class RevokeTokensResource extends NamedResource {
+    public RevokeTokensResource( final ClientContext context, final UrlResource parent ) {
+        super( "revoketokens", context, parent );
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
new file mode 100644
index 0000000..613955a
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/TokenResource.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+
+/**
+ * Called by the ManagementResource. This contains anything token related that comes back to the ManagementResource.
+ */
+public class TokenResource extends NamedResource {
+    public TokenResource(final ClientContext context, final UrlResource parent) {
+        super("token", context, parent);
+    }
+
+    public Token get(String username, String password){
+        QueryParameters queryParameters = new QueryParameters();
+        queryParameters.addParam( "grant_type", "password" );
+        queryParameters.addParam( "username", username );
+        queryParameters.addParam( "password", password );
+        return get(queryParameters);
+
+    }
+    /**
+     * Obtains an access token and sets the token for the context to use in later calls
+     *
+     * @return
+     */
+    public Token get(QueryParameters params) {
+        WebResource resource = getResource(false);
+        resource = addParametersToResource(resource, params);
+        Token token = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+                              .get(Token.class);
+
+        this.context.setToken(token);
+        return token;
+    }
+
+
+    /**
+     * Convinece method to set the token needed for each call.
+     * @param token
+     * @return
+     */
+    public TokenResource setToken(Token token) {
+        this.context.setToken(token);
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
new file mode 100644
index 0000000..ee804e6
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UserResource.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * Relations to the following endpoint
+ * /management/users/"username"
+ * Store endpoints relating to specific users
+ */
+public class UserResource extends NamedResource {
+
+    public UserResource( final String name, final ClientContext context, final UrlResource parent ) {
+        super( name, context, parent );
+    }
+
+    public ReactivateResource reactivate() {
+        return new ReactivateResource( context, this );
+    }
+
+    public ConfirmResource confirm() {
+        return new ConfirmResource(context,this);
+    }
+
+    public PasswordResource password() {
+        return new PasswordResource( context, this );
+    }
+
+    public FeedResource feed() {
+        return new FeedResource( context, this );
+    }
+
+    public ResetResource resetpw() {
+        return new ResetResource(context,this);
+    }
+
+    public OrgResource organizations() {
+        return new OrgResource( context, this );
+    }
+
+    public RevokeTokensResource revokeTokens() {
+        return new RevokeTokensResource( context, this );
+    }
+
+    public RevokeTokenResource revokeToken() {
+        return new RevokeTokenResource( context, this );
+    }
+
+    public Entity get() {
+        WebResource resource = getResource( true );
+        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
+                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class );
+        return new Entity(response);
+    }
+
+    public Entity put(Entity userPayload){
+        WebResource resource = getResource(true);
+
+        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
+                                       .accept( MediaType.APPLICATION_JSON ).put( ApiResponse.class, userPayload);
+        return new Entity(response);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
new file mode 100644
index 0000000..5ef681d
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/UsersResource.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints.mgmt;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.EntityEndpoint;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * Handles calls to the users management endpoint
+ * Example: /management/orgs/org_name/users
+ */
+public class UsersResource extends NamedResource {
+    public UsersResource( final ClientContext context, final UrlResource parent ) {
+        super( "users", context, parent );
+    }
+
+
+    /**
+     * Should this be here? this would facilitate calling the entity endpoint as a way to get/put things
+     * @param identifier
+     * @return
+     */
+    //TODO: See if this should be reused here or if we should rename it to something else.
+    public EntityEndpoint entity(String identifier) {
+        return new EntityEndpoint(identifier, context, this);
+    }
+
+    public UserResource user(String identifier) {
+        return new UserResource( identifier, context, this );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Application.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Application.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Application.java
deleted file mode 100644
index d1e67c8..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Application.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.mgmt;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class Application extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public Application( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public Application( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/ApplicationsCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/ApplicationsCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/ApplicationsCollection.java
deleted file mode 100644
index 401167a..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/ApplicationsCollection.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.mgmt;
-
-
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author tnine */
-public class ApplicationsCollection extends CollectionResource {
-
-    /**
-     * @param collectionName
-     * @param parent
-     */
-    public ApplicationsCollection( NamedResource parent ) {
-        super( "apps", parent );
-    }
-
-
-    public Application application( String name ) {
-        return new Application( name, this );
-    }
-
-
-    /** Create the org and return it's UUID */
-    public UUID create( String name ) throws IOException {
-
-        JsonNode node = postInternal( MapUtils.hashMap( "name", name ) );
-
-        return getEntityId( node, 0 );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Management.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Management.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Management.java
deleted file mode 100644
index 78ea3ec..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Management.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.mgmt;
-
-
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.Me;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.RootResource;
-import org.apache.usergrid.rest.test.resource.app.UsersCollection;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author tnine */
-public class Management extends NamedResource {
-
-    protected ObjectMapper mapper = new ObjectMapper();
-
-    /**
-     * @param parent
-     */
-    public Management( RootResource root ) {
-        super( root );
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.apache.usergrid.rest.resource.NamedResource#addToUrl(java.lang.StringBuilder)
-     */
-    @Override
-    public void addToUrl( StringBuilder buffer ) {
-        parent.addToUrl( buffer );
-        buffer.append( SLASH );
-        buffer.append( "management" );
-    }
-
-
-    public UsersCollection users() {
-        return new UsersCollection( this );
-    }
-
-
-    public OrganizationsCollection orgs() {
-        return new OrganizationsCollection( this );
-    }
-
-
-    /** Get the token from management for this username and password */
-    public String tokenGet( String username, String password ) throws IOException {
-
-        JsonNode node = mapper.readTree( resource().path( String.format( "%s/token", url() ) ).queryParam( "grant_type", "password" )
-                .queryParam( "username", username ).queryParam( "password", password )
-                .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ));
-
-        return node.get( "access_token" ).asText();
-    }
-
-
-    /** Get the token from management for this username and password */
-    public String tokenPost( String username, String password ) throws IOException {
-
-        Map<String, String> payload =
-                MapUtils.hashMap( "grant_type", "password" ).map( "username", username ).map( "password", password );
-
-        JsonNode node = mapper.readTree( resource().path( String.format( "%s/token", url() ) ).accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE ).post( String.class, payload ));
-
-        return node.get( "access_token" ).asText();
-    }
-
-
-    public Me me() {
-        return new Me( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Organization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Organization.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Organization.java
deleted file mode 100644
index c143ebb..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/Organization.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.mgmt;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.app.UsersCollection;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class Organization extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public Organization( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public Organization( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-
-
-    public ApplicationsCollection apps() {
-        return new ApplicationsCollection( this );
-    }
-
-
-    public UsersCollection users() {
-        return new UsersCollection( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/OrganizationsCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/OrganizationsCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/OrganizationsCollection.java
deleted file mode 100644
index 522eadf..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/mgmt/OrganizationsCollection.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.mgmt;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.OrgUserUUIDWrapper;
-import org.apache.usergrid.rest.test.security.TestUser;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author tnine */
-public class OrganizationsCollection extends CollectionResource {
-
-    /**
-     * @param collectionName
-     * @param parent
-     */
-    public OrganizationsCollection( NamedResource parent ) {
-        super( "orgs", parent );
-    }
-
-
-    public Organization organization( String name ) {
-        return new Organization( name, this );
-    }
-
-
-    /** Create the org and return it's UUID */
-    public OrgUserUUIDWrapper create( String name, TestUser owner ) throws IOException {
-//not entirely convinced we want to do this here, maybe we should shove the node and data get another level deeper?
-        JsonNode node = postInternal(mapOrganization( name,owner.getUser(),owner.getEmail(),owner.getUser(),owner.getPassword() ) );
-
-//org && user uuid wrapper
-        OrgUserUUIDWrapper wrapper = new OrgUserUUIDWrapper(getOrgUUID( node ),getUserUUID(node) );
-
-        return wrapper;
-    }
-
-    public UUID getOrgUUID(JsonNode node){
-        return UUID.fromString(node.get("data").get( "organization" ).get("uuid").asText());
-    }
-
-    public UUID getUserUUID (JsonNode node){
-        return UUID.fromString( node.get( "data" ).get( "owner" ).get( "uuid" ).asText() );
-    }
-
-    public Map<String,String> mapOrganization(String orgName, String username, String email, String name, String password){
-
-        return MapUtils.hashMap( "organization", orgName ).map( "username", username )
-                       .map( "email", email ).map( "name", name )
-                       .map( "password", password);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ActivityEntity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ActivityEntity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ActivityEntity.java
new file mode 100644
index 0000000..f3c66fa
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ActivityEntity.java
@@ -0,0 +1,49 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import org.apache.usergrid.persistence.index.utils.MapUtils;
+
+import java.util.Map;
+
+/**
+ * Provide Guidance on ActivityEntity
+ */
+public class ActivityEntity extends Entity {
+    public ActivityEntity(String email, String verb, String content){
+        this.chainPut("content",content).chainPut("verb",verb).chainPut("email",email);
+    }
+    public ActivityEntity() {
+        this.putAll(new MapUtils.HashMapBuilder<String, Object>());
+    }
+    public ActivityEntity(Map<String,Object> map){
+        this.putAll(map);
+    }
+
+    public ActivityEntity putActor(Map<String, Object> actorPost) {
+        this.put("actor",actorPost);
+        return this;
+    }
+
+    public Map<String, Object> getActor() {
+        return (Map<String, Object>) this.get("actor");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ApiResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ApiResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ApiResponse.java
new file mode 100644
index 0000000..471cf5e
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ApiResponse.java
@@ -0,0 +1,223 @@
+/**
+ * Created by ApigeeCorporation on 12/4/14.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.model;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+
+
+/**
+ * Contains the needed types
+ */
+public class ApiResponse {
+
+    private String accessToken;
+
+    private String error;
+    private String errorDescription;
+    private String errorUri;
+    private String exception;
+
+    private String path;
+    private String uri;
+    private Object data;
+    private String status;
+    private long timestamp;
+    private List<Entity> entities;
+    private String cursor;
+
+
+    private final Map<String, Object> properties = new HashMap<String, Object>();
+
+
+    public ApiResponse() {
+    }
+
+
+    @JsonAnyGetter
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+
+    @JsonAnySetter
+    public void setProperty( String key, Object value ) {
+        properties.put( key, value );
+    }
+
+
+    @JsonProperty( "access_token" )
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+
+    @JsonProperty( "access_token" )
+    public void setAccessToken( String accessToken ) {
+        this.accessToken = accessToken;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getError() {
+        return error;
+    }
+
+
+    public void setError( String error ) {
+        this.error = error;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    @JsonProperty( "error_description" )
+    public String getErrorDescription() {
+        return errorDescription;
+    }
+
+
+    @JsonProperty( "error_description" )
+    public void setErrorDescription( String errorDescription ) {
+        this.errorDescription = errorDescription;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    @JsonProperty( "error_uri" )
+    public String getErrorUri() {
+        return errorUri;
+    }
+
+
+    @JsonProperty( "error_uri" )
+    public void setErrorUri( String errorUri ) {
+        this.errorUri = errorUri;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getException() {
+        return exception;
+    }
+
+
+    public void setException( String exception ) {
+        this.exception = exception;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getPath() {
+        return path;
+    }
+
+
+    public void setPath( String path ) {
+        this.path = path;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getUri() {
+        return uri;
+    }
+
+
+    public void setUri( String uri ) {
+        this.uri = uri;
+    }
+
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getStatus() {
+        return status;
+    }
+
+
+    public void setStatus( String status ) {
+        this.status = status;
+    }
+
+
+    public long getTimestamp() {
+        return timestamp;
+    }
+
+
+    public void setTimestamp( long timestamp ) {
+        this.timestamp = timestamp;
+    }
+
+    @JsonSerialize( include = Inclusion.NON_NULL  )
+    public List<Entity> getEntities() {
+        return entities;
+    }
+
+
+    public void setEntities( List<Entity> entities ) {
+        this.entities = entities;
+    }
+
+    public List<String> list(){
+        return (List<String>)getProperties().get("list");
+    }
+
+
+    public int getEntityCount() {
+        if ( entities == null ) {
+            return 0;
+        }
+        return entities.size();
+    }
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public String getCursor() {
+        return cursor;
+    }
+
+
+    public void setCursor( String cursor ) {
+        this.cursor = cursor;
+    }
+
+    @JsonSerialize( include = Inclusion.NON_NULL )
+    public Object getData() {
+        return data;
+    }
+
+    public void setData ( Object data ) {
+        this.data = data;
+    }
+
+    public Entity getEntity() {
+        return getEntities().get(0);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Application.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Application.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Application.java
new file mode 100644
index 0000000..96df4c5
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Application.java
@@ -0,0 +1,39 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Classy class class.
+ */
+public class Application extends Entity {
+    public Application(){  }
+
+    public Application(String name){
+        this.put("name",name);
+    }
+
+    public Application(ApiResponse response){
+        super(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ChangePasswordEntity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ChangePasswordEntity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ChangePasswordEntity.java
new file mode 100644
index 0000000..63291a5
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/ChangePasswordEntity.java
@@ -0,0 +1,33 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+/**
+ * Provide guidance on change passwords
+ */
+public class ChangePasswordEntity extends Entity {
+    public ChangePasswordEntity( String newPassword){
+        this.chainPut("newpassword", newPassword);
+    }
+    public ChangePasswordEntity(String oldPassword, String newPassword){
+        this.chainPut("oldpassword", oldPassword).chainPut("newpassword", newPassword);
+    }
+}


[8/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
remove old test framework


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

Branch: refs/heads/two-dot-o-dev
Commit: 876dc8d36b164cfc39a62a22e7a20f0f1773b65a
Parents: 62b23e1
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Jul 15 11:27:52 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Jul 15 11:27:52 2015 -0600

----------------------------------------------------------------------
 .../java/org/apache/usergrid/rest/BasicIT.java  |   6 +-
 .../apache/usergrid/rest/IndexResourceIT.java   |  15 +-
 .../apache/usergrid/rest/NotificationsIT.java   |  10 +-
 .../apache/usergrid/rest/PartialUpdateTest.java |   4 +-
 .../apache/usergrid/rest/SystemResourceIT.java  |   8 +-
 .../apache/usergrid/rest/TestContextSetup.java  |  81 -----
 .../rest/applications/ApplicationCreateIT.java  |  12 +-
 .../rest/applications/ApplicationDeleteIT.java  |  12 +-
 .../applications/ApplicationResourceIT.java     |   6 +-
 .../applications/assets/AssetResourceIT.java    |   6 +-
 .../collection/BrowserCompatibilityTest.java    |  11 +-
 .../collection/CollectionsResourceIT.java       |  16 +-
 .../collection/DuplicateNameIT.java             |   4 +-
 .../activities/ActivityResourceIT.java          |   6 +-
 .../collection/activities/PutTest.java          |  11 +-
 .../collection/devices/DevicesResourceIT.java   |   8 +-
 .../collection/groups/GroupResourceIT.java      |   6 +-
 .../collection/paging/PagingResourceIT.java     |  12 +-
 .../users/ConnectionResourceTest.java           |   8 +-
 .../collection/users/OwnershipResourceIT.java   |   6 +-
 .../collection/users/PermissionsResourceIT.java |   4 +-
 .../collection/users/RetrieveUsersTest.java     |  10 +-
 .../collection/users/UserResourceIT.java        |   6 +-
 .../events/ApplicationRequestCounterIT.java     |   8 +-
 .../applications/events/EventsResourceIT.java   |   4 +-
 .../applications/queries/AndOrQueryTest.java    |   6 +-
 .../queries/BadGrammarQueryTest.java            |   6 +-
 .../applications/queries/BasicGeoTests.java     |  38 +-
 .../applications/queries/GeoPagingTest.java     |   8 +-
 .../applications/queries/MatrixQueryTests.java  |  10 +-
 .../rest/applications/queries/OrderByTest.java  |   6 +-
 .../applications/queries/QueryTestBase.java     |   4 +-
 .../rest/applications/utils/TestUtils.java      |   4 +-
 .../rest/applications/utils/UserRepo.java       |   4 +-
 .../rest/filters/ContentTypeResourceIT.java     |   8 +-
 .../usergrid/rest/management/AccessTokenIT.java |  10 +-
 .../usergrid/rest/management/AdminUsersIT.java  |   6 +-
 .../rest/management/ExportResourceIT.java       |   7 +-
 .../rest/management/ImportResourceIT.java       |  12 +-
 .../rest/management/ManagementResourceIT.java   |   8 +-
 .../rest/management/OrganizationsIT.java        |   6 +-
 .../rest/management/RegistrationIT.java         |   4 +-
 .../organizations/AdminEmailEncodingIT.java     |  10 +-
 .../applications/ApplicationsIT.java            |  91 -----
 .../rest/test/resource/AbstractRestIT.java      | 184 ++++++++++
 .../rest/test/resource/ClientSetup.java         | 172 +++++++++
 .../rest/test/resource/CollectionResource.java  |  27 --
 .../usergrid/rest/test/resource/Connection.java |  61 ----
 .../rest/test/resource/CustomCollection.java    |  32 --
 .../usergrid/rest/test/resource/DumbClient.java |  58 +++
 .../rest/test/resource/EntityResource.java      | 110 ------
 .../rest/test/resource/MatrixResource.java      |  64 ----
 .../apache/usergrid/rest/test/resource/Me.java  |  36 --
 .../rest/test/resource/NamedResource.java       | 195 ----------
 .../usergrid/rest/test/resource/README.md       | 110 ++++++
 .../usergrid/rest/test/resource/RestClient.java | 134 +++++++
 .../rest/test/resource/RootResource.java        |  65 ----
 .../rest/test/resource/SetResource.java         |  96 -----
 .../rest/test/resource/TestContext.java         | 256 -------------
 .../rest/test/resource/TestOrganization.java    |  55 ---
 .../test/resource/TestPropertiesResource.java   |  47 +++
 .../rest/test/resource/ValueResource.java       | 328 -----------------
 .../rest/test/resource/app/Application.java     |  86 -----
 .../rest/test/resource/app/Collection.java      |  81 -----
 .../usergrid/rest/test/resource/app/Device.java |  49 ---
 .../usergrid/rest/test/resource/app/Group.java  |  56 ---
 .../test/resource/app/GroupsCollection.java     |  66 ----
 .../usergrid/rest/test/resource/app/Role.java   |  56 ---
 .../rest/test/resource/app/RolesCollection.java |  64 ----
 .../usergrid/rest/test/resource/app/User.java   |  55 ---
 .../rest/test/resource/app/UsersCollection.java |  86 -----
 .../resource/app/queue/DevicesCollection.java   |  37 --
 .../rest/test/resource/app/queue/Queue.java     | 193 ----------
 .../resource/app/queue/QueuesCollection.java    |  36 --
 .../app/queue/SubscribersCollection.java        |  61 ----
 .../test/resource/app/queue/Transaction.java    |  84 -----
 .../app/queue/TransactionsCollection.java       |  36 --
 .../endpoints/ApplicationsResource.java         |  73 ++++
 .../resource/endpoints/CollectionEndpoint.java  | 355 ++++++++++++++++++
 .../resource/endpoints/DatabaseResource.java    |  39 ++
 .../test/resource/endpoints/EntityEndpoint.java | 174 +++++++++
 .../test/resource/endpoints/NamedResource.java  | 358 +++++++++++++++++++
 .../endpoints/OrganizationResource.java         |  49 +++
 .../test/resource/endpoints/RootResource.java   |  86 +++++
 .../test/resource/endpoints/SetupResource.java  |  52 +++
 .../test/resource/endpoints/SystemResource.java |  57 +++
 .../test/resource/endpoints/TokenResource.java  |  89 +++++
 .../test/resource/endpoints/UrlResource.java    |  44 +++
 .../endpoints/mgmt/ApplicationResource.java     | 105 ++++++
 .../endpoints/mgmt/ApplicationsResource.java    |  65 ++++
 .../endpoints/mgmt/AuthorizeResource.java       |  59 +++
 .../endpoints/mgmt/ConfirmResource.java         |  46 +++
 .../endpoints/mgmt/CredentialsResource.java     |  53 +++
 .../resource/endpoints/mgmt/FeedResource.java   |  49 +++
 .../endpoints/mgmt/ManagementResource.java      |  60 ++++
 .../endpoints/mgmt/ManagementResponse.java      |  72 ++++
 .../resource/endpoints/mgmt/MeResource.java     |  36 ++
 .../resource/endpoints/mgmt/OrgResource.java    | 167 +++++++++
 .../mgmt/OrganizationApplicationResponse.java   |  60 ++++
 .../endpoints/mgmt/OrganizationResource.java    |  80 +++++
 .../endpoints/mgmt/PasswordResource.java        |  45 +++
 .../endpoints/mgmt/ReactivateResource.java      |  46 +++
 .../resource/endpoints/mgmt/ResetResource.java  |  42 +++
 .../endpoints/mgmt/RevokeTokenResource.java     |  32 ++
 .../endpoints/mgmt/RevokeTokensResource.java    |  33 ++
 .../resource/endpoints/mgmt/TokenResource.java  |  71 ++++
 .../resource/endpoints/mgmt/UserResource.java   |  88 +++++
 .../resource/endpoints/mgmt/UsersResource.java  |  57 +++
 .../rest/test/resource/mgmt/Application.java    |  49 ---
 .../resource/mgmt/ApplicationsCollection.java   |  53 ---
 .../rest/test/resource/mgmt/Management.java     |  98 -----
 .../rest/test/resource/mgmt/Organization.java   |  60 ----
 .../resource/mgmt/OrganizationsCollection.java  |  74 ----
 .../test/resource/model/ActivityEntity.java     |  49 +++
 .../rest/test/resource/model/ApiResponse.java   | 223 ++++++++++++
 .../rest/test/resource/model/Application.java   |  39 ++
 .../resource/model/ChangePasswordEntity.java    |  33 ++
 .../rest/test/resource/model/Collection.java    |  98 +++++
 .../rest/test/resource/model/Credentials.java   |  47 +++
 .../rest/test/resource/model/Entity.java        | 213 +++++++++++
 .../rest/test/resource/model/Organization.java  | 119 ++++++
 .../test/resource/model/QueryParameters.java    |  93 +++++
 .../rest/test/resource/model/Token.java         |  81 +++++
 .../usergrid/rest/test/resource/model/User.java | 101 ++++++
 .../rest/test/resource/state/ClientContext.java |  39 ++
 .../test/resource2point0/AbstractRestIT.java    | 184 ----------
 .../rest/test/resource2point0/ClientSetup.java  | 172 ---------
 .../rest/test/resource2point0/DumbClient.java   |  58 ---
 .../rest/test/resource2point0/README.md         | 111 ------
 .../rest/test/resource2point0/RestClient.java   | 134 -------
 .../resource2point0/TestPropertiesResource.java |  47 ---
 .../endpoints/ApplicationsResource.java         |  77 ----
 .../endpoints/CollectionEndpoint.java           | 357 ------------------
 .../endpoints/DatabaseResource.java             |  39 --
 .../endpoints/EntityEndpoint.java               | 174 ---------
 .../endpoints/NamedResource.java                | 356 ------------------
 .../endpoints/OrganizationResource.java         |  49 ---
 .../resource2point0/endpoints/RootResource.java |  86 -----
 .../endpoints/SetupResource.java                |  52 ---
 .../endpoints/SystemResource.java               |  57 ---
 .../endpoints/TokenResource.java                |  89 -----
 .../resource2point0/endpoints/UrlResource.java  |  44 ---
 .../endpoints/mgmt/ApplicationResource.java     | 105 ------
 .../endpoints/mgmt/ApplicationsResource.java    |  65 ----
 .../endpoints/mgmt/AuthorizeResource.java       |  59 ---
 .../endpoints/mgmt/ConfirmResource.java         |  46 ---
 .../endpoints/mgmt/CredentialsResource.java     |  53 ---
 .../endpoints/mgmt/FeedResource.java            |  49 ---
 .../endpoints/mgmt/ManagementResource.java      |  60 ----
 .../endpoints/mgmt/ManagementResponse.java      |  72 ----
 .../endpoints/mgmt/MeResource.java              |  36 --
 .../endpoints/mgmt/OrgResource.java             | 167 ---------
 .../mgmt/OrganizationApplicationResponse.java   |  60 ----
 .../endpoints/mgmt/OrganizationResource.java    |  80 -----
 .../endpoints/mgmt/PasswordResource.java        |  45 ---
 .../endpoints/mgmt/ReactivateResource.java      |  46 ---
 .../endpoints/mgmt/ResetResource.java           |  42 ---
 .../endpoints/mgmt/RevokeTokenResource.java     |  32 --
 .../endpoints/mgmt/RevokeTokensResource.java    |  33 --
 .../endpoints/mgmt/TokenResource.java           |  71 ----
 .../endpoints/mgmt/UserResource.java            |  88 -----
 .../endpoints/mgmt/UsersResource.java           |  57 ---
 .../resource2point0/model/ActivityEntity.java   |  49 ---
 .../test/resource2point0/model/ApiResponse.java | 219 ------------
 .../test/resource2point0/model/Application.java |  39 --
 .../model/ChangePasswordEntity.java             |  33 --
 .../test/resource2point0/model/Collection.java  |  98 -----
 .../test/resource2point0/model/Credentials.java |  47 ---
 .../rest/test/resource2point0/model/Entity.java | 212 -----------
 .../resource2point0/model/Organization.java     | 119 ------
 .../resource2point0/model/QueryParameters.java  |  93 -----
 .../rest/test/resource2point0/model/Token.java  |  81 -----
 .../rest/test/resource2point0/model/User.java   | 101 ------
 .../resource2point0/state/ClientContext.java    |  39 --
 .../rest/test/security/TestAdminUser.java       |  63 ----
 .../rest/test/security/TestAppUser.java         |  63 ----
 .../usergrid/rest/test/security/TestUser.java   | 132 -------
 177 files changed, 4653 insertions(+), 7802 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
index 689d852..fc20147 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/BasicIT.java
@@ -26,9 +26,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 
 import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
index d6b73e9..a84f91c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/IndexResourceIT.java
@@ -22,9 +22,10 @@ package org.apache.usergrid.rest;
 
 import com.sun.jersey.api.client.WebResource;
 import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -43,10 +44,8 @@ import static org.junit.Assert.fail;
 /**
  * test index creation
  */
-public class IndexResourceIT extends org.apache.usergrid.rest.test.resource2point0.AbstractRestIT {
+public class IndexResourceIT extends AbstractRestIT {
 
-    @Rule
-    public TestContextSetup context = new TestContextSetup( this );
     //Used for all MUUserResourceITTests
     private Logger LOG = LoggerFactory.getLogger(IndexResourceIT.class);
 
@@ -111,7 +110,7 @@ public class IndexResourceIT extends org.apache.usergrid.rest.test.resource2poin
         String appId = this.clientSetup.getAppUuid();
 
         // change the password as admin. The old password isn't required
-        org.apache.usergrid.rest.test.resource2point0.model.ApiResponse node = null;
+        org.apache.usergrid.rest.test.resource.model.ApiResponse node = null;
         try {
 
             WebResource resource = this.clientSetup.getRestClient().pathResource("/system/index/" + appId).getResource();
@@ -121,7 +120,7 @@ public class IndexResourceIT extends org.apache.usergrid.rest.test.resource2poin
             resource.addFilter( httpBasicAuthFilter );
 
             node = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                .get( org.apache.usergrid.rest.test.resource2point0.model.ApiResponse.class);
+                .get( org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
         } catch (Exception e) {
             LOG.error("failed", e);
             fail(e.toString());

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
index d5fb2db..07ec796 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/NotificationsIT.java
@@ -27,10 +27,10 @@ import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import javax.ws.rs.core.MediaType;
 import org.apache.commons.lang3.time.StopWatch;
-import org.apache.usergrid.rest.test.resource2point0.*;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.*;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.model.*;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.junit.After;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Test creating, sending and paging through Notifications via the REST API.
  */
-public class NotificationsIT extends org.apache.usergrid.rest.test.resource2point0.AbstractRestIT {
+public class NotificationsIT extends org.apache.usergrid.rest.test.resource.AbstractRestIT {
     private static final Logger logger = LoggerFactory.getLogger( NotificationsIT.class );
 
     private static final MetricRegistry registry = new MetricRegistry();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
index c02e171..97a02fd 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/PartialUpdateTest.java
@@ -18,8 +18,8 @@ package org.apache.usergrid.rest;
 
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.utils.MapUtils;
 import org.junit.Test;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
index f379672..7f09fa5 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
@@ -19,10 +19,10 @@ package org.apache.usergrid.rest;
 
 import org.junit.Test;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
 
 import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
deleted file mode 100644
index 4b7cc69..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TestContextSetup.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest;
-
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource.TestContext;
-import org.apache.usergrid.rest.test.security.TestAdminUser;
-
-import com.sun.jersey.test.framework.JerseyTest;
-import java.io.IOException;
-
-
-/**
- * A self configuring TestContext which sets itself up it implements TestRule. With a @Rule 
- * annotation, an instance of this Class as a public member in any test class or abstract 
- * test class will auto svcSetup itself before each test.
- */
-public class TestContextSetup extends TestContext implements TestRule {
-
-    public TestContextSetup( JerseyTest test ) {
-        super( test );
-    }
-
-
-    public Statement apply( Statement base, Description description ) {
-        return statement( base, description );
-    }
-
-
-    private Statement statement( final Statement base, final Description description ) {
-        return new Statement() {
-            @Override
-            public void evaluate() throws Throwable {
-                before( description );
-                try {
-                    base.evaluate();
-                }
-                finally {
-                    cleanup();
-                }
-            }
-        };
-    }
-
-
-    protected void cleanup() {
-        // might want to do something here later
-    }
-
-
-    protected void before( Description description ) throws IOException {
-        String testClass = description.getTestClass().getName();
-        String methodName = description.getMethodName();
-        String name = testClass + "." + methodName;
-
-        TestAdminUser testAdmin = new TestAdminUser( name+UUIDUtils.newTimeUUID(),
-                name + "@usergrid.com"+UUIDUtils.newTimeUUID(),
-                name + "@usergrid.com"+UUIDUtils.newTimeUUID() );
-        withOrg( name+ UUIDUtils.newTimeUUID() ).withApp( methodName + UUIDUtils.newTimeUUID() ).withUser(
-                testAdmin ).initAll();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationCreateIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationCreateIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationCreateIT.java
index 7ec562d..d2ad7ba 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationCreateIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationCreateIT.java
@@ -19,12 +19,12 @@ package org.apache.usergrid.rest.applications;
 
 
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResponse;
-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.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResponse;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Application;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Token;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
index d00ae74..cad0a37 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationDeleteIT.java
@@ -30,12 +30,12 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResponse;
-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.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResponse;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Application;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Token;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.UniformInterfaceException;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
index f296d06..ec858f7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
@@ -25,9 +25,9 @@ import org.apache.commons.lang.RandomStringUtils;
 import org.apache.shiro.codec.Base64;
 import org.apache.usergrid.cassandra.SpringResource;
 import org.apache.usergrid.management.ManagementService;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.OrganizationResource;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.OrganizationResource;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.apache.usergrid.setup.ConcurrentProcessSingleton;
 import org.apache.usergrid.utils.MapUtils;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
index 493d140..616d163 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/assets/AssetResourceIT.java
@@ -19,9 +19,9 @@ package org.apache.usergrid.rest.applications.assets;
 
 import com.sun.jersey.multipart.FormDataMultiPart;
 import org.apache.commons.io.IOUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.services.assets.data.AssetUtils;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
index 106151c..b453ed2 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
@@ -19,16 +19,9 @@ package org.apache.usergrid.rest.applications.collection;
 
 import java.io.IOException;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 
-import org.apache.usergrid.rest.TestContextSetup;
-import org.apache.usergrid.rest.test.resource.CustomCollection;
-
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import static junit.framework.Assert.assertNotNull;
 import static org.junit.Assert.assertEquals;
 
 
@@ -36,7 +29,7 @@ import static org.junit.Assert.assertEquals;
  * Simple tests to test querying at the REST tier
  */
 
-public class BrowserCompatibilityTest extends org.apache.usergrid.rest.test.resource2point0.AbstractRestIT {
+public class BrowserCompatibilityTest extends org.apache.usergrid.rest.test.resource.AbstractRestIT {
 
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
index 06e1088..2d9f126 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/CollectionsResourceIT.java
@@ -20,14 +20,14 @@ package org.apache.usergrid.rest.applications.collection;
 import java.io.IOException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-
-import org.apache.usergrid.rest.test.resource2point0.model.Credentials;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+
+import org.apache.usergrid.rest.test.resource.model.Credentials;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
 
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
index d01c533..ec69405 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
@@ -17,8 +17,8 @@
 package org.apache.usergrid.rest.applications.collection;
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
index f7737b9..94a1bb3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/ActivityResourceIT.java
@@ -19,9 +19,9 @@ package org.apache.usergrid.rest.applications.collection.activities;
 
 import com.sun.jersey.api.client.UniformInterfaceException;
 import org.apache.usergrid.persistence.index.utils.MapUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
index 2df73a2..d61d363 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
@@ -24,11 +24,10 @@ import java.util.Map;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.assertEquals;
 
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Rule;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -40,7 +39,7 @@ import org.slf4j.LoggerFactory;
  */
 public class PutTest extends AbstractRestIT {
     private static final Logger log= LoggerFactory.getLogger( PutTest.class );
-    
+
 
     @Test //USERGRID-545
     public void putMassUpdateTest() throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
index 58d856b..ee18c62 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/devices/DevicesResourceIT.java
@@ -22,10 +22,10 @@ import java.util.Map;
 import java.util.UUID;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
index 41e3cea..a442582 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
@@ -21,9 +21,9 @@ import java.io.IOException;
 import java.util.NoSuchElementException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
index d83ba7b..aac279c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
@@ -27,11 +27,11 @@ import org.junit.Ignore;
 import org.junit.Test;
 
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 
 import static org.junit.Assert.*;
 
@@ -158,7 +158,7 @@ public class PagingResourceIT extends AbstractRestIT {
         createEntities( trinketCollectionName, numOfEntities );
 
         //checks to make sure we don't get a cursor for just 5 entities.
-        //Created a new query parameter because when generated it store the cursor token back into it. 
+        //Created a new query parameter because when generated it store the cursor token back into it.
         queryParameters = new QueryParameters();
         queryParameters.setQuery( "select * ORDER BY created" );
         pageAndVerifyEntities( trinketCollectionName,queryParameters,numOfPages, numOfEntities );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
index de1aee7..22a6165 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
@@ -18,10 +18,10 @@ package org.apache.usergrid.rest.applications.collection.users;
 
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
index 87f2ab7..8667757 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
@@ -21,9 +21,9 @@ import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
index 8a1734f..61eb2a6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
@@ -20,8 +20,8 @@ package org.apache.usergrid.rest.applications.collection.users;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
index b7716ce..d5f7163 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
@@ -23,11 +23,11 @@ import java.util.Map;
 import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.EntityEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.endpoints.EntityEndpoint;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
index 06004bb..a387436 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
@@ -24,9 +24,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
index 0de8eb7..3c3b93d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/ApplicationRequestCounterIT.java
@@ -21,10 +21,10 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 
 import static org.junit.Assert.assertNotNull;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
index a6a473e..1384996 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/events/EventsResourceIT.java
@@ -25,8 +25,8 @@ import javax.ws.rs.core.MediaType;
 import com.fasterxml.jackson.databind.JsonNode;
 import java.io.IOException;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Token;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
index 8deab48..3af9f09 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
@@ -17,9 +17,9 @@
 package org.apache.usergrid.rest.applications.queries;
 
 
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
index fbc88c7..5a2134d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
@@ -18,9 +18,9 @@ package org.apache.usergrid.rest.applications.queries;
 
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Test;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
index 232f3c3..2246e17 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
@@ -21,11 +21,11 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Rule;
 import org.junit.Test;
 
-import org.apache.usergrid.rest.TestContextSetup;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.sun.jersey.api.client.UniformInterfaceException;
@@ -43,8 +43,6 @@ import static org.junit.Assert.fail;
  */
 public class BasicGeoTests extends AbstractRestIT {
 
-    @Rule
-    public TestContextSetup context = new TestContextSetup( this );
 
     public final String latitude = "latitude";
 
@@ -57,7 +55,7 @@ public class BasicGeoTests extends AbstractRestIT {
     public void createEntityWithGeoLocationPoint() throws IOException {
 
         String collectionType = "stores";
-        JsonNode node = null;
+        Entity node = null;
         Double lat = 37.776753;
         Double lon = -122.407846;
         //1. Create entity
@@ -67,7 +65,7 @@ public class BasicGeoTests extends AbstractRestIT {
         entityData.put( "location", latLon );
 
         try {
-            node = context.collection( collectionType ).post( entityData );
+            node = this.app().collection( collectionType ).post( entityData ).getEntity();
         }
         catch ( UniformInterfaceException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
@@ -76,8 +74,8 @@ public class BasicGeoTests extends AbstractRestIT {
 
         //2. Verify that the entity was created
         assertNotNull( node );
-        assertEquals( lat.toString(), node.get("location").get("latitude").asText() );
-        assertEquals( lon.toString(), node.get( "location" ).get("longitude").asText() );
+        assertEquals( lat.toString(), node.getMap("location").get("latitude").toString() );
+        assertEquals( lon.toString(), node.getMap("location").get("longitude").toString() );
 
     }
 
@@ -93,7 +91,7 @@ public class BasicGeoTests extends AbstractRestIT {
 
         String collectionType = "stores";
         String entityName = "cornerStore";
-        JsonNode entity = null;
+        Entity entity = null;
         Double lat = 37.776753;
         Double lon = -122.407846;
 
@@ -105,7 +103,7 @@ public class BasicGeoTests extends AbstractRestIT {
         entityData.put( "name", entityName );
 
         try {
-            entity = context.collection( collectionType ).post( entityData );
+            entity = this.app().collection( collectionType ).post( entityData ).getEntities().get(0);
         }
         catch ( UniformInterfaceException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
@@ -113,10 +111,10 @@ public class BasicGeoTests extends AbstractRestIT {
         }
 
         assertNotNull(entity);
-        assertEquals( lat.toString(), entity.get("location").get("latitude").asText() );
-        assertEquals( lon.toString(), entity.get( "location" ).get("longitude").asText() );
+        assertEquals( lat.toString(), entity.getMap("location").get("latitude").toString() );
+        assertEquals( lon.toString(), entity.getMap("location").get("longitude").toString() );
 
-        context.refreshIndex();
+        this.refreshIndex();
 
         //2. read back that entity make sure it is accurate
         /*
@@ -151,7 +149,7 @@ public class BasicGeoTests extends AbstractRestIT {
         assertEquals( newLon.toString(), entity.get( "location" ).get("longitude").asText() );
   */
 
-        context.refreshIndex();
+        this.refreshIndex();
 
         //4. read back the updated entity, make sure it is accurate
 
@@ -170,7 +168,7 @@ public class BasicGeoTests extends AbstractRestIT {
     public void createEntitiesWithBadSpelling() throws IOException {
 
         String collectionType = "stores";
-        JsonNode node = null;
+        Entity node = null;
         Double lat = 37.776753;
         Double lon = -122.407846;
 
@@ -181,7 +179,7 @@ public class BasicGeoTests extends AbstractRestIT {
         misspelledLatitudeEntityData.put( "location", misspelledLatitude );
 
         try {
-            node = context.collection( collectionType ).post( misspelledLatitudeEntityData );
+            node = this.app().collection( collectionType ).post( misspelledLatitudeEntityData ).getEntity();
             fail("System allowed misspelled location property - latitudee, which it should not");
         }
         catch ( UniformInterfaceException e ) {
@@ -197,7 +195,7 @@ public class BasicGeoTests extends AbstractRestIT {
         misspelledLongitudeEntityData.put( "location", misspelledLongitude );
 
         try {
-            node = context.collection( collectionType ).post( misspelledLongitudeEntityData );
+            node = this.app().collection( collectionType ).post( misspelledLongitudeEntityData ).getEntity();
             fail("System allowed misspelled location property - longitudee, which it should not");
         }
         catch ( UniformInterfaceException e ) {
@@ -218,7 +216,7 @@ public class BasicGeoTests extends AbstractRestIT {
     public void createEntitiesWithBadPoints() throws IOException {
 
         String collectionType = "stores";
-        JsonNode node = null;
+        Entity node = null;
         Double lat = 37.776753;
         Double lon = -122.407846;
 
@@ -228,7 +226,7 @@ public class BasicGeoTests extends AbstractRestIT {
         latitudeOnlyEntityData.put( "location", latitudeOnly );
 
         try {
-            node = context.collection( collectionType ).post( latitudeOnlyEntityData );
+            node = this.app().collection( collectionType ).post( latitudeOnlyEntityData ).getEntity();
             fail("System allowed location with only one point, latitude, which it should not");
         }
         catch ( UniformInterfaceException e ) {
@@ -244,7 +242,7 @@ public class BasicGeoTests extends AbstractRestIT {
         notDoubleLatLonEntityData.put( "location", notDoubleLatLon );
 
         try {
-            node = context.collection( collectionType ).post( notDoubleLatLonEntityData );
+            node = this.app().collection( collectionType ).post( notDoubleLatLonEntityData ).getEntity();
             fail("System allowed misspelled location values that are not doubles for latitude and longitude, which it should not");
         }
         catch ( UniformInterfaceException e ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
index 192e270..55c95b7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
@@ -28,10 +28,10 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.apache.usergrid.utils.MapUtils;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
index bb15178..de21e0a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
@@ -16,11 +16,11 @@
  */
 package org.apache.usergrid.rest.applications.queries;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.CollectionEndpoint;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Ignore;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
index 24d264d..84a8012 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
@@ -18,9 +18,9 @@ package org.apache.usergrid.rest.applications.queries;
 
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/QueryTestBase.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/QueryTestBase.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/QueryTestBase.java
index 5871c84..abdc8b0 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/QueryTestBase.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/QueryTestBase.java
@@ -16,8 +16,8 @@
  */
 package org.apache.usergrid.rest.applications.queries;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/TestUtils.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/TestUtils.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/TestUtils.java
index 4007e2d..fa8356d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/TestUtils.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/TestUtils.java
@@ -20,8 +20,8 @@ package org.apache.usergrid.rest.applications.utils;
 import java.util.UUID;
 
 import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Ignore;
 import org.apache.usergrid.utils.UUIDUtils;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/UserRepo.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/UserRepo.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/UserRepo.java
index fd948aa..6e9a403 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/UserRepo.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/utils/UserRepo.java
@@ -17,8 +17,8 @@
 package org.apache.usergrid.rest.applications.utils;
 
 
-import org.apache.usergrid.rest.test.resource2point0.ClientSetup;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
+import org.apache.usergrid.rest.test.resource.ClientSetup;
+import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.utils.UUIDUtils;
 
 import java.util.HashMap;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java
index 89fa922..c1dce29 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/filters/ContentTypeResourceIT.java
@@ -29,9 +29,9 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.util.EntityUtils;
 
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.model.User;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.model.User;
 import org.apache.usergrid.utils.JsonUtils;
 import org.apache.usergrid.utils.UUIDUtils;
 import org.junit.Ignore;
@@ -49,7 +49,7 @@ import static org.apache.usergrid.utils.MapUtils.hashMap;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
index 09b744c..d9089ca 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
@@ -21,11 +21,11 @@ import java.util.Map;
 
 import org.junit.Test;
 
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
 
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
index 1277ae2..2c086b8 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
@@ -27,7 +27,7 @@ import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMultipart;
 
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -38,8 +38,8 @@ import org.jvnet.mock_javamail.Mailbox;
 import org.apache.usergrid.management.MockImapClient;
 import org.apache.usergrid.persistence.core.util.StringUtils;
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource;
 
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/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 0874fc7..33bf360 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
@@ -26,9 +26,8 @@ import org.junit.Ignore;
 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 org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;
@@ -40,8 +39,6 @@ import static org.junit.Assert.fail;
 
 public class ExportResourceIT extends AbstractRestIT {
 
-    @Rule
-    public TestContextSetup context = new TestContextSetup( this );
 
 
     public ExportResourceIT() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
index 34371b6..a754eb0 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
@@ -30,12 +30,12 @@ import org.apache.usergrid.ServiceITSetupImpl;
 import org.apache.usergrid.batch.service.JobSchedulerService;
 import org.apache.usergrid.management.importer.S3Upload;
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.model.Token;
 import org.apache.usergrid.setup.ConcurrentProcessSingleton;
 
 import org.jclouds.ContextBuilder;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/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 cd4d3dc..1fe4974 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
@@ -25,9 +25,9 @@ import net.jcip.annotations.NotThreadSafe;
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.rest.management.organizations.OrganizationsResource;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.*;
+import org.apache.usergrid.rest.test.resource.model.Collection;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -48,7 +48,7 @@ import static org.junit.Assert.*;
 public class ManagementResourceIT extends AbstractRestIT {
 
     private static final Logger logger = LoggerFactory.getLogger(ManagementResourceIT.class);
-    private org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource management;
+    private org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource management;
 
     public ManagementResourceIT() throws Exception {
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
index 8a298f6..782c8cd 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
@@ -21,13 +21,13 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.model.*;
 import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.RestClient;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.RestClient;
 
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.UniformInterfaceException;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
index 4d85ade..bcaa521 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
@@ -21,8 +21,8 @@ import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.representation.Form;
 import org.apache.commons.lang.StringUtils;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.*;
 
 import org.junit.Test;
 import org.jvnet.mock_javamail.Mailbox;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/AdminEmailEncodingIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/AdminEmailEncodingIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/AdminEmailEncodingIT.java
index ceab55d..1392749 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/AdminEmailEncodingIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/AdminEmailEncodingIT.java
@@ -18,11 +18,11 @@ package org.apache.usergrid.rest.management.organizations;
 
 
 import com.sun.jersey.api.client.UniformInterfaceException;
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.apache.usergrid.rest.test.resource2point0.model.Application;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
+import org.apache.usergrid.rest.test.resource.AbstractRestIT;
+import org.apache.usergrid.rest.test.resource.model.Application;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.model.Token;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
deleted file mode 100644
index 5ea556b..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsIT.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.management.organizations.applications;
-
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-
-import org.apache.usergrid.rest.test.resource2point0.AbstractRestIT;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.usergrid.rest.TestContextSetup;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Ignore;
-
-
-/**
- *
- *
- */
-public class ApplicationsIT extends AbstractRestIT {
-
-    @Rule
-    public TestContextSetup context = new TestContextSetup( this );
-
-
-    @Test
-    @Ignore("ignored because this test fails because it does not account for the default app "
-            + "created by the TestContext and the sandbox app. "
-            + "see also: https://issues.apache.org/jira/browse/USERGRID-210 ")
-    public void test10AppLimit() throws IOException {
-
-        int size = 11;
-
-        Set<String> appNames = new HashSet<String>( size );
-
-        for ( int i = 0; i < size; i++ ) {
-            final String name = i + "";
-
-            appNames.add( name );
-
-            context.withApp( name ).createAppForOrg();
-        }
-
-
-        //now go through and ensure each entry is present
-
-        final JsonNode apps = context.management().orgs().organization( context.getOrgName() ).apps().get();
-
-        final JsonNode data = apps.get( "data" );
-
-        final String orgName = context.getOrgName();
-
-
-        final Set<String> copy = new HashSet<String> (appNames);
-
-        for(String appName: copy){
-
-            final String mapEntryName = String.format( "%s/%s", orgName.toLowerCase(),  appName.toLowerCase());
-
-            JsonNode orgApp = data.get( mapEntryName);
-
-            if(orgApp != null){
-                appNames.remove( appName );
-            }
-
-        }
-
-        assertEquals("All elements removed", 0, appNames.size());
-
-    }
-}


[7/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/AbstractRestIT.java
new file mode 100644
index 0000000..4ef2069
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/AbstractRestIT.java
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.sun.jersey.api.client.UniformInterfaceException;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.test.framework.AppDescriptor;
+import com.sun.jersey.test.framework.JerseyTest;
+import com.sun.jersey.test.framework.WebAppDescriptor;
+import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
+import org.apache.usergrid.rest.TomcatRuntime;
+import org.apache.usergrid.rest.test.resource.endpoints.ApplicationsResource;
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.OrganizationResource;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+import org.junit.Rule;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+
+
+
+/**
+ * Base class for REST tests.
+ */
+//@RunWith( Arquillian.class )
+public class AbstractRestIT extends JerseyTest {
+
+    private static ClientConfig clientConfig = new DefaultClientConfig();
+
+    public static TomcatRuntime tomcatRuntime = TomcatRuntime.getInstance();
+
+    @Rule
+    public ClientSetup clientSetup = new ClientSetup( this.getBaseURI().toString() );
+
+    protected static final AppDescriptor descriptor;
+
+    public AbstractRestIT() {
+        super( descriptor );
+    }
+
+
+    protected ObjectMapper mapper = new ObjectMapper();
+
+    static {
+        clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE );
+        descriptor = new WebAppDescriptor.Builder( "org.apache.usergrid.rest" )
+                .clientConfig( clientConfig ).build();
+        dumpClasspath( AbstractRestIT.class.getClassLoader() );
+    }
+
+
+//    //We set testable = false so we deploy the archive to the server and test it locally
+//    @Deployment( testable = false )
+//    public static WebArchive createTestArchive() {
+//
+//        //we use the MavenImporter from shrinkwrap to just produce whatever maven would build then test with it
+//
+//        //set maven to be in offline mode
+//
+//        System.setProperty( "org.apache.maven.offline", "true" );
+//
+//        return ShrinkWrap.create( MavenImporter.class ).loadPomFromFile( "pom.xml", "arquillian-tomcat" )
+//                         .importBuildOutput().as( WebArchive.class );
+//    }
+
+    public static void dumpClasspath( ClassLoader loader ) {
+        System.out.println( "Classloader " + loader + ":" );
+
+        if ( loader instanceof URLClassLoader ) {
+            URLClassLoader ucl = ( URLClassLoader ) loader;
+            System.out.println( "\t" + Arrays.toString( ucl.getURLs() ) );
+        }
+        else {
+            System.out.println( "\t(cannot display components as not a URLClassLoader)" );
+        }
+
+        if ( loader.getParent() != null ) {
+            dumpClasspath( loader.getParent() );
+        }
+    }
+
+    @Override
+    protected URI getBaseURI() {
+        try {
+            return new URI("http://localhost:" + tomcatRuntime.getPort());
+        } catch (URISyntaxException e) {
+            throw new RuntimeException("Error determining baseURI", e);
+        }
+    }
+
+    @Override
+    protected TestContainerFactory getTestContainerFactory() {
+        return new com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory();
+    }
+
+    ///myorg/
+    protected OrganizationResource org(){
+        return clientSetup.restClient.org( clientSetup.getOrganization().getName() );
+    }
+
+    //myorg/myapp
+    protected ApplicationsResource app(){
+        return clientSetup.restClient.org(clientSetup.getOrganization().getName()).app(clientSetup.getAppName());
+
+    }
+
+    protected ManagementResource management(){
+        return clientSetup.restClient.management();
+    }
+
+    protected NamedResource pathResource(String path){ return clientSetup.restClient.pathResource(path);}
+
+    protected String getOrgAppPath(String additionalPath){
+        return clientSetup.orgName + "/" + clientSetup.appName + "/" + (additionalPath !=null ? additionalPath : "");
+    }
+
+    protected ClientContext context(){
+        return this.clientSetup.getRestClient().getContext();
+    }
+
+
+    protected Token getAppUserToken(String username, String password){
+        return this.app().token().post(new Token(username,password));
+    }
+
+    public void refreshIndex() {
+        //TODO: add error checking and logging
+        clientSetup.refreshIndex();
+    }
+
+
+    /**
+     * Takes in the expectedStatus message and the expectedErrorMessage then compares it to the UniformInterfaceException
+     * to make sure that we got what we expected.
+     * @param expectedStatus
+     * @param expectedErrorMessage
+     * @param uie
+     */
+    public void errorParse(int expectedStatus, String expectedErrorMessage, UniformInterfaceException uie){
+        assertEquals(expectedStatus,uie.getResponse().getStatus());
+        JsonNode errorJson = uie.getResponse().getEntity( JsonNode.class );
+        assertEquals( expectedErrorMessage, errorJson.get( "error" ).asText() );
+
+    }
+
+
+    protected Token getAdminToken(String username, String password){
+        return this.clientSetup.getRestClient().management().token().post(false,Token.class,
+                new Token(username, password),null,false
+        );
+    }
+
+    protected Token getAdminToken(){
+        return this.clientSetup.getRestClient().management().token().post(false,Token.class,
+                new Token(this.clientSetup.getUsername(),this.clientSetup.getUsername()),null,false
+        );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
new file mode 100644
index 0000000..3254173
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ClientSetup.java
@@ -0,0 +1,172 @@
+/**
+ * Created by ApigeeCorporation on 12/4/14.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource;
+
+
+import org.apache.usergrid.corepersistence.util.CpNamingUtils;
+import org.apache.usergrid.persistence.index.utils.UUIDUtils;
+import org.apache.usergrid.rest.test.resource.model.*;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+
+
+/**
+ * This class is used to setup the client rule that will setup the RestClient and create default applications.
+ */
+public class ClientSetup implements TestRule {
+
+    private Logger logger = LoggerFactory.getLogger( ClientSetup.class );
+
+    RestClient restClient;
+
+    protected String username;
+    protected String password;
+    protected String orgName;
+    protected String appName;
+    protected String appUuid;
+    protected Token superuserToken;
+    protected String superuserName = "superuser";
+    protected String superuserPassword = "superpassword";
+    protected Credentials clientCredentials;
+
+    protected Organization organization;
+    protected Entity application;
+
+
+    public ClientSetup (String serverUrl) {
+
+        restClient = new RestClient( serverUrl );
+    }
+
+    public Statement apply( Statement base, Description description ) {
+        return statement( base, description );
+    }
+
+
+    private Statement statement( final Statement base, final Description description ) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                before( description );
+                try {
+                    base.evaluate();
+                }
+                finally {
+                    cleanup();
+                }
+            }
+        };
+    }
+
+
+    protected void cleanup() {
+        // might want to do something here later
+    }
+
+
+    protected void before( Description description ) throws IOException {
+        String testClass = description.getTestClass().getName();
+        String methodName = description.getMethodName();
+        String name = testClass + "." + methodName;
+
+        try {
+            restClient.superuserSetup();
+            superuserToken = restClient.management().token().get(superuserName, superuserPassword);
+        } catch ( Exception e ) {
+            if ( logger.isDebugEnabled() ) {
+                logger.debug( "Error creating superuser, may already exist", e );
+            } else {
+                logger.warn( "Error creating superuser, may already exist");
+            }
+        }
+
+        username = "user_"+name + UUIDUtils.newTimeUUID();
+        password = username;
+        orgName = "org_"+name+UUIDUtils.newTimeUUID();
+        appName = "app_"+name+UUIDUtils.newTimeUUID();
+
+        organization = restClient.management().orgs().post(
+            new Organization( orgName, username, username + "@usergrid.com", username, password, null ) );
+
+        restClient.management().token().get(username,password);
+
+        clientCredentials = restClient.management().orgs().org( orgName ).credentials().get(Credentials.class);
+
+        ApiResponse appResponse = restClient.management().orgs()
+            .org( organization.getName() ).app().post(new Application(appName));
+        appUuid = ( String ) appResponse.getEntities().get( 0 ).get( "uuid" );
+        application = new Application( appResponse );
+        refreshIndex();
+
+        ApiResponse response = restClient.management().token().post(new Token(username, password));
+        refreshIndex();
+    }
+
+    public String getUsername(){return username;}
+
+    public String getEmail(){return username+"@usergrid.com";}
+
+    public String getPassword(){return password;}
+
+    public Organization getOrganization(){return organization;}
+
+    public String getOrganizationName(){return orgName;}
+
+    public String getAppName() {return appName;}
+
+    public String getAppUuid() {
+        return appUuid;
+    }
+
+    public Token getSuperuserToken() {
+        return superuserToken;
+    }
+
+    public String getSuperuserName() {
+        return superuserName;
+    }
+
+    public String getSuperuserPassword() {
+        return superuserPassword;
+    }
+
+    public Credentials getClientCredentials() {
+        return clientCredentials;
+    }
+
+    public void refreshIndex() {
+        this.restClient.refreshIndex(getOrganizationName(),getAppName(),
+            CpNamingUtils.getManagementApplicationId().getUuid().toString());
+
+        if(!CpNamingUtils.getManagementApplicationId().getUuid().toString().equals(getAppUuid())) {
+            this.restClient.refreshIndex(getOrganizationName(), getAppName(), getAppUuid());
+        }
+    }
+
+    public RestClient getRestClient(){
+        return restClient;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CollectionResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CollectionResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CollectionResource.java
deleted file mode 100644
index f28cc33..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CollectionResource.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-/** @author tnine */
-public class CollectionResource extends SetResource {
-
-
-    public CollectionResource( String collectionName, NamedResource parent ) {
-        super( collectionName, parent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Connection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Connection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Connection.java
deleted file mode 100644
index 5a87472..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Connection.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.app.UsersCollection;
-import org.apache.usergrid.rest.test.resource.app.GroupsCollection;
-import org.apache.usergrid.rest.test.resource.app.RolesCollection;
-import org.apache.usergrid.rest.test.resource.app.queue.DevicesCollection;
-
-
-/** @author tnine */
-public class Connection extends ValueResource {
-
-
-    public Connection( String name, NamedResource parent ) {
-        super( name, parent );
-    }
-
-
-    public EntityResource entity( String deviceName ) {
-        return new EntityResource( deviceName, this );
-    }
-
-
-    public EntityResource entity( UUID entityId ) {
-        return new EntityResource( entityId, this );
-    }
-
-
-    public DevicesCollection devices() {
-        return new DevicesCollection( this );
-    }
-
-    public UsersCollection users() { return new UsersCollection(this);}
-
-    public GroupsCollection groups() { return new GroupsCollection(this);}
-
-    public RolesCollection roles() { return new RolesCollection(this);}
-
-
-    public CustomCollection collection( String name ) {
-        return new CustomCollection( name, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CustomCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CustomCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CustomCollection.java
deleted file mode 100644
index 29e8d44..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/CustomCollection.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-/** @author tnine */
-public class CustomCollection extends SetResource {
-
-
-    public CustomCollection( String name, NamedResource parent ) {
-        super( name, parent );
-    }
-
-
-    public EntityResource entity( String name ) {
-        return new EntityResource( name, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/DumbClient.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/DumbClient.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/DumbClient.java
new file mode 100644
index 0000000..ae74d4b
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/DumbClient.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.usergrid.persistence.index.utils.UUIDUtils;
+
+
+
+/**
+ * Test Class used to model if the client is working or doing what it is supposed to be doing.
+ * ask if this is for test purposes and if so if I can mark it with junit
+ */
+
+public class DumbClient extends AbstractRestIT {
+
+    @Test
+    public void stuff(){
+
+        String name = "stuff"+ UUIDUtils.newTimeUUID();
+       // User user = new User( "derp","derp", "derp"  );
+
+
+        //Organization org = clientSetup.getRestClient().management().orgs().post(  )
+      //  clientSetup.getRestClient().management().orgs().delete(org.getName);
+       // OrganizationResource response =  clientSetup.getRestClient().management().orgs().organization( "" );
+        //assertNotNull( response );
+        //EntityResponse itr  =  client.org( "test" ).getApp( "test" ).users().getEntityResponse();
+        //for(Entity entity: itr){
+    }
+
+
+    @Ignore
+    public void stateful(){
+
+//        EntityResponse itr  =  client.org( "test" ).getApp( "test" ).users().getEntityResponse();
+//
+//        for(Entity entity: itr){
+//
+//        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/EntityResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/EntityResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/EntityResource.java
deleted file mode 100644
index c8ad137..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/EntityResource.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import com.sun.jersey.api.client.ClientResponse.Status;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/** @author tnine */
-public class EntityResource extends ValueResource {
-
-    private String entityName;
-    private UUID entityId;
-
-
-    public EntityResource( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-        this.entityName = entityName;
-    }
-
-
-    public EntityResource( UUID entityId, NamedResource parent ) {
-        super( entityId.toString(), parent );
-        this.entityId = entityId;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.resource.NamedResource#addToUrl(java.lang.StringBuffer)
-     */
-    @Override
-    public void addToUrl( StringBuilder buffer ) {
-        parent.addToUrl( buffer );
-
-        buffer.append( SLASH );
-
-        if ( entityId != null ) {
-            buffer.append( entityId.toString() );
-        }
-        else if ( entityName != null ) {
-            buffer.append( entityName );
-        }
-    }
-
-
-    public JsonNode get() {
-        try {
-            return getInternal();
-        }
-        catch ( UniformInterfaceException uie ) {
-            if ( uie.getResponse().getClientResponseStatus() == Status.NOT_FOUND ) {
-                return null;
-            }
-            throw uie;
-        }
-        catch ( Exception ex ) {
-            throw new RuntimeException("Error parsing JSON", ex);
-        }
-    }
-
-
-    public JsonNode delete() throws IOException {
-        return deleteInternal();
-    }
-
-
-    public JsonNode post( Map<String, ?> data ) throws IOException {
-        return postInternal( data );
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public JsonNode post() throws IOException {
-        return postInternal( Collections.EMPTY_MAP );
-    }
-
-
-    public Connection connection( String name ) {
-        return new Connection( name, this );
-    }
-
-
-    public CustomCollection collection( String name ) {
-        return new CustomCollection( name, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/MatrixResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/MatrixResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/MatrixResource.java
deleted file mode 100644
index cee6676..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/MatrixResource.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.Map;
-
-
-/**
- * Class for returning elements of a collection via matrix
- */
-public class MatrixResource extends SetResource {
-
-
-    private MatrixResource( final String name, final NamedResource parent ) {
-        super( name, parent );
-    }
-
-
-    /**
-     * build the matrix resource.  We have to do this due to java super limitations
-     */
-    public static MatrixResource build( final String name, final Map<String, String> params,
-                                        final NamedResource parent ) {
-        StringBuilder builder = new StringBuilder();
-
-        builder.append( name );
-
-        for ( Map.Entry<String, String> entry : params.entrySet() ) {
-            builder.append( ";" );
-            builder.append( entry.getKey() );
-            builder.append( "=" );
-            builder.append( entry.getValue() );
-        }
-
-
-        return new MatrixResource( builder.toString(), parent );
-    }
-
-    public CollectionResource collection(String name) {
-        return new CollectionResource( name, this );
-    }
-
-
-    public Connection connection(String name){
-        return new Connection(name, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Me.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Me.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Me.java
deleted file mode 100644
index 91098b1..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/Me.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import org.apache.usergrid.rest.test.resource.app.User;
-
-
-/**
- * The "Me" resource from management
- *
- * @author tnine
- */
-public class Me extends User {
-
-    /**
-     * @param parent
-     */
-    public Me( NamedResource parent ) {
-        super( "me", parent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/NamedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/NamedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/NamedResource.java
deleted file mode 100644
index 262c962..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/NamedResource.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import javax.ws.rs.core.MediaType;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.WebResource.Builder;
-
-
-/**
- * @author tnine
- */
-public abstract class NamedResource {
-    
-    protected ObjectMapper mapper = new ObjectMapper();
-
-
-    protected static final String SLASH = "/";
-
-    protected NamedResource parent;
-
-    protected String accept;
-
-
-    /**
-     *
-     */
-    public NamedResource( NamedResource parent ) {
-        this.parent = parent;
-    }
-
-
-    public NamedResource getParent() {
-        return parent;
-    }
-
-
-    /**
-     * Get the url to this resource
-     */
-    public String url() {
-        StringBuilder buff = new StringBuilder();
-        addToUrl( buff );
-        return buff.toString();
-    }
-
-
-    /**
-     * Get the resource for calling the url.  Will have the token pre-loaded if the token is set
-     */
-    protected WebResource resource() {
-        return parent.resource();
-    }
-
-
-    /**
-     * Get the token for this request
-     */
-    protected String token() {
-        return parent.token();
-    }
-
-
-    /**
-     * Set the media type on the webResource
-     */
-    protected Builder jsonMedia( WebResource resource ) {
-
-        Builder builder = resource.type( MediaType.APPLICATION_JSON_TYPE );
-
-        if(accept == null){
-            builder = builder.accept( MediaType.APPLICATION_JSON );
-        } else{
-            builder = builder.accept( accept );
-        }
-
-        return builder;
-    }
-
-
-    protected WebResource withToken( WebResource resource ) {
-        String token = token();
-
-        resource = resource.path( url() );
-
-        if ( token != null ) {
-            resource = resource.queryParam( "access_token", token );
-        }
-
-        return resource;
-    }
-
-
-    public <T extends ValueResource> T withAccept( String accept ) {
-        this.accept = accept;
-        return ( T ) this;
-    }
-
-
-    /**
-     * Method to add params to the generated url.  Subclasses can override it
-     */
-    protected WebResource withParams( WebResource resource ) {
-        return resource;
-    }
-
-
-    /**
-     * Get the entity from the entity array in the response
-     */
-    protected JsonNode getEntity( JsonNode response, int index ) {
-        return response.get( "entities" ).get( index );
-    }
-
-
-    /**
-     * Get the entity from the entity array in the response
-     */
-    protected JsonNode getEntity( JsonNode response, String name ) {
-        return response.get( "entities" ).get( name );
-    }
-
-
-    /**
-     * Get the uuid from the entity at the specified index
-     */
-    protected UUID getEntityId( JsonNode response, int index ) {
-        return UUID.fromString( getEntity( response, index ).get( "uuid" ).asText() );
-    }
-
-
-    /**
-     * Parse the root response and return each entity as a json node in a list
-     */
-    protected List<JsonNode> getEntries( JsonNode response ) {
-        return getNodesAsList( "path", response );
-    }
-
-
-    /**
-     * Get nodes as a list
-     */
-    protected List<JsonNode> getNodesAsList( String path, JsonNode response ) {
-        JsonNode entities = response.path( path );
-
-        int size = entities.size();
-
-
-        List<JsonNode> entries = new ArrayList<JsonNode>();
-
-        for ( int i = 0; i < size; i++ ) {
-
-            entries.add( entities.get( i ) );
-        }
-
-        return entries;
-    }
-
-
-    /**
-     * Get the error response
-     */
-    protected JsonNode getError( JsonNode response ) {
-        return response.get( "error" );
-    }
-
-
-    /**
-     * Add itself to the end of the URL. Should not append a final "/"  Shouldn't ever be used by the client!
-     */
-    public abstract void addToUrl( StringBuilder buffer );
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/README.md
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/README.md b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/README.md
new file mode 100644
index 0000000..d425a28
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/README.md
@@ -0,0 +1,110 @@
+#Rest Test Framework (RTF)
+
+##What is it?
+It is a java framework that helps abstract some of the difficulty in working with the rest tier. Each endpoint is a different part of the builder pattern that ends with a request at the end. This request is sent to an embedded tomcat that has a usergrid war deployed on it. When the response comes back the RTF parses the response and allows the user to query information returned.
+
+##How does it work?
+It works by modeling the REST tier in Usergrid. We construct our query using usergrid endpoints that create our path and after it gets sent using POST/PUT/GET/DELETE.
+
+##Where is it
+All of the code is stored in resource. The older resource folder holds the old rest testing framework.
+
+##Requirements
+First you must have java 8 running on your machine. Then setup local instances of elasticsearch and cassandra on your box.
+
+##How do I use it?
+
+###For example...
+
+It helps to start out with an example. Let's deconstruct the following line step by step
+
+	clientSetup.getRestClient().management().orgs().post( payload );
+
+1. clientSetup
+
+	1. The clientSetup is what stores the context of the rest call. It also creates a new superuser/org/app/user and stores information specific to each one in the clientsetup. If you don't want to create a new org or app then you are free to call the getters in the clientSetup for the context of the current rest calls.
+
+2. getRestClient()
+
+	1. 	This returns our RestClient that handles the setup for our Jersey WebResource. In the RestClient class we handle the setup of the client and the configuration of the client.
+
+	2. It also stores the top level rest properties that can be called. This client starts by appending the serverUrl to the resource path.
+
+		1. The serverUrl for our rest tests is the localhost:port. These are both automatically assigned.
+
+	3. Next we have the option of calling any of the endpoint detailed in the RestClient.java. You'll see many options but the two most important are probably /management and /org which allow you to access a majority of usergrid endpoints.
+
+3. management()
+
+	1. This appends the "management" endpoint unto our path. Right now we have the following path "localhost:8080/management".
+
+	2. In the ManagementResource class you will find other endpoints that you can call. In this example we're calling ```orgs()```.
+
+4. orgs()
+
+	1. This appends "/organizations" to the path, so now we have "localhost:8080/management/organizations"
+
+	2. This sends us to OrganizationResource.java and will be the first instance where it will give you access to do a REST call.
+
+5. post( payload );
+
+	1. Here the organization class let's us know what endpoints we have available to us. In this case we want to post, but the individual classes will let you know what next steps are available.
+	2. So now we have a POST command against the locally embedded tomcat at the following endpoint "localhost:8080/management/organizations" and it will post the payload.
+	3. The payload is often a map object but specific types and return types will be covered later in the README.
+
+###ClientSetup
+####What does it do?
+It setups and stores a new organization/owner/application/superuser for each test. Since this happens at the beginning of each test we can call the ClientSetup class for information when we don't want/need to create our own organization/owner/application/superuser.
+
+####For Example...
+	String org = this.clientSetup.getOrganizationName();
+	String app = this.clientSetup.getAppName();
+
+    clientSetup.getRestClient().org(org).app(app).collection("cities").get();
+
+The above example is a call you could make in a rest test as soon as you start writing one. You don't have to create the org and application and you can just reference the ones already created for you.
+
+###RestClient
+####What does it do?
+Handles the setup for our Jersey WebResource. In the RestClient class we handle the configuration of the JerseyClient so we can send our rest calls against the tomcat. The rest client also contains the methods to call all of our top level classes. So from the RestClient we can call any of our top level endpoints.
+
+
+###AbstractRestIT
+
+####What does it do?
+This class handles a lot of the setup required by the testing functionality. It also stores helper methods central to each test and setup the tomcat that the tests will be querying. That is why it is extended by every test class.
+
+####What helper methods does it give me access to?
+Every single one of the test queries makes a call from the context ( because it needs access to the unique org and application ) to get the client. There are methods to make the tests look cleaner by automating the calls and getting the endpoint you want without writing
+
+	clientSetup.getRestClient()
+
+###Endpoints
+####What does it do?
+Holds the classes that contain the builder pattern. There are a lot of classes here currently so its easy to get lost. Following the RestClient through the hierarchy of the calls you want to run will give you the greatest insight into how they are organized.
+
+
+###Model
+This folder handles the data that gets returned from the api and the payloads that go into the api.
+
+####For Example...
+
+To create an organization we can create a model object for the specific kind of entity we want to post.
+
+	Organization payload = new Organization( String orgName, String username, String email, String ownerName, String password, Map<String,Object> properties );
+
+Now that we have an organization payload, we can POST to create the organization.
+
+	Organization org = clientSetup.getRestClient().management().orgs().post( payload );
+
+This in turn creates an Organization object we've called ```org``` that is intialized with the POST response. This gives us easy access to the organization information to verify that it was indeed created correctly.
+
+
+For a more in-depth explanation for how they work look at the readme in the model folder (Work-In-Progress).
+
+
+
+<!-- The below needs to be refactored into a different readme just for the model class.
+
+####How does the RET model responses?
+We model responses by serializing the response into its respective model class. At the lowest level we use a ApiResponse. The ApiResponse contains fields for every kind of response we could recieve from the api. If there is any doubt about what class you need to return or push the response in you should use the ApiResponse. From the ApiResponse we model -->

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RestClient.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RestClient.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RestClient.java
new file mode 100644
index 0000000..30e008c
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RestClient.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import org.apache.usergrid.rest.test.resource.endpoints.*;
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+
+/**
+ * This REST client was made to be able to send calls to any backend system that accepts calls. To do this It needs to
+ * work independently of the existing REST test framework.
+ */
+public class RestClient implements UrlResource {
+
+    private final String serverUrl;
+    private ClientContext context;
+
+    public WebResource resource;
+    ClientConfig config = new DefaultClientConfig();
+    Client client = Client.create( config );
+
+    /**
+     *
+     * @param serverUrl
+     */
+    public RestClient( final String serverUrl ) {
+        this.serverUrl = serverUrl;
+        this.context = new ClientContext();
+        resource = client.resource( serverUrl );
+        resource.path( serverUrl );
+    }
+
+
+    /**
+     * TODO: should this method return the base path or the total path we have built?
+     */
+    @Override
+    public String getPath() {
+        return resource.getURI().toString();
+    }
+
+    @Override
+    public WebResource getResource() {
+        return client.resource( serverUrl );
+    }
+
+    public ClientContext getContext() {
+        return context;
+    }
+
+    public SystemResource system() {
+        return new SystemResource(context, this);
+    }
+
+    public TestPropertiesResource testPropertiesResource() {
+        return new TestPropertiesResource( context, this );
+    }
+    /**
+     * Get the management resource
+     */
+    public ManagementResource management() {
+        return new ManagementResource( context, this );
+    }
+
+
+    /**
+     * Get hte organization resource
+     */
+    public OrganizationResource org( final String orgName ) {
+        return new OrganizationResource( orgName, context, this );
+    }
+
+    public TokenResource token(){
+        return new TokenResource(context,this);
+    }
+    public void refreshIndex(String orgname, String appName, String appid) {
+        //TODO: add error checking and logging
+        this.getResource().path( "/refreshindex" )
+                .queryParam( "org_name", orgname )
+                .queryParam( "app_name",appName )
+                .queryParam("app_id", appid)
+            .accept( MediaType.APPLICATION_JSON ).post();
+    }
+
+    public NamedResource pathResource(String path){
+        return new NamedResource(path,context,this);
+    }
+
+    public void superuserSetup() {
+        //TODO: change this when we upgrade to new version of jersey
+        HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
+        client.addFilter( httpBasicAuthFilter );
+
+        this.getResource().path( "system/superuser/setup" )
+            .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON ).get( JsonNode.class );
+        client.removeFilter( httpBasicAuthFilter );
+    }
+
+    //todo:fix this method for the client.
+//    public void loginAdminUser( final String username, final String password ) {
+//        //Post isn't implemented yet, but using the method below we should be able to get a superuser password as well.
+//        //final String token = management().token().post(username, password);
+//
+//        //context.setToken( token );
+//    }
+
+//
+//    public void createOrgandOwner
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RootResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RootResource.java
deleted file mode 100644
index 7307939..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/RootResource.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/** @author tnine */
-public class RootResource extends NamedResource {
-
-    private WebResource resource;
-    private String token;
-
-
-    /**
-     * @param parent
-     */
-    public RootResource( WebResource resource, String token ) {
-        super( null );
-        this.resource = resource;
-        this.token = token;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.resource.NamedResource#resource()
-     */
-    @Override
-    protected WebResource resource() {
-        return this.resource;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.resource.NamedResource#token()
-     */
-    @Override
-    protected String token() {
-        return this.token;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.resource.NamedResource#addToUrl(java.lang.StringBuilder)
-     */
-    @Override
-    public void addToUrl( StringBuilder buffer ) {
-        //do nothing on purpose, callers will append "/" for the root
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/SetResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/SetResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/SetResource.java
deleted file mode 100644
index 452be3e..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/SetResource.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-
-
-/** @author tnine */
-public abstract class SetResource extends ValueResource {
-
-    public SetResource( String name, NamedResource parent ) {
-        super( name, parent );
-    }
-
-
-    /** Get an entity resource by name */
-    public EntityResource entity( String name ) {
-        return new EntityResource( name, this );
-    }
-
-
-    /** Get an entity resource by Id */
-    public EntityResource entity( UUID id ) {
-        return new EntityResource( id, this );
-    }
-
-
-    /**
-     * Get this resource with additional matrix parameters
-     * @param params
-     * @return
-     */
-    public MatrixResource withMatrix(Map<String, String> params){
-        //once we want matrix params, we have to discard this current node in the chain, we need to construct
-        //a special node to handle it
-        return MatrixResource.build(this.getName(), params, this.getParent());
-    }
-
-
-    public int countEntities( String query ) {
-
-        int totalEntitiesContained = 0;
-        JsonNode correctNode =
-                this.withQuery( query ).withLimit( 1000 ).get();//this.withQuery(query).get();//this.query
-   
-    /*change code to reflect the above */
-        //this.withQuery().withCursor()
-        while ( correctNode.get( "entities" ) != null ) {
-            totalEntitiesContained += correctNode.get( "entities" ).size();
-            if ( correctNode.get( "cursor" ) != null )
-            //correctNode = this.query(query,"cursor",correctNode.get("cursor").toString());
-            {
-                correctNode = this.withQuery( query ).withCursor( correctNode.get( "cursor" ).toString() ).get();
-            }
-            else {
-                break;
-            }
-        }
-        return totalEntitiesContained;
-    }
-
-  /*cut out the key variable argument and move it into the customcollection call
-  then just have it automatically add in the variable. */
-
-
-    public JsonNode[] createEntitiesWithOrdinal( Map valueHolder, int numOfValues ) throws IOException {
-
-        JsonNode[] node = new JsonNode[numOfValues];
-
-        for ( int i = 0; i < numOfValues; i++ ) {
-            valueHolder.put( "Ordinal", i );
-            node[i] = this.create( valueHolder );
-        }
-
-        return node;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
deleted file mode 100644
index 814dd35..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.app.Application;
-import org.apache.usergrid.rest.test.resource.app.Collection;
-import org.apache.usergrid.rest.test.resource.app.User;
-import org.apache.usergrid.rest.test.resource.app.UsersCollection;
-import org.apache.usergrid.rest.test.resource.app.Group;
-import org.apache.usergrid.rest.test.resource.app.GroupsCollection;
-import org.apache.usergrid.rest.test.resource.app.Role;
-import org.apache.usergrid.rest.test.resource.app.RolesCollection;
-import org.apache.usergrid.rest.test.resource.mgmt.Management;
-import org.apache.usergrid.rest.test.security.TestUser;
-
-import com.sun.jersey.test.framework.JerseyTest;
-import java.io.IOException;
-import javax.ws.rs.core.MediaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class TestContext {
-
-    private static final Logger logger = LoggerFactory.getLogger( TestContext.class );
-
-    private JerseyTest test;
-    private TestUser activeUser;
-    private TestOrganization testOrganization;
-    private String appName;
-    private UUID appUuid;
-
-
-    /**
-     *
-     */
-    protected TestContext( JerseyTest test ) {
-        this.test = test;
-    }
-
-
-    /** Create a test context */
-    public static TestContext create( JerseyTest test ) {
-        return new TestContext( test );
-    }
-
-
-    public TestUser getActiveUser() {
-        return activeUser;
-    }
-
-
-    public TestContext withUser( TestUser user ) {
-        this.activeUser = user;
-        return this;
-    }
-
-
-    public TestContext clearUser() {
-        return withUser( null );
-    }
-
-    public TestContext withOrg(){
-        return this;
-    }
-
-    public TestContext withOrg( String orgName ) {
-        testOrganization = new TestOrganization( orgName );
-        return this;
-    }
-
-    public TestContext withApp ( ) {
-        return this;
-    }
-
-    public TestContext withApp( String appName ) {
-        this.appName = appName;
-        return this;
-    }
-
-
-    public String getOrgName() {
-        return testOrganization.getOrgName();
-    }
-
-
-    public String getAppName() {
-        return appName;
-    }
-
-
-    /** Creates the org specified */
-    public TestContext createNewOrgAndUser() throws IOException {
-        OrgUserUUIDWrapper ouuw = management().orgs().create( getOrgName(),activeUser );
-        testOrganization.setUuid( ouuw.getOrgUUID() );
-        activeUser.setUUID( ouuw.getUserUUID() );
-        refreshIndex(getOrgName(), appName);
-        return this;
-    }
-
-
-    /** Creates the org specified */
-    public TestContext createAppForOrg() throws IOException {
-        appUuid = management().orgs().organization( getOrgName() ).apps().create( appName );
-        refreshIndex( getOrgName(), appName );
-        return this;
-    }
-
-
-    /** Create the app if it doesn't exist with the given TestUser. 
-     * If the app exists, the user is logged in */
-    public TestContext loginUser() {
-        // nothing to do
-        if ( activeUser.isLoggedIn() ) {
-            return this;
-        }
-
-        // try to log in the user first
-        activeUser.login( this );
-
-        return this;
-    }
-
-
-    /** Get the users resource for the application */
-    public UsersCollection users() {
-        return application().users();
-    }
-
-    /** Get the app user resource */
-    public User user( String username ) {
-        return application().users().user(username);
-    }
-
-
-    /** Get the users resource for the application */
-    public GroupsCollection groups() {
-        return application().groups();
-    }
-
-    /** Get the app group resource */
-    public Group group( String path ) {
-        return application().groups().group( path );
-    }
-
-
-    /** Get the groups resource for the application */
-    public RolesCollection roles() {
-        return application().roles();
-    }
-
-    /** Get the app role resource */
-    public Role role( String name ) {
-        return application().roles().role( name );
-    }
-
-
-    /** @return the orgUuid */
-    public UUID getOrgUuid() {
-        return testOrganization.getUuid();
-    }
-
-
-    /** @return the appUuid */
-    public UUID getAppUuid() {
-        return appUuid;
-    }
-
-
-    /** Get the application resource */
-    public Application application() {
-        return new Application( getOrgName(), appName, root() );
-    }
-
-//TODO: remove custom collections!
-    public CustomCollection customCollection( String str ) {
-        return application().customCollection( str );
-    }
-
-    public Collection collection (String name) {
-        return application().collection( name );
-    }
-
-
-    public Management management() {
-        return new Management( root() );
-    }
-
-
-    protected RootResource root() {
-        return new RootResource( test.resource(), activeUser == null ? null : activeUser.getToken() );
-    }
-
-
-    /** Calls createNewOrgAndUser, logs in the user, then creates the app. All in 1 call. */
-    public TestContext initAll() throws IOException {
-        return createNewOrgAndUser().loginUser().createAppForOrg();
-    }
-
-    public void refreshIndex() {
-
-        logger.debug("Refreshing index for app {}/{}", testOrganization.getOrgName(), appName );
-
-        try {
-
-            root().resource().path( "/refreshindex" )
-                  .queryParam( "org_name", testOrganization.getOrgName() )
-                  .queryParam( "app_name", appName )
-                  .accept( MediaType.APPLICATION_JSON )
-                  .post();
-
-        } catch ( Exception e) {
-            logger.debug("Error refreshing index", e);
-            return;
-        }
-
-        logger.debug("Refreshed index for app {}/{}", testOrganization.getOrgName(), appName );
-    }
-
-    private void refreshIndex(String orgName, String appName) {
-
-        logger.debug("Refreshing index for app {}/{}", orgName, appName );
-
-        try {
-
-            root().resource().path( "/refreshindex" )
-                .queryParam( "org_name", orgName )
-                .queryParam( "app_name", appName )
-                .accept( MediaType.APPLICATION_JSON )
-                .post();
-                    
-        } catch ( Exception e) {
-            logger.debug("Error refreshing index", e);
-            return;
-        }
-
-        logger.debug("Refreshed index for app {}/{}", orgName, appName );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestOrganization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestOrganization.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestOrganization.java
deleted file mode 100644
index 99a05ed..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestOrganization.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.UUID;
-
-
-/**
- * Wrapper class that contains all the resources needed by a organization
- */
-public class TestOrganization {
-    private String orgName;
-    private UUID uuid;
-
-    //test organizations are always initialized by name, and the uuid will be set on creations
-    public TestOrganization( final String orgName) {
-        this.orgName = orgName;
-    }
-
-    public UUID getUuid() {
-        return uuid;
-    }
-
-
-    public void setUuid( final UUID uuid ) {
-        this.uuid = uuid;
-    }
-
-
-    public String getOrgName() {
-
-        return orgName;
-    }
-
-
-    public void setOrgName( final String orgName ) {
-        this.orgName = orgName;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestPropertiesResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestPropertiesResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestPropertiesResource.java
new file mode 100644
index 0000000..ad08d94
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestPropertiesResource.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.endpoints.NamedResource;
+import org.apache.usergrid.rest.test.resource.endpoints.UrlResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ *Adds support for changing the management properties in the rest testing framework.
+ */
+public class TestPropertiesResource extends NamedResource {
+    public TestPropertiesResource( final ClientContext context, final UrlResource parent ) {
+        super( "testproperties", context, parent );
+    }
+
+    public ApiResponse post(Entity testProperties){
+
+        return getResource(true).type( MediaType.APPLICATION_JSON_TYPE )
+                            .accept( MediaType.APPLICATION_JSON ).post( ApiResponse.class, testProperties );
+    }
+
+    public ApiResponse get(){
+        return getResource(true).type( MediaType.APPLICATION_JSON_TYPE )
+                       .accept( MediaType.APPLICATION_JSON ).get(ApiResponse.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
deleted file mode 100644
index 8649bed..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import com.sun.jersey.api.client.WebResource;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/** @author tnine */
-public abstract class ValueResource extends NamedResource {
-
-    private static final Logger logger = LoggerFactory.getLogger( ValueResource.class );
-    
-    private String name;
-    private String query;
-    private String cursor;
-    private Integer limit;
-    private UUID start;
-
-    private Map<String, String> customParams;
-
-
-    public ValueResource( String name, NamedResource parent ) {
-        super( parent );
-        this.name = name;
-    }
-
-
-    public String getName() {
-        return name;
-    }
-
-
-
-
-
-    /*
-         * (non-Javadoc)
-         *
-         * @see
-         * org.apache.usergrid.rest.resource.NamedResource#addToUrl(java.lang.StringBuilder)
-         */
-    @Override
-    public void addToUrl( StringBuilder buffer ) {
-        parent.addToUrl( buffer );
-
-        buffer.append( SLASH );
-
-        buffer.append( name );
-    }
-
-
-    public void addToUrlEnd( StringBuilder buffer ) {
-        buffer.append( SLASH );
-        buffer.append( buffer );
-    }
-
-
-    /** Create a new entity with the specified data */
-    public JsonNode create( Map<String, ?> entity ) throws IOException {
-        return postInternal( entity );
-    }
-
-
-    public JsonNode delete() throws IOException {
-        return deleteInternal();
-    }
-
-
-    /** post to the entity set */
-    //TODO: fix error reporting
-    protected JsonNode postInternal( Map<String, ?> entity ) throws IOException {
-
-        return mapper.readTree( jsonMedia( withParams( withToken( resource() ) ) ).post( String.class, entity ));
-    }
-
-
-    /** post to the entity set */
-    protected JsonNode postInternal( Map<String, ?>[] entity ) throws IOException {
-
-        return mapper.readTree( jsonMedia( withParams( withToken( resource() ) ) ).post( String.class, entity ));
-    }
-
-
-    public JsonNode put( Map<String, ?> entity ) throws IOException {
-
-        return putInternal( entity );
-    }
-
-
-    /** put to the entity set */
-    protected JsonNode putInternal( Map<String, ?> entity ) throws IOException {
-
-        return mapper.readTree( jsonMedia( withParams( withToken( resource() ) ) ).put( String.class, entity ));
-    }
-
-
-    /** Get the data */
-    public JsonNode get() {
-        try {
-            return getInternal();
-        } catch (IOException ex) {
-            throw new RuntimeException("Cannot parse JSON data", ex);
-        }
-    }
-
-
-
-    @SuppressWarnings("unchecked")
-    public <T extends ValueResource> T withCursor( String cursor ) {
-        this.cursor = cursor;
-        return ( T ) this;
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public <T extends ValueResource> T withQuery( String query ) {
-        this.query = query;
-        return ( T ) this;
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public <T extends ValueResource> T withStart( UUID start ) {
-        this.start = start;
-        return ( T ) this;
-    }
-
-
-    @SuppressWarnings("unchecked")
-    public <T extends ValueResource> T withLimit( Integer limit ) {
-        this.limit = limit;
-        return ( T ) this;
-    }
-
-
-    /** Query this resource. */
-
-    @SuppressWarnings("unchecked")
-    public <T extends ValueResource> T withParam( String name, String value ) {
-        if ( customParams == null ) {
-            customParams = new HashMap<String, String>();
-        }
-
-        customParams.put( name, value );
-
-        return ( T ) this;
-    }
-
-
-    @Override
-    protected WebResource withParams( final WebResource resource ) {
-        WebResource withParams = super.withParams( resource );
-
-        if(customParams == null){
-            return withParams;
-        }
-
-        for(Entry<String, String> param : customParams.entrySet()){
-            withParams = withParams.queryParam( param.getKey(), param.getValue());
-        }
-
-        return withParams;
-    }
-
-
-    /** Get entities in this collection. Cursor is optional */
-    protected JsonNode getInternal() throws IOException {
-
-
-        WebResource resource = withParams( withToken( resource() ) );
-
-
-        if ( query != null ) {
-            resource = resource.queryParam( "ql", query );
-        }
-
-        if ( cursor != null ) {
-            resource = resource.queryParam( "cursor", cursor );
-        }
-
-        if ( start != null ) {
-            resource = resource.queryParam( "start", start.toString() );
-        }
-
-        if ( limit != null ) {
-            resource = resource.queryParam( "limit", limit.toString() );
-        }
-
-        String json = jsonMedia( resource ).get( String.class );
-        //logger.debug(json);
-        return mapper.readTree( json );
-    }
-
-
-    //TODO: make query a chaining command, not just an immediate get.
-    public JsonNode query( String query, String addition, String numAddition ) throws IOException {
-        return getInternal( query, addition, numAddition );
-    }
-
-
-    protected JsonNode getInternal( String query, String addition, String numAddition ) throws IOException {
-        WebResource resource = withParams( withToken( resource() ) ).queryParam( "ql", query );
-
-        if ( addition != null ) {
-            resource = resource.queryParam( addition, numAddition );
-        }
-
-
-        if ( customParams != null ) {
-            for ( Entry<String, String> param : customParams.entrySet() ) {
-                resource = resource.queryParam( param.getKey(), param.getValue() );
-            }
-        }
-
-        return mapper.readTree( jsonMedia( resource ).get( String.class ));
-    }
-
-
-    public int verificationOfQueryResults( JsonNode[] correctValues, boolean reverse, String checkedQuery )
-            throws Exception {
-
-        int totalEntitiesContained = 0;
-
-        JsonNode checkedNodes = this.withQuery( checkedQuery ).withLimit( correctValues.length ).get();
-
-        while ( correctValues.length != totalEntitiesContained )//correctNode.get("entities") != null)
-        {
-            totalEntitiesContained += checkedNodes.get( "entities" ).size();
-            if ( !reverse ) {
-                for ( int index = 0; index < checkedNodes.get( "entities" ).size(); index++ ) {
-                    assertEquals( correctValues[index].get( "entities" ).get( 0 ),
-                            checkedNodes.get( "entities" ).get( index ) );
-                }
-            }
-            else {
-                for ( int index = 0; index < checkedNodes.get( "entities" ).size(); index++ ) {
-                    assertEquals( correctValues[correctValues.length - 1 - index].get( "entities" ).get( 0 ),
-                            checkedNodes.get( "entities" ).get( index ) );
-                }
-            }
-
-
-            // works because this method checks to make sure both queries return the same thing
-            // therefore this if shouldn't be needed, but added just in case
-            if ( checkedNodes.get( "cursor" ) != null ) {
-                checkedNodes = this.query( checkedQuery, "cursor", checkedNodes.get( "cursor" ).toString() );
-            }
-
-            else {
-                break;
-            }
-        }
-        return totalEntitiesContained;
-    }
-
-
-    public JsonNode entityValue( String query, String valueToSearch, int index ) {
-        JsonNode node = this.withQuery( query ).get();
-        return node.get( "entities" ).get( index ).findValue( valueToSearch );
-    }
-
-
-    public JsonNode entityIndex( String query, int index ) {
-
-        JsonNode node = this.withQuery( query ).get();
-        return node.get( "entities" ).get( index );
-    }
-
-
-    public JsonNode entityIndexLimit( String query, Integer limitSize, int index ) {
-
-        JsonNode node = this.withQuery( query ).withLimit( limitSize ).get();
-        return node.get( "entities" ).get( index );
-    }
-
-
-    /** Get entities in this collection. Cursor is optional */
-    protected JsonNode deleteInternal() throws IOException {
-
-
-        WebResource resource = withParams( withToken( resource() ) );
-
-        if ( query != null ) {
-            resource = resource.queryParam( "ql", query );
-        }
-
-        if ( cursor != null ) {
-            resource = resource.queryParam( "cursor", cursor );
-        }
-
-        if ( start != null ) {
-            resource = resource.queryParam( "start", start.toString() );
-        }
-
-        if ( limit != null ) {
-            resource = resource.queryParam( "limit", limit.toString() );
-        }
-
-        return mapper.readTree( jsonMedia( resource ).delete( String.class ));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
deleted file mode 100644
index 79e24fd..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import javax.ws.rs.core.MediaType;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CustomCollection;
-import org.apache.usergrid.rest.test.resource.RootResource;
-import org.apache.usergrid.rest.test.resource.ValueResource;
-import org.apache.usergrid.rest.test.resource.app.queue.DevicesCollection;
-import org.apache.usergrid.rest.test.resource.app.queue.QueuesCollection;
-
-
-/** @author tnine */
-public class Application extends ValueResource {
-
-
-    /**
-     * @param parent
-     */
-    public Application( String orgName, String appName, RootResource root ) {
-        super( orgName + SLASH + appName, root );
-    }
-
-
-    /** Get the token from management for this username and password */
-    public String token( String username, String password ) throws IOException {
-
-        String url = String.format( "%s/token", url() );
-
-        JsonNode node = mapper.readTree( resource().path( url ).queryParam( "grant_type", "password" ).queryParam( "username", username )
-                .queryParam( "password", password ).accept( MediaType.APPLICATION_JSON )
-                .type( MediaType.APPLICATION_JSON_TYPE ).get( String.class ));
-
-        return node.get( "access_token" ).asText();
-    }
-
-
-    public UsersCollection users() {
-        return new UsersCollection( this );
-    }
-
-    public GroupsCollection groups() {
-        return new GroupsCollection( this );
-    }
-
-    public RolesCollection roles() {
-        return new RolesCollection( this );
-    }
-
-
-    public QueuesCollection queues() {
-        return new QueuesCollection( this );
-    }
-
-
-    public DevicesCollection devices() {
-        return new DevicesCollection( this );
-    }
-
-//TODO: work out differences between CustomCollections and replace tests with a general collection method.
-    public CustomCollection customCollection( String name ) {
-        return new CustomCollection( name, this );
-    }
-
-    public Collection collection( String name ) {
-        return new Collection( name,this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
deleted file mode 100644
index 9101464..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource.app;
-
-import java.io.IOException;
-import java.util.Map;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.SetResource;
-import org.apache.usergrid.utils.MapUtils;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-
-//TODO: G make sure this no longer returns JsonNodes and instead returns EntityObjects.
-//TODO: Add in full rest suite of GET,PUT,DELETE methods. Delete will be mostly universal.
-public class Collection extends SetResource {
-
-    public Collection( String collectionName, NamedResource parent ) {
-        super( collectionName, parent );
-    }
-
-    /** Create the user in a collection using only the username */
-    /**
-     * POST an entity with only a name
-     * @param name
-     * @return JsonNode
-     * @throws IOException
-     */
-    public JsonNode post( String name ) throws IOException {
-        Map<String, String> data = MapUtils.hashMap( "name", name );
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-    /**
-     * POST an entity with a name and a Map (e.g. if you want to add in a location sub-object
-     * @param name
-     * @param entityData
-     * @return JsonNode
-     * @throws IOException
-     */
-    public JsonNode post( String name, Map entityData ) throws IOException {
-        Map<String, String> data = MapUtils.hashMap( "name", name );
-        data.putAll(entityData);
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-    /**
-     * POST an entity with only a Map
-     * @param entityData
-     * @return JsonNode
-     * @throws IOException
-     */
-    public JsonNode post(Map entityData) throws IOException{
-
-        JsonNode response = this.postInternal( entityData );
-
-        return getEntity( response, 0 );
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Device.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Device.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Device.java
deleted file mode 100644
index 917ce36..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Device.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class Device extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public Device( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public Device( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Group.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Group.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Group.java
deleted file mode 100644
index 4446bf6..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Group.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.app.queue.DevicesCollection;
-
-
-/**
- * A resource for testing queues
- *
- * @author rockerston
- */
-public class Group
-        extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public Group( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public Group( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-
-
-    public DevicesCollection devices() {
-        return new DevicesCollection( this );
-    }
-}


[4/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Collection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Collection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Collection.java
new file mode 100644
index 0000000..aba05a1
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Collection.java
@@ -0,0 +1,98 @@
+/**
+ * Created by ApigeeCorporation on 12/4/14.
+ */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * A stateful iterable collection response. Used to dole out entities in iterable form
+ *
+ */
+public class Collection implements Iterable<Entity>, Iterator<Entity> {
+
+
+    private String cursor;
+
+    private Iterator entities;
+
+    private ApiResponse response;
+
+    //TODO: implement way to have the collection store its own name?
+    private String name;
+
+
+
+    /**
+     * Collection usersCollection =  app.collection("users").get();
+     * while(usersCollection.hasNext()){
+     *  Entity bob = usersCollection.next();
+     *     assert("blah",bob.get("words"));
+     * }
+     * QueryParams = new QueryParams(usersCollection.cursor)
+     * app.collections("users").get(queryParams);
+     *
+     * usersCollection = app.collections("users").getNextPage(usersCollection.cursor);
+     *
+     * Use the factory method instead
+     * @param response
+     */
+    public Collection(ApiResponse response) {
+        this.response = response;
+        this.cursor = response.getCursor();
+        this.entities = response.getEntities()!=null?  response.getEntities().iterator():null;
+    }
+
+    @Override
+    public Iterator iterator() {
+        return this;
+    }
+
+
+    @Override
+    public boolean hasNext() {
+        return entities.hasNext();
+    }
+
+    public String getCursor(){
+        return cursor;
+    }
+
+
+    @Override
+    public Entity next() {
+        return new Entity( ( Map<String, Object> ) entities.next() );
+    }
+
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException( "Remove is unsupported" );
+    }
+
+    public int getNumOfEntities(){
+        return response.getEntityCount();
+    }
+
+    public ApiResponse getResponse(){return response;}
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Credentials.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Credentials.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Credentials.java
new file mode 100644
index 0000000..0a71ae9
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Credentials.java
@@ -0,0 +1,47 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import java.util.Map;
+
+/**
+ */
+public class Credentials extends Entity {
+    public Credentials() {
+    }
+
+    public Credentials(ApiResponse response) {
+        setResponse(response, "credentials");
+    }
+
+    public Credentials mapOrgResponse(Map<String, Object> map) {
+        putAll((Map<String, Object>) map.get("credentials"));
+        return this;
+    }
+
+    public String getClientSecret() {
+        return (String) get("client_secret");
+    }
+
+    public String getClientId() {
+        return (String) get("client_id");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Entity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Entity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Entity.java
new file mode 100644
index 0000000..3707967
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Entity.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import java.io.Serializable;
+import java.util.*;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+import static org.apache.usergrid.persistence.Schema.PROPERTY_NAME;
+
+
+/**
+ * Contains a model that can be deconstructed from the api response. This is a base level value that contains the bare
+ * minumum of what other classes use. Such as . users or groups.
+ */
+public class Entity implements Serializable, Map<String,Object> {
+
+
+    protected Map<String, Object> dynamic_properties = new TreeMap<String, Object>( String.CASE_INSENSITIVE_ORDER );
+
+    ApiResponse response;
+
+    public Entity(){}
+
+    public Entity (Map<String,Object> payload){
+        this.putAll(payload);
+    }
+
+    public Entity(ApiResponse response){
+        this.response = response;
+
+        if(response.getEntities() != null &&  response.getEntities().size()>=1){
+            List<Entity>  entities =  response.getEntities();
+            Map<String,Object> entity = entities.get(0);
+            this.putAll(entity);
+        }
+        else if (response.getData() != null){
+
+            if(response.getData() instanceof  LinkedHashMap) {
+                LinkedHashMap dataResponse = ( LinkedHashMap ) response.getData();
+
+                if(dataResponse.get( "user" )!=null){
+                    this.putAll( ( Map<? extends String, ?> ) dataResponse.get( "user" ) );
+                }
+                else{
+                    this.putAll( dataResponse );
+                }
+            }
+            else if (response.getData() instanceof ArrayList){
+                ArrayList<String> data = ( ArrayList<String> ) response.getData();
+                Entity entity = new Entity();
+                entity.put( "data", data.get( 0 ) );
+                this.putAll( entity );
+            }
+        }
+        //TODO: added bit for import tests and other tests that only put a single thing into properties
+        else if (response.getProperties() != null){
+            this.putAll( response.getProperties() );
+        }
+    }
+
+    //For the owner , should have different cases that looks at the different types it could be
+    protected Entity setResponse(final ApiResponse response, String key) {
+        LinkedHashMap linkedHashMap = (LinkedHashMap) response.getData();
+
+        if(linkedHashMap == null){
+            linkedHashMap =  new LinkedHashMap( response.getProperties());
+        }
+
+        this.putAll((Map<? extends String, ?>) linkedHashMap.get(key));
+
+        return this;
+    }
+
+    public void setProperties( Map<String, Object> properties ) {
+        putAll( properties );
+    }
+
+    public Map<String, Object> getDynamicProperties() {
+        return dynamic_properties;
+    }
+
+    @Override
+    public int size() {
+        return getDynamicProperties().size();
+    }
+
+
+    @Override
+    public boolean isEmpty() {
+        return getDynamicProperties().isEmpty();
+    }
+
+
+    @Override
+    public boolean containsKey( final Object key ) {
+        return getDynamicProperties().containsKey( key );
+    }
+
+
+    @Override
+    public boolean containsValue( final Object value ) {
+        return getDynamicProperties().containsValue( value );
+    }
+
+
+    @Override
+    public Object get( final Object key ) {
+        //All values are strings , so doing the cast here saves doing the cast elsewhere
+        return getDynamicProperties().get( key );
+    }
+
+
+    public Map<String, Map<String, Object>> getMap(Object key){
+        return (LinkedHashMap<String, Map<String, Object>>) getDynamicProperties().get( key );
+    }
+
+    public String getAsString( final Object key ) {
+        //All values are strings , so doing the cast here saves doing the cast elsewhere
+        return (String) getDynamicProperties().get( key );
+    }
+
+    public String getError () {
+        return (String) this.get("error");
+    }
+
+    public String getErrorCode () {
+        return (String)this.get("errorCode");
+    }
+
+    public String getErrorDescription () {
+        return (String) this.get("errorDescription");
+    }
+
+    @Override
+    public Object put( final String key, final Object value ) {
+        return getDynamicProperties().put( key,value );
+    }
+
+
+    @Override
+    public Object remove( final Object key ) {
+        return getDynamicProperties().remove( key );
+    }
+
+
+    @Override
+    public void putAll( final Map<? extends String, ?> m ) {
+        getDynamicProperties().putAll( m );
+    }
+
+
+    @Override
+    public void clear() {
+        getDynamicProperties().clear();
+    }
+
+
+    @Override
+    public Set<String> keySet() {
+        return getDynamicProperties().keySet();
+    }
+
+
+    @Override
+    public java.util.Collection<Object> values() {
+        return getDynamicProperties().values();
+    }
+
+
+    @Override
+    public Set<Entry<String, Object>> entrySet() {
+        return getDynamicProperties().entrySet();
+    }
+
+    public UUID getUuid(){
+        return UUID.fromString( ( String ) get( "uuid" ) );
+    }
+
+    public Entity chainPut(final String key, final Object value){
+        put(key,value);
+        return this;
+    }
+
+    public Entity withProp(final String key, final Object value){
+        put(key,value);
+        return this;
+    }
+
+    public ApiResponse getResponse(){
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Organization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Organization.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Organization.java
new file mode 100644
index 0000000..04709a5
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Organization.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+
+/**
+ * Holds the parsed out information of the Organization returned from the ApiResponse.
+ * so when you get the organization object, we could then model it out to do the client calls
+ */
+public class Organization extends Entity {
+
+    private User user;
+
+    public Organization() {
+
+    }
+
+    public Organization( String orgName, String username, String email, String ownerName, String password, Map<String,Object> properties ){
+
+        this.put( "organization", orgName );
+        this.put( "username", username);
+        this.put( "email", email);
+        //TODO: create clearer distinction between ownerName and username in the backend.
+        this.put( "name", ownerName);
+        this.put( "password", password);
+
+        if(properties != null)
+            setProperties( properties );
+    }
+
+    public Organization(ApiResponse response){
+        setResponse( response, "organization" );
+    }
+
+    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
+    public String getOrganization( ) {
+        return ( String ) this.get( "organization" );
+    }
+
+    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
+    public String getUsername() {
+        return ( String ) this.get( "username" );
+    }
+
+    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
+    public String getEmail() {
+        return ( String ) this.get( "email" );
+    }
+
+    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
+    public String getName() {
+        return ( String ) this.get( "name" );
+    }
+
+    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
+    public String getPassword() {
+        return ( String ) this.get( "password" );
+    }
+
+    public Object getPasswordHistorySize() {
+        return  (Integer) this.get("passwordHistorySize");
+    }
+
+    public User getOwner(){
+        return user;
+    }
+
+    public void setOwner(ApiResponse response){
+        setOwner( response, "owner" );
+    }
+
+    public void setOwner(ApiResponse response, String nameOverride){
+        this.user = new User( response, nameOverride);
+    }
+
+    public Map<String,Object> getProperties(){
+        return (Map) this.get( "properties" );
+    }
+
+    /**
+     * Created specifically so that we could set the organization owner to the Organization model from a get Organization
+     * call. This call is hidden a few layers below and stored in the properties.
+     * @param response
+     */
+    public void setUserOwner(ApiResponse response){
+        LinkedHashMap orgHashMap = ( LinkedHashMap ) response.getProperties().get( "organization" );
+        LinkedHashMap userHashMap = (LinkedHashMap) orgHashMap.get( "users" );
+        //this gets the first value in the users entities and returns it .
+        if(userHashMap.keySet().iterator().hasNext())
+            this.user = new User( ( Map<String, Object> ) userHashMap.get( userHashMap.keySet().iterator().next() ) );
+        //new User().mapOrgGetResponse(orgHashMap.get( "users" ));
+    }
+
+    public Organization mapOrgResponse(Map<String,Object> map){
+        putAll((Map<String, Object>) map.get("organization"));
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/QueryParameters.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/QueryParameters.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/QueryParameters.java
new file mode 100644
index 0000000..5717ffd
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/QueryParameters.java
@@ -0,0 +1,93 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.usergrid.services.ServiceParameter;
+
+
+/**
+ * Classy class class.
+ */
+public class QueryParameters {
+    private String query;
+    private String cursor;
+    private UUID start;
+    private Integer limit;
+    private Map<String,String> formPostData = new HashMap<String,String>(  );
+
+    public QueryParameters() {
+    }
+
+    public UUID getStart() {
+        return start;
+    }
+
+    public QueryParameters setStart(UUID start) {
+        this.start = start;
+        return this;
+    }
+
+    public String getCursor() {
+        return cursor;
+    }
+
+    public QueryParameters setCursor(String cursor) {
+        this.cursor = cursor;
+        return this;
+    }
+
+    public String getQuery() {
+        return query;
+    }
+
+    public QueryParameters setQuery(String query) {
+        this.query = query;
+        return this;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public QueryParameters setLimit(int limit) {
+        this.limit = new Integer(limit);
+        return this;
+    }
+
+    public Map<String,String> getFormPostData(){
+        return formPostData;
+    }
+
+    public QueryParameters setKeyValue(String key, String value){
+        this.formPostData.put(key,value);
+        return this;
+    }
+
+
+    public QueryParameters addParam(String key, String value) {
+        formPostData.put(key,value);
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Token.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Token.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Token.java
new file mode 100644
index 0000000..92b91ee
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/Token.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.model;
+
+
+import java.util.LinkedHashMap;
+
+/**
+ * Token model that contains the operations that can be done on a token.
+ */
+public class Token extends Entity {
+
+    private User user;
+
+    public Token() {
+
+    }
+
+    public Token(String username, String password) {
+        this.put("grant_type", "password");
+        this.put("username", username);
+        this.put("password", password);
+    }
+
+    /**
+     * Constructor for admin/application user ( difference is in the path )
+     *
+     * @param grantType
+     * @param username
+     * @param password
+     */
+    public Token(String grantType, String username, String password) {
+        this.put("grant_type", grantType);
+        if ("client_credentials".equals(grantType)) {
+            this.put("client_id", username);
+            this.put("client_secret", password);
+        } else {
+            this.put("username", username);
+            this.put("password", password);
+        }
+    }
+
+    public String getAccessToken() {
+        return (String) this.get("access_token");
+    }
+
+    public String getGrantType() {
+        return (String) this.get("grant_type");
+    }
+
+    public Long getExpirationDate() {
+        return ((Integer) this.get("expires_in")).longValue();
+    }
+
+    public Long getPasswordChanged() {
+        return (Long) this.get("passwordChanged");
+    }
+
+    public void setUser(User user) {
+        this.user = user;
+    }
+
+    public User getUser() {
+        return user != null ? user : new User((LinkedHashMap) get("user"));
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/User.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/User.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/User.java
new file mode 100644
index 0000000..d2b8b77
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/model/User.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.model;
+
+
+import java.util.Map;
+import java.util.UUID;
+
+
+/**
+ * Models the user class for response from REST calls.
+ */
+public class User extends Entity {
+
+
+    public User(){}
+    /**
+     * This could also be a user
+     * @param response
+     */
+
+    public User (ApiResponse response, String dataName){
+        setResponse( response, dataName );
+    }
+
+    //TODO: create another constructor to take in the nessesary things to post to a user.
+
+    public User(String username, String name, String email, String password){
+        this.put( "username",username );
+        this.put( "name", name);
+        this.put( "email", email);
+        this.put( "password", password);
+    }
+
+    public User(Map<String,Object> map){
+        this.putAll( map );
+    }
+
+    public Boolean getActivated(){
+        return (Boolean) this.get( "activated" );
+    }
+
+    public Boolean getAdminUser(){
+        return (Boolean) this.get( "adminUser" );
+    }
+
+    public UUID getApplicationId(){
+        return  UUID.fromString( (String) get("applicationId") );
+    }
+
+    public Boolean getConfirmed(){
+        return (Boolean) this.get("confirmed");
+    }
+
+    public Boolean getDisabled(){
+        return (Boolean) this.get("disabled");
+    }
+
+    public String getDisplayEmailAddress(){
+        return (String) this.get("displayEmailAddress");
+    }
+
+    public String getEmail(){
+        return (String) this.get("email");
+    }
+
+    public String getHtmlDisplayEmailAddress(){
+        return (String) this.get("htmldisplayEmailAddress");
+    }
+
+    public String getName(){
+        return (String) this.get("name");
+    }
+
+    public Map<String,Object> getProperties(){
+        return (Map<String,Object>) this.get("properties");
+    }
+
+    public String getUsername(){
+        return (String) this.get("username");
+    }
+
+    public UUID getUuid(){
+        return UUID.fromString( (String) get("uuid") );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/state/ClientContext.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/state/ClientContext.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/state/ClientContext.java
new file mode 100644
index 0000000..4d1843d
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/state/ClientContext.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.state;
+
+
+import org.apache.usergrid.rest.test.resource.model.Token;
+
+
+/**
+ * Context to hold client stateful information
+ * This includes token,orgName and uuid, appName and uuid, and user information
+ */
+public class ClientContext {
+    private Token token;
+
+    public Token getToken() {
+        return token;
+    }
+
+
+    public void setToken( final Token token ) {
+        this.token = token;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/AbstractRestIT.java
deleted file mode 100644
index a7cf04a..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/AbstractRestIT.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.test.framework.AppDescriptor;
-import com.sun.jersey.test.framework.JerseyTest;
-import com.sun.jersey.test.framework.WebAppDescriptor;
-import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
-import org.apache.usergrid.rest.TomcatRuntime;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.ApplicationsResource;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.OrganizationResource;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-import org.junit.Rule;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-
-
-
-/**
- * Base class for REST tests.
- */
-//@RunWith( Arquillian.class )
-public class AbstractRestIT extends JerseyTest {
-
-    private static ClientConfig clientConfig = new DefaultClientConfig();
-
-    public static TomcatRuntime tomcatRuntime = TomcatRuntime.getInstance();
-
-    @Rule
-    public ClientSetup clientSetup = new ClientSetup( this.getBaseURI().toString() );
-
-    protected static final AppDescriptor descriptor;
-
-    public AbstractRestIT() {
-        super( descriptor );
-    }
-
-
-    protected ObjectMapper mapper = new ObjectMapper();
-
-    static {
-        clientConfig.getFeatures().put( JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE );
-        descriptor = new WebAppDescriptor.Builder( "org.apache.usergrid.rest" )
-                .clientConfig( clientConfig ).build();
-        dumpClasspath( AbstractRestIT.class.getClassLoader() );
-    }
-
-
-//    //We set testable = false so we deploy the archive to the server and test it locally
-//    @Deployment( testable = false )
-//    public static WebArchive createTestArchive() {
-//
-//        //we use the MavenImporter from shrinkwrap to just produce whatever maven would build then test with it
-//
-//        //set maven to be in offline mode
-//
-//        System.setProperty( "org.apache.maven.offline", "true" );
-//
-//        return ShrinkWrap.create( MavenImporter.class ).loadPomFromFile( "pom.xml", "arquillian-tomcat" )
-//                         .importBuildOutput().as( WebArchive.class );
-//    }
-
-    public static void dumpClasspath( ClassLoader loader ) {
-        System.out.println( "Classloader " + loader + ":" );
-
-        if ( loader instanceof URLClassLoader ) {
-            URLClassLoader ucl = ( URLClassLoader ) loader;
-            System.out.println( "\t" + Arrays.toString( ucl.getURLs() ) );
-        }
-        else {
-            System.out.println( "\t(cannot display components as not a URLClassLoader)" );
-        }
-
-        if ( loader.getParent() != null ) {
-            dumpClasspath( loader.getParent() );
-        }
-    }
-
-    @Override
-    protected URI getBaseURI() {
-        try {
-            return new URI("http://localhost:" + tomcatRuntime.getPort());
-        } catch (URISyntaxException e) {
-            throw new RuntimeException("Error determining baseURI", e);
-        }
-    }
-
-    @Override
-    protected TestContainerFactory getTestContainerFactory() {
-        return new com.sun.jersey.test.framework.spi.container.external.ExternalTestContainerFactory();
-    }
-
-    ///myorg/
-    protected OrganizationResource org(){
-        return clientSetup.restClient.org( clientSetup.getOrganization().getName() );
-    }
-
-    //myorg/myapp
-    protected ApplicationsResource app(){
-        return clientSetup.restClient.org(clientSetup.getOrganization().getName()).app(clientSetup.getAppName());
-
-    }
-
-    protected ManagementResource management(){
-        return clientSetup.restClient.management();
-    }
-
-    protected NamedResource pathResource(String path){ return clientSetup.restClient.pathResource(path);}
-
-    protected String getOrgAppPath(String additionalPath){
-        return clientSetup.orgName + "/" + clientSetup.appName + "/" + (additionalPath !=null ? additionalPath : "");
-    }
-
-    protected ClientContext context(){
-        return this.clientSetup.getRestClient().getContext();
-    }
-
-
-    protected Token getAppUserToken(String username, String password){
-        return this.app().token().post(new Token(username,password));
-    }
-
-    public void refreshIndex() {
-        //TODO: add error checking and logging
-        clientSetup.refreshIndex();
-    }
-
-
-    /**
-     * Takes in the expectedStatus message and the expectedErrorMessage then compares it to the UniformInterfaceException
-     * to make sure that we got what we expected.
-     * @param expectedStatus
-     * @param expectedErrorMessage
-     * @param uie
-     */
-    public void errorParse(int expectedStatus, String expectedErrorMessage, UniformInterfaceException uie){
-        assertEquals(expectedStatus,uie.getResponse().getStatus());
-        JsonNode errorJson = uie.getResponse().getEntity( JsonNode.class );
-        assertEquals( expectedErrorMessage, errorJson.get( "error" ).asText() );
-
-    }
-
-
-    protected Token getAdminToken(String username, String password){
-        return this.clientSetup.getRestClient().management().token().post(false,Token.class,
-                new Token(username, password),null,false
-        );
-    }
-
-    protected Token getAdminToken(){
-        return this.clientSetup.getRestClient().management().token().post(false,Token.class,
-                new Token(this.clientSetup.getUsername(),this.clientSetup.getUsername()),null,false
-        );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/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
deleted file mode 100644
index be0e28d..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/ClientSetup.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Created by ApigeeCorporation on 12/4/14.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0;
-
-
-import org.apache.usergrid.corepersistence.util.CpNamingUtils;
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-
-/**
- * This class is used to setup the client rule that will setup the RestClient and create default applications.
- */
-public class ClientSetup implements TestRule {
-
-    private Logger logger = LoggerFactory.getLogger( ClientSetup.class );
-
-    RestClient restClient;
-
-    protected String username;
-    protected String password;
-    protected String orgName;
-    protected String appName;
-    protected String appUuid;
-    protected Token superuserToken;
-    protected String superuserName = "superuser";
-    protected String superuserPassword = "superpassword";
-    protected Credentials clientCredentials;
-
-    protected Organization organization;
-    protected Entity application;
-
-
-    public ClientSetup (String serverUrl) {
-
-        restClient = new RestClient( serverUrl );
-    }
-
-    public Statement apply( Statement base, Description description ) {
-        return statement( base, description );
-    }
-
-
-    private Statement statement( final Statement base, final Description description ) {
-        return new Statement() {
-            @Override
-            public void evaluate() throws Throwable {
-                before( description );
-                try {
-                    base.evaluate();
-                }
-                finally {
-                    cleanup();
-                }
-            }
-        };
-    }
-
-
-    protected void cleanup() {
-        // might want to do something here later
-    }
-
-
-    protected void before( Description description ) throws IOException {
-        String testClass = description.getTestClass().getName();
-        String methodName = description.getMethodName();
-        String name = testClass + "." + methodName;
-
-        try {
-            restClient.superuserSetup();
-            superuserToken = restClient.management().token().get(superuserName, superuserPassword);
-        } catch ( Exception e ) {
-            if ( logger.isDebugEnabled() ) {
-                logger.debug( "Error creating superuser, may already exist", e );
-            } else {
-                logger.warn( "Error creating superuser, may already exist");
-            }
-        }
-
-        username = "user_"+name + UUIDUtils.newTimeUUID();
-        password = username;
-        orgName = "org_"+name+UUIDUtils.newTimeUUID();
-        appName = "app_"+name+UUIDUtils.newTimeUUID();
-
-        organization = restClient.management().orgs().post(
-            new Organization( orgName, username, username + "@usergrid.com", username, password, null ) );
-
-        restClient.management().token().get(username,password);
-
-        clientCredentials = restClient.management().orgs().org( orgName ).credentials().get(Credentials.class);
-
-        ApiResponse appResponse = restClient.management().orgs()
-            .org( organization.getName() ).app().post(new Application(appName));
-        appUuid = ( String ) appResponse.getEntities().get( 0 ).get( "uuid" );
-        application = new Application( appResponse );
-        refreshIndex();
-
-        ApiResponse response = restClient.management().token().post(new Token(username, password));
-        refreshIndex();
-    }
-
-    public String getUsername(){return username;}
-
-    public String getEmail(){return username+"@usergrid.com";}
-
-    public String getPassword(){return password;}
-
-    public Organization getOrganization(){return organization;}
-
-    public String getOrganizationName(){return orgName;}
-
-    public String getAppName() {return appName;}
-
-    public String getAppUuid() {
-        return appUuid;
-    }
-
-    public Token getSuperuserToken() {
-        return superuserToken;
-    }
-
-    public String getSuperuserName() {
-        return superuserName;
-    }
-
-    public String getSuperuserPassword() {
-        return superuserPassword;
-    }
-
-    public Credentials getClientCredentials() {
-        return clientCredentials;
-    }
-
-    public void refreshIndex() {
-        this.restClient.refreshIndex(getOrganizationName(),getAppName(),
-            CpNamingUtils.getManagementApplicationId().getUuid().toString());
-
-        if(!CpNamingUtils.getManagementApplicationId().getUuid().toString().equals(getAppUuid())) {
-            this.restClient.refreshIndex(getOrganizationName(), getAppName(), getAppUuid());
-        }
-    }
-
-    public RestClient getRestClient(){
-        return restClient;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/DumbClient.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/DumbClient.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/DumbClient.java
deleted file mode 100644
index e56be2d..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/DumbClient.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-
-
-
-/**
- * Test Class used to model if the client is working or doing what it is supposed to be doing.
- * ask if this is for test purposes and if so if I can mark it with junit
- */
-
-public class DumbClient extends AbstractRestIT {
-
-    @Test
-    public void stuff(){
-
-        String name = "stuff"+ UUIDUtils.newTimeUUID();
-       // User user = new User( "derp","derp", "derp"  );
-
-
-        //Organization org = clientSetup.getRestClient().management().orgs().post(  )
-      //  clientSetup.getRestClient().management().orgs().delete(org.getName);
-       // OrganizationResource response =  clientSetup.getRestClient().management().orgs().organization( "" );
-        //assertNotNull( response );
-        //EntityResponse itr  =  client.org( "test" ).getApp( "test" ).users().getEntityResponse();
-        //for(Entity entity: itr){
-    }
-
-
-    @Ignore
-    public void stateful(){
-
-//        EntityResponse itr  =  client.org( "test" ).getApp( "test" ).users().getEntityResponse();
-//
-//        for(Entity entity: itr){
-//
-//        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/README.md
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/README.md b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/README.md
deleted file mode 100644
index b82c6f7..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/README.md
+++ /dev/null
@@ -1,111 +0,0 @@
-#Rest Test Framework (RTF)
-
-##What is it?
-It is a java framework that helps abstract some of the difficulty in working with the rest tier. Each endpoint is a different part of the builder pattern that ends with a request at the end. This request is sent to an embedded tomcat that has a usergrid war deployed on it. When the response comes back the RTF parses the response and allows the user to query information returned.  
-
-##How does it work?
-It works by modeling the REST tier in Usergrid. We construct our query using usergrid endpoints that create our path and after it gets sent using POST/PUT/GET/DELETE.
-
-##Where is it
-All of the code is stored in resource2point0. The older resource folder holds the old rest testing framework. 
-
-##Requirements
-First you must have java 8 running on your machine. Then setup local instances of elasticsearch and cassandra on your box. 
-
-##How do I use it?
-
-###For example...
-
-It helps to start out with an example. Let's deconstruct the following line step by step
-
-	clientSetup.getRestClient().management().orgs().post( payload ); 
-	
-1. clientSetup
-	
-	1. The clientSetup is what stores the context of the rest call. It also creates a new superuser/org/app/user and stores information specific to each one in the clientsetup. If you don't want to create a new org or app then you are free to call the getters in the clientSetup for the context of the current rest calls.
-
-2. getRestClient()
-	
-	1. 	This returns our RestClient that handles the setup for our Jersey WebResource. In the RestClient class we handle the setup of the client and the configuration of the client.
-	
-	2. It also stores the top level rest properties that can be called. This client starts by appending the serverUrl to the resource path. 
-		
-		1. The serverUrl for our rest tests is the localhost:port. These are both automatically assigned.
-	
-	3. Next we have the option of calling any of the endpoint detailed in the RestClient.java. You'll see many options but the two most important are probably /management and /org which allow you to access a majority of usergrid endpoints. 
-
-3. management()
-	
-	1. This appends the "management" endpoint unto our path. Right now we have the following path "localhost:8080/management".
-	
-	2. In the ManagementResource class you will find other endpoints that you can call. In this example we're calling ```orgs()```.
-	
-4. orgs()
-	
-	1. This appends "/organizations" to the path, so now we have "localhost:8080/management/organizations"
-	
-	2. This sends us to OrganizationResource.java and will be the first instance where it will give you access to do a REST call. 
-	
-5. post( payload );
-
-	1. Here the organization class let's us know what endpoints we have available to us. In this case we want to post, but the individual classes will let you know what next steps are available.
-	2. So now we have a POST command against the locally embedded tomcat at the following endpoint "localhost:8080/management/organizations" and it will post the payload.
-	3. The payload is often a map object but specific types and return types will be covered later in the README.
-	
-###ClientSetup
-####What does it do?
-It setups and stores a new organization/owner/application/superuser for each test. Since this happens at the beginning of each test we can call the ClientSetup class for information when we don't want/need to create our own organization/owner/application/superuser. 
-
-####For Example...
-	String org = this.clientSetup.getOrganizationName();
-	String app = this.clientSetup.getAppName();
-	
-    clientSetup.getRestClient().org(org).app(app).collection("cities").get();
-    
-The above example is a call you could make in a rest test as soon as you start writing one. You don't have to create the org and application and you can just reference the ones already created for you.
-
-###RestClient
-####What does it do?
-Handles the setup for our Jersey WebResource. In the RestClient class we handle the configuration of the JerseyClient so we can send our rest calls against the tomcat. The rest client also contains the methods to call all of our top level classes. So from the RestClient we can call any of our top level endpoints. 
-
-
-###AbstractRestIT
-
-####What does it do?
-This class handles a lot of the setup required by the testing functionality. It also stores helper methods central to each test and setup the tomcat that the tests will be querying. That is why it is extended by every test class.
-
-####What helper methods does it give me access to?
-Every single one of the test queries makes a call from the context ( because it needs access to the unique org and application ) to get the client. There are methods to make the tests look cleaner by automating the calls and getting the endpoint you want without writing 
-
-	clientSetup.getRestClient()
-	
-###Endpoints
-####What does it do?
-Holds the classes that contain the builder pattern. There are a lot of classes here currently so its easy to get lost. Following the RestClient through the hierarchy of the calls you want to run will give you the greatest insight into how they are organized. 
-
-
-###Model
-This folder handles the data that gets returned from the api and the payloads that go into the api. 
-
-####For Example...
-
-To create an organization we can create a model object for the specific kind of entity we want to post.
-
-	Organization payload = new Organization( String orgName, String username, String email, String ownerName, String password, Map<String,Object> properties );
-
-Now that we have an organization payload, we can POST to create the organization.
-	
-	Organization org = clientSetup.getRestClient().management().orgs().post( payload ); 
-
-This in turn creates an Organization object we've called ```org``` that is intialized with the POST response. This gives us easy access to the organization information to verify that it was indeed created correctly.
-
-
-For a more in-depth explanation for how they work look at the readme in the model folder (Work-In-Progress).
-
-
-
-<!-- The below needs to be refactored into a different readme just for the model class.  
-
-####How does the RET model responses?
-We model responses by serializing the response into its respective model class. At the lowest level we use a ApiResponse. The ApiResponse contains fields for every kind of response we could recieve from the api. If there is any doubt about what class you need to return or push the response in you should use the ApiResponse. From the ApiResponse we model -->
-	  	
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
deleted file mode 100644
index cc24ebe..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/RestClient.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.*;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-
-/**
- * This REST client was made to be able to send calls to any backend system that accepts calls. To do this It needs to
- * work independently of the existing REST test framework.
- */
-public class RestClient implements UrlResource {
-
-    private final String serverUrl;
-    private ClientContext context;
-
-    public WebResource resource;
-    ClientConfig config = new DefaultClientConfig();
-    Client client = Client.create( config );
-
-    /**
-     *
-     * @param serverUrl
-     */
-    public RestClient( final String serverUrl ) {
-        this.serverUrl = serverUrl;
-        this.context = new ClientContext();
-        resource = client.resource( serverUrl );
-        resource.path( serverUrl );
-    }
-
-
-    /**
-     * TODO: should this method return the base path or the total path we have built?
-     */
-    @Override
-    public String getPath() {
-        return resource.getURI().toString();
-    }
-
-    @Override
-    public WebResource getResource() {
-        return client.resource( serverUrl );
-    }
-
-    public ClientContext getContext() {
-        return context;
-    }
-
-    public SystemResource system() {
-        return new SystemResource(context, this);
-    }
-
-    public TestPropertiesResource testPropertiesResource() {
-        return new TestPropertiesResource( context, this );
-    }
-    /**
-     * Get the management resource
-     */
-    public ManagementResource management() {
-        return new ManagementResource( context, this );
-    }
-
-
-    /**
-     * Get hte organization resource
-     */
-    public OrganizationResource org( final String orgName ) {
-        return new OrganizationResource( orgName, context, this );
-    }
-
-    public TokenResource token(){
-        return new TokenResource(context,this);
-    }
-    public void refreshIndex(String orgname, String appName, String appid) {
-        //TODO: add error checking and logging
-        this.getResource().path( "/refreshindex" )
-                .queryParam( "org_name", orgname )
-                .queryParam( "app_name",appName )
-                .queryParam("app_id", appid)
-            .accept( MediaType.APPLICATION_JSON ).post();
-    }
-
-    public NamedResource pathResource(String path){
-        return new NamedResource(path,context,this);
-    }
-
-    public void superuserSetup() {
-        //TODO: change this when we upgrade to new version of jersey
-        HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
-        client.addFilter( httpBasicAuthFilter );
-
-        this.getResource().path( "system/superuser/setup" )
-            .accept( MediaType.APPLICATION_JSON ).type( MediaType.APPLICATION_JSON ).get( JsonNode.class );
-        client.removeFilter( httpBasicAuthFilter );
-    }
-
-    //todo:fix this method for the client.
-//    public void loginAdminUser( final String username, final String password ) {
-//        //Post isn't implemented yet, but using the method below we should be able to get a superuser password as well.
-//        //final String token = management().token().post(username, password);
-//
-//        //context.setToken( token );
-//    }
-
-//
-//    public void createOrgandOwner
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/TestPropertiesResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/TestPropertiesResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/TestPropertiesResource.java
deleted file mode 100644
index 2650c29..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/TestPropertiesResource.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0;
-
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- *Adds support for changing the management properties in the rest testing framework.
- */
-public class TestPropertiesResource extends NamedResource {
-    public TestPropertiesResource( final ClientContext context, final UrlResource parent ) {
-        super( "testproperties", context, parent );
-    }
-
-    public ApiResponse post(Entity testProperties){
-
-        return getResource(true).type( MediaType.APPLICATION_JSON_TYPE )
-                            .accept( MediaType.APPLICATION_JSON ).post( ApiResponse.class, testProperties );
-    }
-
-    public ApiResponse get(){
-        return getResource(true).type( MediaType.APPLICATION_JSON_TYPE )
-                       .accept( MediaType.APPLICATION_JSON ).get(ApiResponse.class );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationsResource.java
deleted file mode 100644
index 1d84dea..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationsResource.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import org.apache.usergrid.rest.test.resource.app.Collection;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.CredentialsResource;
-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.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-
-/**
- * Holds the information required for building and chaining application objects to collections.
- * app("applications").post();
- */
-public class ApplicationsResource extends NamedResource {
-
-
-    public ApplicationsResource( final String name, final ClientContext context, final UrlResource parent ) {
-        super( name, context, parent );
-    }
-
-
-    public CollectionEndpoint collection(String name) {
-        return new CollectionEndpoint(name,context,this);
-    }
-
-
-    public TokenResource token() {
-        return new TokenResource( context, this );
-    }
-
-
-    /**
-     * Delete this application.
-     */
-    public ApiResponse delete() {
-        return getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept( MediaType.APPLICATION_JSON )
-            .delete( ApiResponse.class );
-    }
-
-    public CredentialsResource credentials(){
-        return new CredentialsResource(  context ,this );
-    }
-
-
-    /**
-     * Used to get an application entity.
-     */
-    public ApiResponse get() {
-        return getResource(true)
-            .type(MediaType.APPLICATION_JSON_TYPE)
-            .accept( MediaType.APPLICATION_JSON )
-            .get(ApiResponse.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionEndpoint.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionEndpoint.java
deleted file mode 100644
index d104e29..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionEndpoint.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-import org.apache.usergrid.services.ServiceParameter;
-import org.apache.usergrid.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.*;
-
-
-/**
- * //myorg/myapp/mycollection
- */
-public class CollectionEndpoint extends NamedResource {
-    private static final Logger logger = LoggerFactory.getLogger(CollectionEndpoint.class);
-
-    protected List<String> acceptHeaders = new ArrayList<String> ();
-    private String matrix;
-
-    public CollectionEndpoint(String name, ClientContext context, UrlResource parent) {
-        super(name, context, parent);
-    }
-
-    public EntityEndpoint uniqueID(final String identifier){
-        return new EntityEndpoint(identifier, context, this);
-    }
-
-    public EntityEndpoint entity(final Entity entity){
-        String identifier = (String) entity.get("uuid");
-        return entity(identifier);
-    }
-
-    public EntityEndpoint entity(final UUID identifier ){
-        return entity(identifier.toString());
-    }
-
-
-    public EntityEndpoint entity(final String identifier ){
-        return uniqueID(identifier);
-    }
-
-    public CollectionEndpoint withAcceptHeader(final String acceptHeader) {
-        this.acceptHeaders.add(acceptHeader);
-        return this;
-    }
-
-    /**
-     * <pre>
-     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
-     * POST /users/fred/following/users/barney?token=<token>
-     *
-     * app.collection("users").uniqueID("fred").connection().collection("users").uniqueID("barney").post();
-     * POST /users/fred/groups/theitcrowd?token=<token>
-     * </pre>
-     */
-    public CollectionEndpoint collection(final String identifier){
-        return new CollectionEndpoint(identifier, context, this);
-    }
-
-
-
-    /**
-     * Get a list of entities.
-     *
-     * <pre>
-     * //with token
-     * app.collection("users").get(); //return entity
-     * GET /users?token=<token>
-     *
-     * //with query and token
-     * collection = app.collection("users").get(queryparam); //return collection (list of entities)
-     * GET /users?ql=select * where created > 0&token=<token>
-     *
-     * //with query and no token
-     * collection = app.collection("users").get(queryparam, false); //return collection (list of entities)
-     * GET /users?ql=select * where created > 0
-     *
-     * //with no query and no token
-     * collection = app.collection("users").get(null, false); //return collection (list of entities)
-     * GET /users
-     *
-     * collection = app.collection("users").get(collection);
-     * <pre>
-     */
-    public Collection get(){
-        return new Collection( get(ApiResponse.class,null,true));
-    }
-
-    public Collection get( final QueryParameters parameters ){
-        return get(parameters, true);
-    }
-
-    public Collection get(final QueryParameters parameters, final boolean useToken){
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-        if (this.acceptHeaders.size() > 0) {
-           acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        WebResource resource  = getResource(useToken);
-        resource = addParametersToResource(resource, parameters);
-
-        // use string type so we can log actual response from server
-        String responseString = resource.type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(acceptHeader)
-            .get(String.class);
-
-        logger.debug("Response from get: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return new Collection(response);
-    }
-
-    /**
-     * Gets the next page using only default settings with the passed in collection.
-     *
-     * <pre>
-     * Collection usersCollection =  app.collection("users").get();
-     * //iterate through the collection
-     * while(usersCollection.hasNext()){
-     *  Entity bob = usersCollection.next();
-     *     assert("blah",bob.get("words"));
-     * }
-     * usersCollection = app.collections("users").getNextPage(usersCollection.cursor);
-     * </pre>
-     */
-    //TODO: add queryParameters here
-    public Collection getNextPage(Collection collection, QueryParameters passedParameters ,final boolean useToken) {
-        String acceptHeader = MediaType.APPLICATION_JSON;
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        WebResource resource = getResource(useToken);
-        QueryParameters queryParameters = passedParameters;
-        if( queryParameters == null){
-            queryParameters = new QueryParameters();
-        }
-
-        queryParameters.setCursor(collection.getCursor());
-        resource = addParametersToResource(resource, queryParameters);
-
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(acceptHeader)
-                .get(ApiResponse.class);
-
-        return new Collection(response);
-    }
-
-    /**
-     * DELETE on a collection endpoint with query (use DELETE on entity for single entity delete).
-     *
-     * <pre>
-     * //with token
-     * app.collection("users").delete(parameters);
-     * DELETE /users?ql=select * where created > 0&token=<token>
-     *
-     * //without token
-     * app.collection("users").delete(parameters, false);
-     * DELETE /users?ql=select * where created > 0
-     *
-     * app.collection("users").delete(null, false);
-     * DELETE /users
-     * </pre>
-     */
-    public ApiResponse delete( final QueryParameters parameters ){
-        return delete(parameters, true);
-    }
-
-    public ApiResponse delete(final QueryParameters parameters, final boolean useToken) {
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        WebResource resource  = getResource(useToken);
-        resource = addParametersToResource(resource, parameters);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(acceptHeader)
-            .delete(ApiResponse.class);
-    }
-
-    /**
-     * Post an entity to a collection.
-     *
-     * <pre>
-     * app.collection("users").post(entity);
-     * POST /users {"color","red"}
-     * </pre>
-     */
-    public Entity post(Entity payload){
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        // use string type so we can log actual response from server
-        String responseString = getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(acceptHeader)
-            .post(String.class, payload);
-
-        logger.debug("Response from post: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return new Entity(response);
-    }
-
-    public Entity post() {
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        // use string type so we can log actual response from server
-        String responseString = getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(acceptHeader)
-            .post(String.class);
-
-        logger.debug("Response from post: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return new Entity(response);
-    }
-
-    public ApiResponse post(List<Entity> entityList) {
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        // use string type so we can log actual response from server
-        String responseString = getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(acceptHeader)
-            .post(String.class, entityList );
-
-        logger.debug("Response from post: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return response;
-    }
-
-    /**
-     * PUT a payload to a collection.
-     *
-     * <pre>
-     * app.collection("users").put(entity, param);
-     * PUT /users?ql=select * where created > 0&token=<token>
-     *
-     * app.collection("users").put(entity, false, param);
-     * PUT /users?ql=select * where created > 0
-     * </pre>
-     */
-    public ApiResponse put( final QueryParameters parameters, Entity entity ){
-        return put(parameters, true, entity);
-    }
-
-    public ApiResponse put(final QueryParameters parameters, final boolean useToken, Entity entity) {
-
-        String acceptHeader = MediaType.APPLICATION_JSON;
-        if (this.acceptHeaders.size() > 0) {
-            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
-        }
-
-        WebResource resource  = getResource(useToken);
-        addParametersToResource(getResource(), parameters);
-
-        // use string type so we can log actual response from server
-        String responseString = resource.type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(acceptHeader)
-            .post(String.class, entity);
-
-        logger.debug("Response from put: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return response;
-    }
-
-    public CollectionEndpoint matrix(QueryParameters parameters) {
-        this.matrix = getMatrixValue(parameters);
-        return this;
-    }
-
-    @Override
-    public String getMatrix(){
-        return matrix != null ? matrix : "";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
deleted file mode 100644
index 7ed31ac..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/DatabaseResource.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.usergrid.persistence.cassandra.Setup;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- * Contains methods pertaining to system/database/*
- */
-public class DatabaseResource extends NamedResource {
-
-    public DatabaseResource( final ClientContext context, final UrlResource parent ) {
-        super( "database", context, parent );
-    }
-
-    public SetupResource setup(){
-        return new SetupResource (context, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityEndpoint.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityEndpoint.java
deleted file mode 100644
index 25965ac..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityEndpoint.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-public class EntityEndpoint extends NamedResource {
-
-    public EntityEndpoint(String identifier, ClientContext context, UrlResource parent) {
-        super(identifier, context, parent);
-    }
-
-
-    /**
-     *
-     * GET a single entity
-     *
-     * @return Entity
-     *
-     *
-     * entity = app.collection("users").uniqueID("fred").get(); //return one entity
-     * GET /users/fred
-     *
-     * entity = app.collection("users").entity(entity).get(); //return one entity
-     * GET /users/username_in_entity_obj
-     *
-     */
-    public Entity get(){
-        return get(true);
-    }
-
-    public Entity get(final boolean useToken){
-        return get(useToken,null);
-    }
-    public Entity get(final Token token){
-        return get(true,token);
-    }
-
-    public Entity get(final boolean useToken, final Token token){
-        WebResource resource  = getResource(useToken,token);
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .get(ApiResponse.class);
-
-        return new Entity(response);
-    }
-
-    //For testing purposes only
-    public Entity get(QueryParameters parameters, final boolean useToken){
-        WebResource resource  = getResource(useToken);
-        resource = addParametersToResource(resource, parameters);
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                                       .get(ApiResponse.class);
-
-        return new Entity(response);
-    }
-
-
-    /**
-     * DELETE a single entity
-     *
-     *
-     * app.collection("users").entity(entity).delete();
-     * DELETE /users/username?token=<token>
-     *
-     * app.collection("users").entity(entity).delete(false);
-     * DELETE /users/uuid
-     */
-    public ApiResponse delete(){
-        return delete(true);
-    }
-
-    public ApiResponse delete(final boolean useToken){
-        WebResource resource  = getResource(useToken);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .delete(ApiResponse.class);
-    }
-
-    /**
-     * Put the entity to the collection
-     * @param entity
-     * @return
-     *
-     * app.collection("users").entity(entity).put(entity);
-     * PUT /users/uuid {}
-     *
-     * app.collection("users").uniqueID("fred").put(entity);
-     * PUT /users/fred {"color":"red"}
-     */
-    public Entity put(Entity entity){
-        ApiResponse response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .put(ApiResponse.class, entity);
-        return new Entity(response);
-    }
-
-
-    /**
-     * POST with no payload
-     *
-     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
-     * POST /users/fred/following/users/barney?token=<token>
-     *
-     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post(false);
-     * POST /users/fred/following/users/barney
-     *
-     */
-    public Entity post(){
-        return post(true);
-    }
-
-    public Entity post(final boolean useToken){
-        WebResource resource  = getResource(useToken);
-        ApiResponse response = resource.type(MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .post(ApiResponse.class);
-
-        return new Entity(response);
-    }
-
-    /**
-     *
-     * app.collection("users").uniqueID("fred").connection("following).get();
-     * GET /users/fred/following
-     *
-     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
-     * POST /users/fred/following/users/barney?token=<token>
-     *
-     * app.collection("users").uniqueID("fred").connection().collection("users").uniqueID("barney").post();
-     * POST /users/fred/following/users/barney?token=<token>
-     *
-     */
-    public CollectionEndpoint connection(final String connection,final String collection) {
-        return new CollectionEndpoint(connection+"/"+collection, context, this);
-    }
-    public CollectionEndpoint connection(final String connection) {
-        return new CollectionEndpoint(connection, context, this);
-
-    }
-    public CollectionEndpoint collection(final String identifier) {
-        return new CollectionEndpoint(identifier, context, this);
-    }
-    public CollectionEndpoint connection(){
-        return new CollectionEndpoint("", context, this);
-    }
-
-
-    public CollectionEndpoint activities() {
-        return collection("activities");
-    }
-}


[3/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/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
deleted file mode 100644
index 3eeddf8..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/NamedResource.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-import com.sun.jersey.api.representation.Form;
-import com.sun.jersey.multipart.FormDataMultiPart;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Base class that is extended by named endpoints.
- * The NamedResource stores the parent of the class, the context in which the class operates and then Name of this resource
- */
-public class NamedResource implements UrlResource {
-
-    protected final String name;
-    protected final ClientContext context;
-    /* Stores the path of the parent that called it.
-    i.e If we had a ApplicationResource ( an instance of a namedResource ) this would contain the OrganizationResource.
-     */
-    protected final UrlResource parent;
-
-
-    public NamedResource( final String name, final ClientContext context, final UrlResource parent ) {
-        this.name = name;
-        this.context = context;
-        this.parent = parent;
-    }
-
-
-    @Override
-    public String getPath() {
-        return name + getMatrix();
-    }
-
-    @Override
-    public WebResource getResource() {
-        return getResource(false);
-    }
-    public WebResource getResource(boolean useToken) {
-        return getResource(useToken,null);
-    }
-    public WebResource getResource(boolean useToken,Token token) {
-        WebResource resource = parent.getResource().path( getPath() );
-        token = token !=null ? token : this.context.getToken();
-        //error checking
-        if (token == null) {
-            return resource;
-        }
-        return  useToken    ? resource.queryParam("access_token",token.getAccessToken()) :  resource;
-    }
-
-    protected WebResource addParametersToResource(WebResource resource, final QueryParameters parameters){
-
-        if(parameters == null){
-            return resource;
-        }
-        if ( parameters.getQuery() != null ) {
-            resource = resource.queryParam( "ql", parameters.getQuery() );
-        }
-
-        if ( parameters.getCursor() != null ) {
-           resource = resource.queryParam( "cursor", parameters.getCursor() );
-        }
-
-        if ( parameters.getStart() != null ) {
-            resource = resource.queryParam("start", parameters.getStart().toString());
-        }
-
-        if ( parameters.getLimit() != null ) {
-             resource = resource.queryParam("limit", parameters.getLimit().toString());
-        }
-        //We can also post the params as queries
-        if ( parameters.getFormPostData().size() > 0){
-            Map<String,String> formData = parameters.getFormPostData();
-            Set<String> keySet = formData.keySet();
-            Iterator<String> keyIterator = keySet.iterator();
-
-
-            while(keyIterator.hasNext()){
-                String key = keyIterator.next();
-                String value = formData.get( key );
-                resource = resource.queryParam( key, value );
-            }
-        }
-        return resource;
-    }
-
-    protected String getMatrixValue(final QueryParameters parameters) {
-
-        StringBuilder sb = new StringBuilder();
-        if (parameters == null) {
-            return null;
-        }
-        if (parameters.getQuery() != null) {
-            sb.append(";");
-            sb.append("ql").append("=").append(parameters.getQuery());
-        }
-
-        if (parameters.getCursor() != null) {
-            sb.append(";");
-            sb.append("cursor").append("=").append(parameters.getCursor());
-        }
-        if (parameters.getStart() != null) {
-            sb.append(";");
-            sb.append("start").append("=").append(parameters.getStart());
-        }
-        if (parameters.getLimit() != null) {
-            sb.append(";");
-            sb.append("limit").append("=").append(parameters.getLimit());
-        }
-        //We can also post the params as queries
-        if (parameters.getFormPostData().size() > 0) {
-            Map<String, String> formData = parameters.getFormPostData();
-            Set<String> keySet = formData.keySet();
-            Iterator<String> keyIterator = keySet.iterator();
-
-
-            while (keyIterator.hasNext()) {
-                if (sb.length() > 0)
-                    sb.append(";");
-                String key = keyIterator.next();
-                String value = formData.get(key);
-                sb.append(key).append("=").append(value);
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
-     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
-     * @param map
-     * @return
-     */
-    //For edge cases like Organizations and Tokens
-    public ApiResponse post(Map map) {
-        return post( true, ApiResponse.class, map, null, false );
-
-    }
-
-    //For edge cases like Organizations and Tokens
-    public ApiResponse post(boolean useToken, Map map, QueryParameters queryParameters) {
-        return post( useToken, ApiResponse.class, map, queryParameters, false );
-
-    }
-
-    /**
-     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
-     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
-     * @param type
-     * @param <T>
-     * @return
-     */
-    //For edge cases like Organizations and Tokens
-    public <T> T post(Class<T> type) {
-        return post(true,type,null,null,false);
-
-    }
-
-    /**
-     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
-     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
-     * @param type
-     * @param requestEntity
-     * @param <T>
-     * @return
-     */
-    //For edge cases like Organizations and Tokens
-    public <T> T post(Class<T> type, Entity requestEntity) {
-        return post(true,type,requestEntity,null,false);
-
-    }
-
-    /**
-     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
-     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
-     * @param type
-     * @param requestEntity
-     * @param <T>
-     * @return
-     */
-    //For edge cases like Organizations and Tokens
-    public <T> T post(Class<T> type, Map requestEntity) {
-        return post(true,type,requestEntity,null,false);
-
-    }
-
-    public <T> T post( boolean useToken, Class<T> type, Map requestEntity) {
-        return post(useToken, type, requestEntity, null, false);
-
-    }
-
-    /**
-     * Used to test POST using form payloads.
-     * @param type
-     * @param requestEntity
-     * @param <T>
-     * @return
-     */
-    public <T> T post(Class<T> type, Form requestEntity) {
-        GenericType<T> gt = new GenericType<>((Class) type);
-        return getResource()
-            .accept(MediaType.APPLICATION_JSON)
-            .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE)
-            .entity(requestEntity, MediaType.APPLICATION_FORM_URLENCODED_TYPE)
-            .post(gt.getRawClass());
-
-    }
-
-
-    //Used for empty posts
-    public <T> T post( boolean useToken, Class<T> type, Map entity, final QueryParameters queryParameters) {
-        WebResource resource = getResource(useToken);
-        resource = addParametersToResource(resource, queryParameters);
-        WebResource.Builder builder = resource
-            .type(MediaType.APPLICATION_JSON_TYPE)
-            .accept( MediaType.APPLICATION_JSON );
-
-        if(entity!=null){
-            builder.entity(entity);
-        }
-        GenericType<T> gt = new GenericType<>((Class) type);
-        return builder
-            .post(gt.getRawClass());
-
-    }
-
-    //Used for empty posts
-    public <T> T post( boolean useToken, Class<T> type, Map entity, final QueryParameters queryParameters, boolean useBasicAuthentication ) {
-        WebResource resource = getResource(useToken);
-        resource = addParametersToResource(resource, queryParameters);
-        WebResource.Builder builder = resource
-            .type(MediaType.APPLICATION_JSON_TYPE)
-            .accept( MediaType.APPLICATION_JSON );
-
-        if(entity!=null){
-            builder.entity(entity);
-        }
-
-        if(useBasicAuthentication){
-            //added httpBasicauth filter to all setup calls because they all do verification this way.
-            HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
-            resource.addFilter( httpBasicAuthFilter );
-        }
-
-        GenericType<T> gt = new GenericType<>((Class) type);
-        return builder.post( gt.getRawClass() );
-
-    }
-
-    //For edge cases like Organizations and Tokens without any payload
-    public <T> T get(Class<T> type) {
-        return get(type,null,true);
-
-    }
-
-    //For edge cases like Organizations and Tokens without any payload
-    public <T> T get(Class<T> type, boolean useToken) {
-        return get( type, null, useToken );
-    }
-
-
-
-    public <T> T get(Class<T> type,QueryParameters queryParameters) {
-        return get( type, queryParameters, true );
-    }
-
-    public <T> T get(Class<T> type,QueryParameters queryParameters, boolean useToken) {
-        WebResource resource = getResource(useToken);
-        if(queryParameters!=null) {
-            resource = addParametersToResource(resource, queryParameters);
-        }
-        GenericType<T> gt = new GenericType<>((Class) type);
-        return resource.type(MediaType.APPLICATION_JSON_TYPE)
-            .accept( MediaType.APPLICATION_JSON )
-            .get( gt.getRawClass() );
-
-    }
-
-    public String getMatrix() {
-        return "";
-    }
-
-    public ApiResponse post( boolean useToken, FormDataMultiPart multiPartForm ) {
-        WebResource resource = getResource( useToken );
-        return resource.type( MediaType.MULTIPART_FORM_DATA_TYPE ).post( ApiResponse.class, multiPartForm );
-    }
-
-    public ApiResponse post( FormDataMultiPart multiPartForm ) {
-        return post( true, multiPartForm );
-    }
-
-    public ApiResponse put( boolean useToken, byte[] data, MediaType type ) {
-        WebResource resource = getResource(useToken);
-        return resource.type( type ).put( ApiResponse.class, data );
-    }
-
-    public ApiResponse put( byte[] data, MediaType type ) {
-        return put( true, data, type );
-    }
-
-    public ApiResponse put( boolean useToken, FormDataMultiPart multiPartForm ) {
-        WebResource resource = getResource(useToken);
-        return resource.type( MediaType.MULTIPART_FORM_DATA_TYPE ).put( ApiResponse.class, multiPartForm );
-    }
-
-    public ApiResponse put( FormDataMultiPart multiPartForm ) {
-        return put( true, multiPartForm );
-    }
-
-    public InputStream getAssetAsStream( boolean useToken ) {
-        WebResource resource = getResource(useToken);
-        return resource.accept( MediaType.APPLICATION_OCTET_STREAM_TYPE ).get( InputStream.class );
-    }
-
-    public InputStream getAssetAsStream() {
-        return getAssetAsStream( true );
-    }
-
-    public ApiResponse delete( ) {
-        return delete(true);
-    }
-
-    public ApiResponse delete( boolean useToken ) {
-        return getResource(useToken).delete( ApiResponse.class );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/OrganizationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/OrganizationResource.java
deleted file mode 100644
index c1032b6..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/OrganizationResource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- * Holds the information required for building and chaining organization objects to applications.
- * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
- */
-public class OrganizationResource extends NamedResource {
-
-
-    public OrganizationResource( final String name, final ClientContext context, final UrlResource parent ) {
-        super( name, context, parent );
-    }
-
-    public ApplicationsResource app(final String name){
-        return new ApplicationsResource( name, context ,this );
-    }
-
-    public Organization get(){
-        throw new UnsupportedOperationException("service doesn't exist");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/RootResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/RootResource.java
deleted file mode 100644
index 4570bac..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/RootResource.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt.ManagementResource;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * Contains the root element for classes. Contains the client context that holds a token for the management calls,
- * and also contains the serverUrl so we know what endpoint we need to hit.
- * Contains the two top level functions that can be called from the "root" ( actual root is the serverUrl )
- * 1.) Is the management resource i.e /management/org/blah/...
- * 2.) Is the organization resource i.e /<orgname>/<appname>...
- * This is where top level elements are contained and managemend
- */
-//TODO: check to see if this actually ever gets called. It doesn't seem like so remove once verified.
-public class RootResource implements UrlResource {
-
-
-    private final String serverUrl;
-    private final ClientContext context;
-
-
-    /**
-     *
-     * @param serverUrl The serverurl that has stood up the UG instance i.e localhost:8080
-     * @param context Contains the token that will be used for the following resources.
-     */
-    public RootResource( final String serverUrl, final ClientContext context ) {
-        this.serverUrl = serverUrl;
-        this.context = context;
-    }
-
-
-    /**
-     * Returns the serverUrl that the root resource is pointing to.
-     * @return serverUrl
-     */
-    @Override
-    public String getPath() {
-        return serverUrl;
-    }
-
-    @Override
-    public WebResource getResource() {
-        //TODO: fix this to return the proper resource in the scope we expect it, might not be needed here.
-        return null;
-    }
-
-    /**
-     * Get the management resource
-     * @return
-     */
-    public ManagementResource management(){
-        return new ManagementResource( context, this);
-    }
-
-
-    /**
-     * Get the organization resource
-     * @param orgName
-     * @return OrganizationResource Returns an instance of the OrganizationResource to continue builder pattern
-     */
-    public OrganizationResource  org(final String orgName){
-        return new OrganizationResource( orgName,context,  this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
deleted file mode 100644
index 4b88cf8..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SetupResource.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-
-
-/**
- * Functions as the endpoint for all resources that hit /system/ * /setup
- */
-public class SetupResource extends NamedResource {
-
-    public SetupResource( final ClientContext context, final UrlResource parent ) {
-        super("setup",context,parent);
-    }
-
-    public Entity get(QueryParameters queryParameters){
-
-        WebResource resource = getResource();
-        resource = addParametersToResource( resource, queryParameters );
-
-        //added httpBasicauth filter to all setup calls because they all do verification this way.
-        HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
-        resource.addFilter( httpBasicAuthFilter );
-
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                                .get( Entity.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
deleted file mode 100644
index ee70942..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/SystemResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- * Handles making rest calls to system resources.
- */
-public class SystemResource extends NamedResource {
-
-    public SystemResource(final ClientContext context, final UrlResource parent ) {
-        super( "system",context, parent );
-    }
-
-    //Dirty hack for path resource in new branch of two-dot-o
-    public SystemResource(final String name,final ClientContext context, final UrlResource parent ) {
-        super( name,context, parent );
-    }
-
-
-    public DatabaseResource database() {
-        return new DatabaseResource(context, this);
-    }
-
-    public SystemResource addToPath( String pathPart ) {
-        return new SystemResource( pathPart, context, this );
-    }
-
-    public ApiResponse put(){
-        ApiResponse
-            response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                                        .put(ApiResponse.class);
-        return response;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/TokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/TokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/TokenResource.java
deleted file mode 100644
index 9ecbadc..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/TokenResource.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import com.sun.jersey.api.client.WebResource;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-/**
- * Classy class class.
- */
-public class TokenResource extends NamedResource {
-    public TokenResource(final ClientContext context, final UrlResource parent) {
-        super("token", context, parent);
-    }
-
-
-    /**
-     * Obtains an access token and sets the token for the context to use in later calls
-     *
-     * @return
-     */
-    public Token post(QueryParameters params) {
-        WebResource resource = getResource(false);
-        resource = addParametersToResource(resource, params);
-        Token token = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
-            .get(Token.class);
-
-        this.context.setToken(token);
-        return token;
-    }
-
-    /**
-     * Obtains an access token and sets the token for the context to use in later calls
-     *
-     * @return
-     */
-    public Token post() {
-        Token token = getResource().accept(MediaType.APPLICATION_JSON).post(Token.class);
-        this.context.setToken(token);
-        return token;
-    }
-
-    /**
-     * Obtains an access token and sets the token for the context to use in later calls
-     *
-     * @param token
-     * @return
-     */
-    public Token post(Token token) {
-        token = getResource(false).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).post(Token.class, token);
-        this.context.setToken(token);
-        return token;
-    }
-
-    public TokenResource setToken(Token token) {
-        this.context.setToken(token);
-        return this;
-    }
-
-    public TokenResource clearToken() {
-        this.context.setToken(null);
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UrlResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UrlResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UrlResource.java
deleted file mode 100644
index fc3b31f..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UrlResource.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints;
-
-
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * Interface that returns the path that is currently being pointed to.
- */
-public interface UrlResource {
-
-    /**
-     * Get the url path to this resource
-     * example: http://localhost:8080/management/orgs/<org_name>
-     * @return
-     */
-    public String getPath();
-
-    /**
-     * Get the resource
-     * @return
-     */
-    public WebResource getResource();
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/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
deleted file mode 100644
index 1e8f1f1..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import javax.ws.rs.core.MediaType;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-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;
-import org.apache.usergrid.rest.test.resource2point0.model.*;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-
-/**
- * Classy class class.
- */
-public class ApplicationResource extends NamedResource {
-
-    private static final Logger logger = LoggerFactory.getLogger(ApplicationResource.class);
-
-    ObjectMapper mapper = new ObjectMapper();
-
-    public ApplicationResource(ClientContext context, UrlResource parent) {
-        super("applications", context, parent);
-    }
-
-    public ApplicationResource( final String name, final ClientContext context, final UrlResource parent ) {
-        super( name, context, parent );
-    }
-
-    public ApplicationResource addToPath( String pathPart ) {
-        return new ApplicationResource( pathPart, context, this );
-    }
-
-
-    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) {
-
-        String responseString = getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(MediaType.APPLICATION_JSON)
-            .post(String.class, payload);
-
-        logger.debug("Response from post: " + responseString);
-
-        ApiResponse response;
-        try {
-            response = mapper.readValue(new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return new Entity(response);
-    }
-
-
-    public Entity get() {
-
-        String responseString = getResource(true)
-            .type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(MediaType.APPLICATION_JSON)
-            .get(String.class);
-
-        logger.debug("Response from post: " + responseString);
-
-        ApiResponse response;
-        try {
-            response = mapper.readValue(new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        return new Entity(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationsResource.java
deleted file mode 100644
index f789272..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationsResource.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-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.state.ClientContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.io.StringReader;
-
-
-/**
- * Management end-point for getting list of applications in organization.
- */
-public class ApplicationsResource extends NamedResource {
-    private static final Logger logger = LoggerFactory.getLogger(ApplicationsResource.class);
-    ObjectMapper mapper = new ObjectMapper();
-
-    public ApplicationsResource( final ClientContext context, final UrlResource parent ) {
-        super( "apps", context, parent );
-    }
-
-    public ManagementResponse getOrganizationApplications() throws IOException {
-
-        String responseString = this.getResource()
-            .queryParam( "access_token", context.getToken().getAccessToken() )
-            .type(MediaType.APPLICATION_JSON)
-            .get(String.class);
-
-        logger.info("Response: " + responseString);
-
-        return mapper.readValue(
-            new StringReader(responseString), ManagementResponse.class);
-    }
-
-
-
-    public ApplicationResource app( final String appName ){
-        return new ApplicationResource( appName,context,this );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/AuthorizeResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/AuthorizeResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/AuthorizeResource.java
deleted file mode 100644
index 7dd820b..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/AuthorizeResource.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import com.sun.jersey.api.client.GenericType;
-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.state.ClientContext;
-
-/**
- * OAuth authorization resource
- */
-public class AuthorizeResource extends NamedResource {
-    public AuthorizeResource(final ClientContext context, final UrlResource parent) {
-        super("authorize", context, parent);
-    }
-
-    /**
-     * Obtains an OAuth authorization
-     *
-     * @param requestEntity
-     * @return
-     */
-    public Object post(Object requestEntity) {
-        return getResource().post(Object.class, requestEntity);
-
-    }
-
-    /**
-     * Obtains an OAuth authorization
-     *
-     * @param type
-     * @param requestEntity
-     * @return
-     */
-    public <T> T post(Class<T> type, Object requestEntity) {
-        GenericType<T> gt = new GenericType<>((Class) type);
-        return getResource().post(gt.getRawClass(), requestEntity);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ConfirmResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ConfirmResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ConfirmResource.java
deleted file mode 100644
index 5692dfe..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ConfirmResource.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * For confirming users
- */
-public class ConfirmResource extends NamedResource {
-    public ConfirmResource( final ClientContext context, final UrlResource parent ) {
-        super( "confirm", context, parent );
-    }
-
-    public void get(QueryParameters queryParameters){
-        WebResource resource = getResource();
-        resource = addParametersToResource( resource, queryParameters );
-        String obj = resource.type( MediaType.TEXT_HTML_TYPE )
-                                       .accept( MediaType.TEXT_HTML).get( String.class );
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/CredentialsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/CredentialsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/CredentialsResource.java
deleted file mode 100644
index ee83b2e..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/CredentialsResource.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import com.sun.jersey.api.client.WebResource;
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Credentials;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-/**
- */
-public class CredentialsResource extends NamedResource {
-
-    public CredentialsResource(final ClientContext context, final UrlResource parent) {
-        super("credentials", context, parent);
-    }
-
-    public Credentials get(final QueryParameters parameters, final boolean useToken) {
-        WebResource resource = getResource(useToken);
-        resource = addParametersToResource(resource, parameters);
-        ApiResponse response = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
-            .get(ApiResponse.class);
-        return new Credentials(response);
-    }
-
-    public Credentials get(final QueryParameters parameters) {
-        return get(parameters, true);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/FeedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/FeedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/FeedResource.java
deleted file mode 100644
index 3435afe..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/FeedResource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Collection;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- * Contains the REST methods to interacting with the ManagementEndpoints
- * and the user feeds
- */
-public class FeedResource extends NamedResource {
-    public FeedResource(final ClientContext context, final UrlResource parent) {
-        super ( "feed",context, parent);
-    }
-
-    public ApiResponse get() {
-        return getResource( true ).type( MediaType.APPLICATION_JSON_TYPE )
-            .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class);
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResource.java
deleted file mode 100644
index 6b27473..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResource.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import org.apache.usergrid.rest.test.resource2point0.endpoints.*;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-
-/**
- * Contains the REST methods to interacting with the ManagementEndpoints
- */
-public class ManagementResource extends NamedResource {
-    public ManagementResource( final ClientContext context, final UrlResource parent ) {
-        super( "management", context, parent );
-    }
-
-    public TokenResource token(){
-        return new TokenResource( context, this );
-    }
-
-    public MeResource me(){
-        return new MeResource( context, this );
-    }
-
-    public AuthorizeResource authorize(){
-        return new AuthorizeResource( context, this );
-    }
-
-    public OrgResource orgs() {
-        return new OrgResource( context, this );
-    }
-
-    public UsersResource users() {
-        return new UsersResource( context, this );
-    }
-
-    public EntityEndpoint externaltoken(){
-        return new EntityEndpoint("externaltoken",context,this);
-    }
-
-    public EntityEndpoint get(final String identifier){
-        return new EntityEndpoint(identifier, context, this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResponse.java
deleted file mode 100644
index b5cd751..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ManagementResponse.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import java.util.Map;
-
-
-/**
- * Represents response from management end-points.
- */
-public class ManagementResponse {
-    private String action;
-    private Map<String, Object> data;
-    private long timestamp;
-    private long duration;
-    private String uri;
-
-    public long getDuration() {
-        return duration;
-    }
-
-    public void setDuration(long duration) {
-        this.duration = duration;
-    }
-
-    public long getTimestamp() {
-        return timestamp;
-    }
-
-    public void setTimestamp(long timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    public Map<String, Object> getData() {
-        return data;
-    }
-
-    public void setData(Map<String, Object> data) {
-        this.data = data;
-    }
-
-    public String getAction() {
-        return action;
-    }
-
-    public void setAction(String action) {
-        this.action = action;
-    }
-
-    public String getUri() {
-        return uri;
-    }
-
-    public void setUri(String uri) {
-        this.uri = uri;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/MeResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/MeResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/MeResource.java
deleted file mode 100644
index 4b3c042..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/MeResource.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-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.state.ClientContext;
-
-
-/**
- * Calls the management/me endpoints
- */
-public class MeResource extends NamedResource {
-    public MeResource( final ClientContext context, final UrlResource parent ) {
-        super( "me", context, parent );
-    }
-
-    public TokenResource token(){
-        return new TokenResource(context,this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
deleted file mode 100644
index 9f99e25..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrgResource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import javax.ws.rs.core.MediaType;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.model.User;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-import com.sun.jersey.api.representation.Form;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-
-//TODO: add error checking to each of the REST calls.
-/**
- * Manages the Management/ORG endpoint.
- */
-public class OrgResource  extends NamedResource {
-    private static final Logger logger = LoggerFactory.getLogger(OrgResource.class);
-
-    public OrgResource( final ClientContext context, final UrlResource parent ) {
-        super( "organizations", context, parent );
-    }
-
-
-    public OrganizationResource org( final String orgname ){
-        return new OrganizationResource( orgname,context,this );
-    }
-
-    /**
-     * This post is for the POST params case, where the entire call is made using queryParameters.
-     */
-    public Organization post(Form form){
-
-        // Seems like an apiresponse can't handle what gets returned from the from urlended media type
-
-        ApiResponse response = getResource().type( MediaType.APPLICATION_FORM_URLENCODED )
-            .accept(MediaType.APPLICATION_JSON)
-            .post(ApiResponse.class, form);
-
-        Organization organization = new Organization(response);
-        organization.setOwner( response );
-        return organization;
-    }
-
-    /**
-     * This post is for the POST params case, where the entire call is made using queryParameters.
-     */
-    public Organization post(QueryParameters parameters){
-
-        // Seems like an ApiResponse can't handle what gets returned from the from URL encoded media type
-        WebResource resource = addParametersToResource( getResource(), parameters);
-
-        // use string type so we can log actual response from server
-        String responseString = resource.type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON)
-            .post(String.class);
-
-        logger.debug("Response from post: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        Organization org = new Organization(response);
-        org.setOwner( response );
-
-        return org;
-    }
-
-    public Organization post(Organization organization){
-
-        // use string type so we can log actual response from server
-        String responseString = getResource(false).type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(MediaType.APPLICATION_JSON)
-            .post(String.class, organization);
-
-        logger.debug("Response from post: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        Organization org = new Organization(response);
-        org.setOwner( response );
-
-        return org;
-    }
-    public Organization post(Organization organization, Token token){
-        ApiResponse response = getResource(true,token).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                                            .post( ApiResponse.class,organization );
-
-        Organization org = new Organization(response);
-        org.setOwner( response );
-
-        return org;
-    }
-
-    public Organization put(Organization organization){
-
-        // use string type so we can log actual response from server
-        String responseString = getResource().type( MediaType.APPLICATION_JSON_TYPE )
-            .accept(MediaType.APPLICATION_JSON)
-            .put(String.class, organization);
-
-        logger.debug("Response from put: " + responseString);
-
-        ObjectMapper mapper = new ObjectMapper();
-        ApiResponse response;
-        try {
-            response = mapper.readValue( new StringReader(responseString), ApiResponse.class);
-        } catch (IOException e) {
-            throw new RuntimeException("Error parsing response", e);
-        }
-
-        Organization org = new Organization(response);
-        org.setOwner( response );
-
-        return org;
-
-    }
-
-    public Organization get(){
-        throw new UnsupportedOperationException("service doesn't exist");
-    }
-
-    public CredentialsResource credentials(){
-        return new CredentialsResource(  context ,this );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationApplicationResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationApplicationResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationApplicationResponse.java
deleted file mode 100644
index 8af9d79..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationApplicationResponse.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import java.util.Map;
-
-public class OrganizationApplicationResponse {
-    private String action;
-    private Map<String, Object> data;
-    private long timestamp;
-    private long duration;
-
-    public long getDuration() {
-        return duration;
-    }
-
-    public void setDuration(long duration) {
-        this.duration = duration;
-    }
-
-    public long getTimestamp() {
-        return timestamp;
-    }
-
-    public void setTimestamp(long timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    public Map<String, Object> getData() {
-        return data;
-    }
-
-    public void setData(Map<String, Object> data) {
-        this.data = data;
-    }
-
-    public String getAction() {
-        return action;
-    }
-
-    public void setAction(String action) {
-        this.action = action;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationResource.java
deleted file mode 100644
index 128c3ff..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/OrganizationResource.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-import java.util.Map;
-
-
-/**
- * This is for the Management endpoint.
- * Holds the information required for building and chaining organization objects to applications.
- * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
- */
-public class OrganizationResource extends NamedResource {
-
-    public OrganizationResource(final String name, final ClientContext context, final UrlResource parent) {
-        super(name, context, parent);
-    }
-
-    public UsersResource users() {
-        return new UsersResource(context, this);
-    }
-
-    public Organization get() {
-        ApiResponse rep = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).get(ApiResponse.class);
-
-        //TODO: not sure if this will work for multiple users.
-        Organization org = new Organization(rep);
-        org.setUserOwner(rep);
-        return org;
-    }
-
-    // Doesn't return anything useful server side so this was made as a void. .
-    public void put(Organization organization) {
-        Map<String, Object> response = getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
-            .accept(MediaType.APPLICATION_JSON).put(Organization.class,
-                organization);
-
-    }
-
-    public ApplicationResource app(){
-        return new ApplicationResource(  context ,this );
-    }
-
-    public CredentialsResource credentials() {
-        return new CredentialsResource(context, this);
-    }
-
-    public ApplicationsResource apps() {
-        return new ApplicationsResource( context, this );
-    }
-
-
-    public ApplicationResource addToPath( String pathPart ) {
-        return new ApplicationResource( pathPart, context, this );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/PasswordResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/PasswordResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/PasswordResource.java
deleted file mode 100644
index c9e17ee..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/PasswordResource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * Relations to the following endpoint
- * /management/users/"username"/password
- * Allows admin users to change their passwords
- */
-public class PasswordResource extends NamedResource {
-
-    public PasswordResource( final ClientContext context, final UrlResource parent ) {
-        super( "password", context, parent );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ReactivateResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ReactivateResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ReactivateResource.java
deleted file mode 100644
index 25dc95e..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ReactivateResource.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * handles the * /reactivate endpoints
- */
-public class ReactivateResource extends NamedResource {
-    public ReactivateResource(final ClientContext context, final UrlResource parent) {
-        super("reactivate",context, parent);
-    }
-
-    public Entity get(){
-        WebResource resource = getResource(true);
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class);
-        return new Entity(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ResetResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ResetResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ResetResource.java
deleted file mode 100644
index 17a3a39..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ResetResource.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import javax.ws.rs.core.MediaType;
-
-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.state.ClientContext;
-
-import com.sun.jersey.api.representation.Form;
-
-
-/**
- * Handles /resetpw endpoints for the user resource.
- */
-public class ResetResource extends NamedResource {
-
-    public ResetResource( final ClientContext context, final UrlResource parent ) {
-        super( "resetpw", context, parent );
-    }
-
-    public String post(Form formPayload) {
-        return getResource().type( MediaType.APPLICATION_FORM_URLENCODED_TYPE )
-            .accept( MediaType.TEXT_HTML ).post( String.class, formPayload);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokenResource.java
deleted file mode 100644
index dcdd432..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokenResource.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-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.state.ClientContext;
-
-
-/**
- * Handles /revokeToken endpoint ( as opposed to revokeTokens
- */
-public class RevokeTokenResource extends NamedResource {
-    public RevokeTokenResource( final ClientContext context, final UrlResource parent ) {
-        super( "revoketoken", context, parent );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokensResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokensResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokensResource.java
deleted file mode 100644
index 20796ae..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/RevokeTokensResource.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-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.state.ClientContext;
-
-
-/**
- * Handles endpoints against /revoketokens
- */
-public class RevokeTokensResource extends NamedResource {
-    public RevokeTokensResource( final ClientContext context, final UrlResource parent ) {
-        super( "revoketokens", context, parent );
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/TokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/TokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/TokenResource.java
deleted file mode 100644
index d22665d..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/TokenResource.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import com.sun.jersey.api.client.WebResource;
-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.QueryParameters;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import javax.ws.rs.core.MediaType;
-
-
-/**
- * Called by the ManagementResource. This contains anything token related that comes back to the ManagementResource.
- */
-public class TokenResource extends NamedResource {
-    public TokenResource(final ClientContext context, final UrlResource parent) {
-        super("token", context, parent);
-    }
-
-    public Token get(String username, String password){
-        QueryParameters queryParameters = new QueryParameters();
-        queryParameters.addParam( "grant_type", "password" );
-        queryParameters.addParam( "username", username );
-        queryParameters.addParam( "password", password );
-        return get(queryParameters);
-
-    }
-    /**
-     * Obtains an access token and sets the token for the context to use in later calls
-     *
-     * @return
-     */
-    public Token get(QueryParameters params) {
-        WebResource resource = getResource(false);
-        resource = addParametersToResource(resource, params);
-        Token token = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
-                              .get(Token.class);
-
-        this.context.setToken(token);
-        return token;
-    }
-
-
-    /**
-     * Convinece method to set the token needed for each call.
-     * @param token
-     * @return
-     */
-    public TokenResource setToken(Token token) {
-        this.context.setToken(token);
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UserResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UserResource.java
deleted file mode 100644
index a52d884..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UserResource.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-import javax.ws.rs.core.MediaType;
-
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * Relations to the following endpoint
- * /management/users/"username"
- * Store endpoints relating to specific users
- */
-public class UserResource extends NamedResource {
-
-    public UserResource( final String name, final ClientContext context, final UrlResource parent ) {
-        super( name, context, parent );
-    }
-
-    public ReactivateResource reactivate() {
-        return new ReactivateResource( context, this );
-    }
-
-    public ConfirmResource confirm() {
-        return new ConfirmResource(context,this);
-    }
-
-    public PasswordResource password() {
-        return new PasswordResource( context, this );
-    }
-
-    public FeedResource feed() {
-        return new FeedResource( context, this );
-    }
-
-    public ResetResource resetpw() {
-        return new ResetResource(context,this);
-    }
-
-    public OrgResource organizations() {
-        return new OrgResource( context, this );
-    }
-
-    public RevokeTokensResource revokeTokens() {
-        return new RevokeTokensResource( context, this );
-    }
-
-    public RevokeTokenResource revokeToken() {
-        return new RevokeTokenResource( context, this );
-    }
-
-    public Entity get() {
-        WebResource resource = getResource( true );
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).get( ApiResponse.class );
-        return new Entity(response);
-    }
-
-    public Entity put(Entity userPayload){
-        WebResource resource = getResource(true);
-
-        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE )
-                                       .accept( MediaType.APPLICATION_JSON ).put( ApiResponse.class, userPayload);
-        return new Entity(response);
-    }
-
-}


[2/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
deleted file mode 100644
index 18ba7d5..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/UsersResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-
-
-import javax.ws.rs.core.MediaType;
-
-import org.apache.usergrid.rest.test.resource2point0.endpoints.EntityEndpoint;
-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.ApiResponse;
-import org.apache.usergrid.rest.test.resource2point0.model.Entity;
-import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-
-import com.sun.jersey.api.client.WebResource;
-
-
-/**
- * Handles calls to the users management endpoint
- * Example: /management/orgs/org_name/users
- */
-public class UsersResource extends NamedResource {
-    public UsersResource( final ClientContext context, final UrlResource parent ) {
-        super( "users", context, parent );
-    }
-
-
-    /**
-     * Should this be here? this would facilitate calling the entity endpoint as a way to get/put things
-     * @param identifier
-     * @return
-     */
-    //TODO: See if this should be reused here or if we should rename it to something else.
-    public EntityEndpoint entity(String identifier) {
-        return new EntityEndpoint(identifier, context, this);
-    }
-
-    public UserResource user(String identifier) {
-        return new UserResource( identifier, context, this );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ActivityEntity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ActivityEntity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ActivityEntity.java
deleted file mode 100644
index 6143796..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ActivityEntity.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import org.apache.usergrid.persistence.index.utils.MapUtils;
-
-import java.util.Map;
-
-/**
- * Provide Guidance on ActivityEntity
- */
-public class ActivityEntity extends Entity {
-    public ActivityEntity(String email, String verb, String content){
-        this.chainPut("content",content).chainPut("verb",verb).chainPut("email",email);
-    }
-    public ActivityEntity() {
-        this.putAll(new MapUtils.HashMapBuilder<String, Object>());
-    }
-    public ActivityEntity(Map<String,Object> map){
-        this.putAll(map);
-    }
-
-    public ActivityEntity putActor(Map<String, Object> actorPost) {
-        this.put("actor",actorPost);
-        return this;
-    }
-
-    public Map<String, Object> getActor() {
-        return (Map<String, Object>) this.get("actor");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
deleted file mode 100644
index fc55c8b..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ApiResponse.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * Created by ApigeeCorporation on 12/4/14.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
-
-
-/**
- * Contains the needed types
- */
-public class ApiResponse {
-
-    private String accessToken;
-
-    private String error;
-    private String errorDescription;
-    private String errorUri;
-    private String exception;
-
-    private String path;
-    private String uri;
-    private Object data;
-    private String status;
-    private long timestamp;
-    private List<Entity> entities;
-    private String cursor;
-
-
-    private final Map<String, Object> properties = new HashMap<String, Object>();
-
-
-    public ApiResponse() {
-    }
-
-
-    @JsonAnyGetter
-    public Map<String, Object> getProperties() {
-        return properties;
-    }
-
-
-    @JsonAnySetter
-    public void setProperty( String key, Object value ) {
-        properties.put( key, value );
-    }
-
-
-    @JsonProperty( "access_token" )
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getAccessToken() {
-        return accessToken;
-    }
-
-
-    @JsonProperty( "access_token" )
-    public void setAccessToken( String accessToken ) {
-        this.accessToken = accessToken;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getError() {
-        return error;
-    }
-
-
-    public void setError( String error ) {
-        this.error = error;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    @JsonProperty( "error_description" )
-    public String getErrorDescription() {
-        return errorDescription;
-    }
-
-
-    @JsonProperty( "error_description" )
-    public void setErrorDescription( String errorDescription ) {
-        this.errorDescription = errorDescription;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    @JsonProperty( "error_uri" )
-    public String getErrorUri() {
-        return errorUri;
-    }
-
-
-    @JsonProperty( "error_uri" )
-    public void setErrorUri( String errorUri ) {
-        this.errorUri = errorUri;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getException() {
-        return exception;
-    }
-
-
-    public void setException( String exception ) {
-        this.exception = exception;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getPath() {
-        return path;
-    }
-
-
-    public void setPath( String path ) {
-        this.path = path;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getUri() {
-        return uri;
-    }
-
-
-    public void setUri( String uri ) {
-        this.uri = uri;
-    }
-
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getStatus() {
-        return status;
-    }
-
-
-    public void setStatus( String status ) {
-        this.status = status;
-    }
-
-
-    public long getTimestamp() {
-        return timestamp;
-    }
-
-
-    public void setTimestamp( long timestamp ) {
-        this.timestamp = timestamp;
-    }
-
-    @JsonSerialize( include = Inclusion.NON_NULL  )
-    public List<Entity> getEntities() {
-        return entities;
-    }
-
-
-    public void setEntities( List<Entity> entities ) {
-        this.entities = entities;
-    }
-
-    public List<String> list(){
-        return (List<String>)getProperties().get("list");
-    }
-
-
-    public int getEntityCount() {
-        if ( entities == null ) {
-            return 0;
-        }
-        return entities.size();
-    }
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public String getCursor() {
-        return cursor;
-    }
-
-
-    public void setCursor( String cursor ) {
-        this.cursor = cursor;
-    }
-
-    @JsonSerialize( include = Inclusion.NON_NULL )
-    public Object getData() {
-        return data;
-    }
-
-    public void setData ( Object data ) {
-        this.data = data;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Application.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Application.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Application.java
deleted file mode 100644
index 75566f2..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Application.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Classy class class.
- */
-public class Application extends Entity {
-    public Application(){  }
-
-    public Application(String name){
-        this.put("name",name);
-    }
-
-    public Application(ApiResponse response){
-        super(response);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ChangePasswordEntity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ChangePasswordEntity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ChangePasswordEntity.java
deleted file mode 100644
index 567435e..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/ChangePasswordEntity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-/**
- * Provide guidance on change passwords
- */
-public class ChangePasswordEntity extends Entity {
-    public ChangePasswordEntity( String newPassword){
-        this.chainPut("newpassword", newPassword);
-    }
-    public ChangePasswordEntity(String oldPassword, String newPassword){
-        this.chainPut("oldpassword", oldPassword).chainPut("newpassword", newPassword);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
deleted file mode 100644
index 2168e64..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Collection.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Created by ApigeeCorporation on 12/4/14.
- */
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import java.util.Iterator;
-import java.util.Map;
-
-
-/**
- * A stateful iterable collection response. Used to dole out entities in iterable form
- *
- */
-public class Collection implements Iterable<Entity>, Iterator<Entity> {
-
-
-    private String cursor;
-
-    private Iterator entities;
-
-    private ApiResponse response;
-
-    //TODO: implement way to have the collection store its own name?
-    private String name;
-
-
-
-    /**
-     * Collection usersCollection =  app.collection("users").get();
-     * while(usersCollection.hasNext()){
-     *  Entity bob = usersCollection.next();
-     *     assert("blah",bob.get("words"));
-     * }
-     * QueryParams = new QueryParams(usersCollection.cursor)
-     * app.collections("users").get(queryParams);
-     *
-     * usersCollection = app.collections("users").getNextPage(usersCollection.cursor);
-     *
-     * Use the factory method instead
-     * @param response
-     */
-    public Collection(ApiResponse response) {
-        this.response = response;
-        this.cursor = response.getCursor();
-        this.entities = response.getEntities()!=null?  response.getEntities().iterator():null;
-    }
-
-    @Override
-    public Iterator iterator() {
-        return this;
-    }
-
-
-    @Override
-    public boolean hasNext() {
-        return entities.hasNext();
-    }
-
-    public String getCursor(){
-        return cursor;
-    }
-
-
-    @Override
-    public Entity next() {
-        return new Entity( ( Map<String, Object> ) entities.next() );
-    }
-
-    @Override
-    public void remove() {
-        throw new UnsupportedOperationException( "Remove is unsupported" );
-    }
-
-    public int getNumOfEntities(){
-        return response.getEntityCount();
-    }
-
-    public ApiResponse getResponse(){return response;}
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
deleted file mode 100644
index 57f85b1..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Credentials.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import java.util.Map;
-
-/**
- */
-public class Credentials extends Entity {
-    public Credentials() {
-    }
-
-    public Credentials(ApiResponse response) {
-        setResponse(response, "credentials");
-    }
-
-    public Credentials mapOrgResponse(Map<String, Object> map) {
-        putAll((Map<String, Object>) map.get("credentials"));
-        return this;
-    }
-
-    public String getClientSecret() {
-        return (String) get("client_secret");
-    }
-
-    public String getClientId() {
-        return (String) get("client_id");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Entity.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Entity.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Entity.java
deleted file mode 100644
index 89bf092..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Entity.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import java.io.Serializable;
-import java.util.*;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import static org.apache.usergrid.persistence.Schema.PROPERTY_NAME;
-
-
-/**
- * Contains a model that can be deconstructed from the api response. This is a base level value that contains the bare
- * minumum of what other classes use. Such as . users or groups.
- */
-public class Entity implements Serializable, Map<String,Object> {
-
-
-    protected Map<String, Object> dynamic_properties = new TreeMap<String, Object>( String.CASE_INSENSITIVE_ORDER );
-
-    ApiResponse response;
-
-    public Entity(){}
-
-    public Entity (Map<String,Object> payload){
-        this.putAll(payload);
-    }
-
-    public Entity(ApiResponse response){
-        this.response = response;
-
-        if(response.getEntities() != null &&  response.getEntities().size()>=1){
-            List<Entity>  entities =  response.getEntities();
-            Map<String,Object> entity = entities.get(0);
-            this.putAll(entity);
-        }
-        else if (response.getData() != null){
-
-            if(response.getData() instanceof  LinkedHashMap) {
-                LinkedHashMap dataResponse = ( LinkedHashMap ) response.getData();
-
-                if(dataResponse.get( "user" )!=null){
-                    this.putAll( ( Map<? extends String, ?> ) dataResponse.get( "user" ) );
-                }
-                else{
-                    this.putAll( dataResponse );
-                }
-            }
-            else if (response.getData() instanceof ArrayList){
-                ArrayList<String> data = ( ArrayList<String> ) response.getData();
-                Entity entity = new Entity();
-                entity.put( "data", data.get( 0 ) );
-                this.putAll( entity );
-            }
-        }
-        //TODO: added bit for import tests and other tests that only put a single thing into properties
-        else if (response.getProperties() != null){
-            this.putAll( response.getProperties() );
-        }
-    }
-
-    //For the owner , should have different cases that looks at the different types it could be
-    protected Entity setResponse(final ApiResponse response, String key) {
-        LinkedHashMap linkedHashMap = (LinkedHashMap) response.getData();
-
-        if(linkedHashMap == null){
-            linkedHashMap =  new LinkedHashMap( response.getProperties());
-        }
-
-        this.putAll((Map<? extends String, ?>) linkedHashMap.get(key));
-
-        return this;
-    }
-
-    public void setProperties( Map<String, Object> properties ) {
-        putAll( properties );
-    }
-
-    public Map<String, Object> getDynamicProperties() {
-        return dynamic_properties;
-    }
-
-    @Override
-    public int size() {
-        return getDynamicProperties().size();
-    }
-
-
-    @Override
-    public boolean isEmpty() {
-        return getDynamicProperties().isEmpty();
-    }
-
-
-    @Override
-    public boolean containsKey( final Object key ) {
-        return getDynamicProperties().containsKey( key );
-    }
-
-
-    @Override
-    public boolean containsValue( final Object value ) {
-        return getDynamicProperties().containsValue( value );
-    }
-
-
-    @Override
-    public Object get( final Object key ) {
-        //All values are strings , so doing the cast here saves doing the cast elsewhere
-        return getDynamicProperties().get( key );
-    }
-
-    public Map<String, Map<String, Object>> getMap(Object key){
-        return (LinkedHashMap<String, Map<String, Object>>) getDynamicProperties().get( key );
-    }
-
-    public String getAsString( final Object key ) {
-        //All values are strings , so doing the cast here saves doing the cast elsewhere
-        return (String) getDynamicProperties().get( key );
-    }
-
-    public String getError () {
-        return (String) this.get("error");
-    }
-
-    public String getErrorCode () {
-        return (String)this.get("errorCode");
-    }
-
-    public String getErrorDescription () {
-        return (String) this.get("errorDescription");
-    }
-
-    @Override
-    public Object put( final String key, final Object value ) {
-        return getDynamicProperties().put( key,value );
-    }
-
-
-    @Override
-    public Object remove( final Object key ) {
-        return getDynamicProperties().remove( key );
-    }
-
-
-    @Override
-    public void putAll( final Map<? extends String, ?> m ) {
-        getDynamicProperties().putAll( m );
-    }
-
-
-    @Override
-    public void clear() {
-        getDynamicProperties().clear();
-    }
-
-
-    @Override
-    public Set<String> keySet() {
-        return getDynamicProperties().keySet();
-    }
-
-
-    @Override
-    public java.util.Collection<Object> values() {
-        return getDynamicProperties().values();
-    }
-
-
-    @Override
-    public Set<Entry<String, Object>> entrySet() {
-        return getDynamicProperties().entrySet();
-    }
-
-    public UUID getUuid(){
-        return UUID.fromString( ( String ) get( "uuid" ) );
-    }
-
-    public Entity chainPut(final String key, final Object value){
-        put(key,value);
-        return this;
-    }
-
-    public Entity withProp(final String key, final Object value){
-        put(key,value);
-        return this;
-    }
-
-    public ApiResponse getResponse(){
-        return response;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
deleted file mode 100644
index f9e1b84..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Organization.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-
-/**
- * Holds the parsed out information of the Organization returned from the ApiResponse.
- * so when you get the organization object, we could then model it out to do the client calls
- */
-public class Organization extends Entity {
-
-    private User user;
-
-    public Organization() {
-
-    }
-
-    public Organization( String orgName, String username, String email, String ownerName, String password, Map<String,Object> properties ){
-
-        this.put( "organization", orgName );
-        this.put( "username", username);
-        this.put( "email", email);
-        //TODO: create clearer distinction between ownerName and username in the backend.
-        this.put( "name", ownerName);
-        this.put( "password", password);
-
-        if(properties != null)
-            setProperties( properties );
-    }
-
-    public Organization(ApiResponse response){
-        setResponse( response, "organization" );
-    }
-
-    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
-    public String getOrganization( ) {
-        return ( String ) this.get( "organization" );
-    }
-
-    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
-    public String getUsername() {
-        return ( String ) this.get( "username" );
-    }
-
-    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
-    public String getEmail() {
-        return ( String ) this.get( "email" );
-    }
-
-    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
-    public String getName() {
-        return ( String ) this.get( "name" );
-    }
-
-    @JsonSerialize( include = JsonSerialize.Inclusion.NON_NULL )
-    public String getPassword() {
-        return ( String ) this.get( "password" );
-    }
-
-    public Object getPasswordHistorySize() {
-        return  (Integer) this.get("passwordHistorySize");
-    }
-
-    public User getOwner(){
-        return user;
-    }
-
-    public void setOwner(ApiResponse response){
-        setOwner( response, "owner" );
-    }
-
-    public void setOwner(ApiResponse response, String nameOverride){
-        this.user = new User( response, nameOverride);
-    }
-
-    public Map<String,Object> getProperties(){
-        return (Map) this.get( "properties" );
-    }
-
-    /**
-     * Created specifically so that we could set the organization owner to the Organization model from a get Organization
-     * call. This call is hidden a few layers below and stored in the properties.
-     * @param response
-     */
-    public void setUserOwner(ApiResponse response){
-        LinkedHashMap orgHashMap = ( LinkedHashMap ) response.getProperties().get( "organization" );
-        LinkedHashMap userHashMap = (LinkedHashMap) orgHashMap.get( "users" );
-        //this gets the first value in the users entities and returns it .
-        if(userHashMap.keySet().iterator().hasNext())
-            this.user = new User( ( Map<String, Object> ) userHashMap.get( userHashMap.keySet().iterator().next() ) );
-        //new User().mapOrgGetResponse(orgHashMap.get( "users" ));
-    }
-
-    public Organization mapOrgResponse(Map<String,Object> map){
-        putAll((Map<String, Object>) map.get("organization"));
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/QueryParameters.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/QueryParameters.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/QueryParameters.java
deleted file mode 100644
index 5cf29f7..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/QueryParameters.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.usergrid.services.ServiceParameter;
-
-
-/**
- * Classy class class.
- */
-public class QueryParameters {
-    private String query;
-    private String cursor;
-    private UUID start;
-    private Integer limit;
-    private Map<String,String> formPostData = new HashMap<String,String>(  );
-
-    public QueryParameters() {
-    }
-
-    public UUID getStart() {
-        return start;
-    }
-
-    public QueryParameters setStart(UUID start) {
-        this.start = start;
-        return this;
-    }
-
-    public String getCursor() {
-        return cursor;
-    }
-
-    public QueryParameters setCursor(String cursor) {
-        this.cursor = cursor;
-        return this;
-    }
-
-    public String getQuery() {
-        return query;
-    }
-
-    public QueryParameters setQuery(String query) {
-        this.query = query;
-        return this;
-    }
-
-    public Integer getLimit() {
-        return limit;
-    }
-
-    public QueryParameters setLimit(int limit) {
-        this.limit = new Integer(limit);
-        return this;
-    }
-
-    public Map<String,String> getFormPostData(){
-        return formPostData;
-    }
-
-    public QueryParameters setKeyValue(String key, String value){
-        this.formPostData.put(key,value);
-        return this;
-    }
-
-
-    public QueryParameters addParam(String key, String value) {
-        formPostData.put(key,value);
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Token.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Token.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Token.java
deleted file mode 100644
index a63525f..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/Token.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-
-import java.util.LinkedHashMap;
-
-/**
- * Token model that contains the operations that can be done on a token.
- */
-public class Token extends Entity {
-
-    private User user;
-
-    public Token() {
-
-    }
-
-    public Token(String username, String password) {
-        this.put("grant_type", "password");
-        this.put("username", username);
-        this.put("password", password);
-    }
-
-    /**
-     * Constructor for admin/application user ( difference is in the path )
-     *
-     * @param grantType
-     * @param username
-     * @param password
-     */
-    public Token(String grantType, String username, String password) {
-        this.put("grant_type", grantType);
-        if ("client_credentials".equals(grantType)) {
-            this.put("client_id", username);
-            this.put("client_secret", password);
-        } else {
-            this.put("username", username);
-            this.put("password", password);
-        }
-    }
-
-    public String getAccessToken() {
-        return (String) this.get("access_token");
-    }
-
-    public String getGrantType() {
-        return (String) this.get("grant_type");
-    }
-
-    public Long getExpirationDate() {
-        return ((Integer) this.get("expires_in")).longValue();
-    }
-
-    public Long getPasswordChanged() {
-        return (Long) this.get("passwordChanged");
-    }
-
-    public void setUser(User user) {
-        this.user = user;
-    }
-
-    public User getUser() {
-        return user != null ? user : new User((LinkedHashMap) get("user"));
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/User.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/User.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/User.java
deleted file mode 100644
index 9b48d78..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/model/User.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.model;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-
-/**
- * Models the user class for response from REST calls.
- */
-public class User extends Entity {
-
-
-    public User(){}
-    /**
-     * This could also be a user
-     * @param response
-     */
-
-    public User (ApiResponse response, String dataName){
-        setResponse( response, dataName );
-    }
-
-    //TODO: create another constructor to take in the nessesary things to post to a user.
-
-    public User(String username, String name, String email, String password){
-        this.put( "username",username );
-        this.put( "name", name);
-        this.put( "email", email);
-        this.put( "password", password);
-    }
-
-    public User(Map<String,Object> map){
-        this.putAll( map );
-    }
-
-    public Boolean getActivated(){
-        return (Boolean) this.get( "activated" );
-    }
-
-    public Boolean getAdminUser(){
-        return (Boolean) this.get( "adminUser" );
-    }
-
-    public UUID getApplicationId(){
-        return  UUID.fromString( (String) get("applicationId") );
-    }
-
-    public Boolean getConfirmed(){
-        return (Boolean) this.get("confirmed");
-    }
-
-    public Boolean getDisabled(){
-        return (Boolean) this.get("disabled");
-    }
-
-    public String getDisplayEmailAddress(){
-        return (String) this.get("displayEmailAddress");
-    }
-
-    public String getEmail(){
-        return (String) this.get("email");
-    }
-
-    public String getHtmlDisplayEmailAddress(){
-        return (String) this.get("htmldisplayEmailAddress");
-    }
-
-    public String getName(){
-        return (String) this.get("name");
-    }
-
-    public Map<String,Object> getProperties(){
-        return (Map<String,Object>) this.get("properties");
-    }
-
-    public String getUsername(){
-        return (String) this.get("username");
-    }
-
-    public UUID getUuid(){
-        return UUID.fromString( (String) get("uuid") );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/state/ClientContext.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/state/ClientContext.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/state/ClientContext.java
deleted file mode 100644
index 3a0e280..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/state/ClientContext.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource2point0.state;
-
-
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
-
-
-/**
- * Context to hold client stateful information
- * This includes token,orgName and uuid, appName and uuid, and user information
- */
-public class ClientContext {
-    private Token token;
-
-    public Token getToken() {
-        return token;
-    }
-
-
-    public void setToken( final Token token ) {
-        this.token = token;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAdminUser.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAdminUser.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAdminUser.java
deleted file mode 100644
index c68947c..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAdminUser.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.security;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.TestContext;
-
-
-/** @author tnine */
-public class TestAdminUser extends TestUser {
-
-    /**
-     * @param user
-     * @param password
-     * @param email
-     */
-    public TestAdminUser( String user, String password, String email ) {
-        super( user, password, email );
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.security.TestUser#getToken(java.lang.String, java.lang.String,
-     * org.apache.usergrid.rest.test.resource.TestContext)
-     */
-    @Override
-    protected String getToken( TestContext context ) {
-        try {
-            return context.management().tokenGet( user, password );
-        } catch (IOException ex) {
-            throw new RuntimeException("Cannot parse JSON data", ex);
-        }
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.security.TestUser#create(org.apache.usergrid.rest.test.resource.TestContext)
-     */
-    @Override
-    protected JsonNode createInternal( TestContext context ) {
-        try {
-            return context.application().users().create( user, email, password );
-        } catch (IOException ex) {
-            throw new RuntimeException("Error reading JSON data", ex);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAppUser.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAppUser.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAppUser.java
deleted file mode 100644
index f4b700a..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestAppUser.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.security;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.TestContext;
-
-
-/** @author tnine */
-public class TestAppUser extends TestUser {
-
-    /**
-     * @param user
-     * @param password
-     * @param email
-     */
-    public TestAppUser( String user, String password, String email ) {
-        super( user, password, email );
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.security.TestUser#getToken(java.lang.String, java.lang.String,
-     * org.apache.usergrid.rest.test.resource.TestContext)
-     */
-    @Override
-    protected String getToken( TestContext context ) {
-        try {
-            return context.application().token( user, password );
-        } catch (IOException ex) {
-            throw new RuntimeException("Error parsing JSON", ex);
-        }
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.rest.test.security.TestUser#create(org.apache.usergrid.rest.test.resource.TestContext)
-     */
-    @Override
-    protected JsonNode createInternal( TestContext context ) {
-        try {
-            return context.application().users().create( user, email, password );
-        } catch (IOException ex) {
-            throw new RuntimeException("Error parsing JSON", ex);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestUser.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestUser.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestUser.java
deleted file mode 100644
index 4d49914..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/security/TestUser.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.security;
-
-
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.rest.test.resource.TestContext;
-
-
-/** @author tnine */
-public abstract class TestUser {
-
-    protected String user;
-    protected String password;
-    protected String email;
-    protected String token;
-    protected UUID uuid;
-
-
-    /**
-     * @param user
-     * @param password
-     * @param email
-     */
-    public TestUser( String user, String password, String email ) {
-        super();
-        this.user = user;
-        this.password = password;
-        this.email = email;
-    }
-
-
-    /** Log in the type */
-    public TestUser login( TestContext context ) {
-        if ( token == null ) {
-            token = getToken( context );
-        }
-
-        return this;
-    }
-
-
-    /**
-     * Manually set our token for this user.
-     * @param token
-     */
-    public void setToken(String token){
-        this.token = token;
-    }
-
-    /** Log out */
-    public void logout() {
-        token = null;
-    }
-
-
-    /** @return the user */
-    public String getUser() {
-        return user;
-    }
-
-
-    /** @return the password */
-    public String getPassword() {
-        return password;
-    }
-
-
-    /** @return the email */
-    public String getEmail() {
-        return email;
-    }
-
-
-    public String getToken() {
-        return this.token;
-    }
-
-
-    /** @return the uuid */
-    public UUID getUuid() {
-        return uuid;
-    }
-
-    public void setUUID(UUID uuid) {
-        this.uuid = uuid;
-    }
-
-    public boolean isLoggedIn() {
-        return this.token != null;
-    }
-
-
-    /** Create this user */
-    public TestUser create( TestContext context ) {
-        JsonNode node = createInternal( context );
-
-        uuid = UUID.fromString( node.findValue( "uuid" ).asText() );
-
-        return this;
-    }
-
-
-    /** Make this user active in the context */
-    public TestUser makeActive( TestContext context ) {
-        context.withUser( this );
-        return this;
-    }
-
-
-    protected abstract JsonNode createInternal( TestContext context );
-
-    protected abstract String getToken( TestContext context );
-}


[6/9] incubator-usergrid git commit: remove old test framework

Posted by to...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/GroupsCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/GroupsCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/GroupsCollection.java
deleted file mode 100644
index 0f49dcc..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/GroupsCollection.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.Me;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author rockerston */
-public class GroupsCollection extends CollectionResource {
-
-
-    public GroupsCollection( NamedResource parent ) {
-        super( "groups", parent );
-    }
-
-
-    public Group group( String username ) {
-        return new Group( username, this );
-    }
-
-
-    public Group group( UUID id ) {
-        return new Group( id, this );
-    }
-
-
-    /** Create the group */
-    public JsonNode create( String path, String title ) throws IOException {
-        Map<String, String> data =
-                MapUtils.hashMap( "path", path ).map( "title", title );
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-
-
-
-    public Me me() {
-        return new Me( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Role.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Role.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Role.java
deleted file mode 100644
index b60ef56..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Role.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.app.queue.DevicesCollection;
-
-
-/**
- * A resource for testing queues
- *
- * @author rockerston
- */
-public class Role
-        extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public Role( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public Role( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-
-
-    public DevicesCollection devices() {
-        return new DevicesCollection( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/RolesCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/RolesCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/RolesCollection.java
deleted file mode 100644
index dd3e737..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/RolesCollection.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.Me;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author rockerston */
-public class RolesCollection extends CollectionResource {
-
-
-    public RolesCollection( NamedResource parent ) {
-        super( "roles", parent );
-    }
-
-
-    public Role role( String name ) {
-        return new Role( name, this );
-    }
-
-
-    public Role role( UUID id ) {
-        return new Role( id, this );
-    }
-
-
-    /** Create the role */
-    public JsonNode create( String name, String title ) throws IOException {
-        Map<String, String> data =
-                MapUtils.hashMap( "name", name ).map( "title", title );
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-
-    public Me me() {
-        return new Me( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/User.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/User.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/User.java
deleted file mode 100644
index 0b261ee..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/User.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.UUID;
-
-import org.apache.usergrid.rest.test.resource.EntityResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.app.queue.DevicesCollection;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class User extends EntityResource {
-
-    /**
-     * @param entityId
-     * @param parent
-     */
-    public User( UUID entityId, NamedResource parent ) {
-        super( entityId, parent );
-    }
-
-
-    /**
-     * @param entityName
-     * @param parent
-     */
-    public User( String entityName, NamedResource parent ) {
-        super( entityName, parent );
-    }
-
-
-    public DevicesCollection devices() {
-        return new DevicesCollection( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
deleted file mode 100644
index d7b4293..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.Me;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.utils.MapUtils;
-
-
-/** @author tnine */
-public class UsersCollection extends Collection {
-
-
-    public UsersCollection( NamedResource parent ) {
-        super( "users", parent );
-    }
-
-
-    public User user( String username ) {
-        return new User( username, this );
-    }
-
-
-    public User user( UUID id ) {
-        return new User( id, this );
-    }
-
-
-    /** Create the user */
-    public JsonNode post( String username, String email, String password ) throws IOException {
-        Map<String, String> data =
-                MapUtils.hashMap( "username", username ).map( "email", email ).map( "password", password );
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-    /** Create the user */
-    public JsonNode post( String username, String email, String password, Map entityData ) throws IOException {
-        Map<String, String> data =
-                MapUtils.hashMap( "username", username ).map( "email", email ).map( "password", password );
-        data.putAll(entityData);
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-
-    /** Create the user */
-    //TODO: delete create method once rest calls are implemented
-    public JsonNode create( String username, String email, String password ) throws IOException {
-        Map<String, String> data =
-                MapUtils.hashMap( "username", username ).map( "email", email ).map( "password", password );
-
-        JsonNode response = this.postInternal( data );
-
-        return getEntity( response, 0 );
-    }
-
-    public Me me() {
-        return new Me( this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/DevicesCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/DevicesCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/DevicesCollection.java
deleted file mode 100644
index b02ab3e..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/DevicesCollection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.ValueResource;
-import org.apache.usergrid.rest.test.resource.app.Device;
-
-
-/** @author tnine */
-public class DevicesCollection extends ValueResource {
-
-
-    public DevicesCollection( NamedResource parent ) {
-        super( "devices", parent );
-    }
-
-
-    public Device device( String deviceName ) {
-        return new Device( deviceName, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Queue.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Queue.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Queue.java
deleted file mode 100644
index aa2c060..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Queue.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import java.util.List;
-import java.util.Map;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-
-import com.sun.jersey.api.client.WebResource;
-import java.io.IOException;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class Queue extends CollectionResource {
-
-    private String clientId;
-    private int limit = 0;
-    private long timeout = 0;
-    private String position;
-    private String last;
-    private String[] filters = { };
-
-
-    /**
-     *
-     */
-    public Queue( String queueName, NamedResource parent ) {
-        super( queueName, parent );
-    }
-
-
-    /** Set the client id with the string */
-    public Queue withClientId( String clientId ) {
-        this.clientId = clientId;
-        return this;
-    }
-
-
-    /** Set this with the next page size */
-    public Queue withLimit( int limit ) {
-        this.limit = limit;
-        return this;
-    }
-
-
-    public Queue withPosition( String position ) {
-        this.position = position;
-        return this;
-    }
-
-
-    public Queue withLast( String last ) {
-        this.last = last;
-        return this;
-    }
-
-
-    public Queue withTimeout( long timeout ) {
-        this.timeout = timeout;
-        return this;
-    }
-
-
-    public Queue withFilters( String... filters ) {
-        this.filters = filters;
-        return this;
-    }
-
-
-    /**
-     * @return
-     */
-    public SubscribersCollection subscribers() {
-        return new SubscribersCollection( this );
-    }
-
-
-    /**
-     * @return
-     */
-    public TransactionsCollection transactions() {
-        return new TransactionsCollection( this );
-    }
-
-
-    public JsonNode post( Map<String, ?> payload ) throws IOException {
-        JsonNode node = super.postInternal( payload );
-        return node;
-    }
-
-
-    /**
-     *
-     * @param payload
-     * @return
-     */
-    public JsonNode post( Map<String, ?>[] payload ) throws IOException {
-        JsonNode node = super.postInternal( payload );
-        return node;
-    }
-
-
-    /** Get entities in this collection. Cursor is optional */
-    public JsonNode get() {
-        try {
-            return mapper.readTree( jsonMedia( withQueueParams( withToken( resource() ) ) ).get( String.class ));
-        } catch (IOException ex) {
-            throw new RuntimeException("Cannot parse JSON data", ex);
-        }
-    }
-
-
-    /** post to the entity set */
-    public JsonNode delete() {
-        try {
-            return mapper.readTree( jsonMedia( withToken( resource() ) ).delete( String.class ));
-        } catch (IOException ex) {
-            throw new RuntimeException("Cannot parse JSON data", ex);
-        }
-    }
-
-
-    /** Set the queue client ID if set */
-    private WebResource withQueueParams( WebResource resource ) {
-        if ( clientId != null ) {
-            resource = resource.queryParam( "consumer", clientId );
-        }
-        if ( position != null ) {
-            resource = resource.queryParam( "pos", position );
-        }
-        if ( last != null ) {
-            resource = resource.queryParam( "last", last );
-        }
-
-        if ( limit > 0 ) {
-            resource = resource.queryParam( "limit", String.valueOf( limit ) );
-        }
-
-        if ( timeout > 0 ) {
-            resource = resource.queryParam( "timeout", String.valueOf( timeout ) );
-        }
-
-        for ( String filter : filters ) {
-            resource = resource.queryParam( "filter", filter );
-        }
-
-        return resource;
-    }
-
-
-    /** Get the next entry in the queue. Returns null if one doesn't exist */
-    public JsonNode getNextEntry() {
-        List<JsonNode> messages = getNodesAsList( "messages", get() );
-
-        return messages.size() == 1 ? messages.get( 0 ) : null;
-    }
-
-
-    /** Get the json response of the messages nodes */
-    public List<JsonNode> getNextPage() {
-        JsonNode response = get();
-
-        JsonNode last = response.get( "last" );
-
-        if ( last != null ) {
-            this.last = last.asText();
-        }
-
-        return getNodesAsList( "messages", response );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/QueuesCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/QueuesCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/QueuesCollection.java
deleted file mode 100644
index 3c6704d..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/QueuesCollection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.ValueResource;
-
-
-/** @author tnine */
-public class QueuesCollection extends ValueResource {
-
-
-    public QueuesCollection( NamedResource parent ) {
-        super( "queues", parent );
-    }
-
-
-    public Queue queue( String queueName ) {
-        return new Queue( queueName, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/SubscribersCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/SubscribersCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/SubscribersCollection.java
deleted file mode 100644
index 029ee225..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/SubscribersCollection.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.IOException;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-
-
-/** @author tnine */
-public class SubscribersCollection extends CollectionResource {
-
-    private String queueName;
-
-
-    public SubscribersCollection( NamedResource parent ) {
-        super( "subscribers", parent );
-    }
-
-
-    public JsonNode subscribe( String queueName ) throws IOException {
-        this.queueName = queueName;
-        return mapper.readTree( jsonMedia( withToken( resource() ) ).put( String.class ));
-    }
-
-
-    public JsonNode unsubscribe( String queueName ) throws IOException {
-        this.queueName = queueName;
-        return mapper.readTree( jsonMedia( withToken( resource() ) ).delete( String.class ));
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.apache.usergrid.rest.test.resource.ValueResource#addToUrl(java.lang.StringBuilder
-     * )
-     */
-    @Override
-    public void addToUrl( StringBuilder buffer ) {
-        super.addToUrl( buffer );
-        buffer.append( SLASH ).append( queueName );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Transaction.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Transaction.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Transaction.java
deleted file mode 100644
index 20d104b..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/Transaction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.usergrid.rest.test.resource.CollectionResource;
-import org.apache.usergrid.rest.test.resource.NamedResource;
-
-import com.sun.jersey.api.client.WebResource;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * A resource for testing queues
- *
- * @author tnine
- */
-public class Transaction extends CollectionResource {
-
-    private String clientId;
-    private long timeout = 0;
-
-
-    /**
-     *
-     */
-    public Transaction( String transactionName, NamedResource parent ) {
-        super( transactionName, parent );
-    }
-
-
-    /** Set the client id with the string */
-    public Transaction withClientId( String clientId ) {
-        this.clientId = clientId;
-        return this;
-    }
-
-
-    /** post to the entity set */
-    public JsonNode delete() {
-        try {
-            return mapper.readTree( jsonMedia( withParams( withToken( resource() ) ) ).delete( String.class ));
-        } catch (IOException ex) {
-            throw new RuntimeException("Cannot parse JSON data", ex);
-        }
-    }
-
-
-    /** Renew this transaction to the set timeout */
-    public JsonNode renew( long timeout ) throws IOException {
-        this.timeout = timeout;
-        return super.putInternal( null );
-    }
-
-
-    /** Set the queue client ID if set */
-    protected WebResource withParams( WebResource resource ) {
-        if ( clientId != null ) {
-            resource = resource.queryParam( "consumer", clientId );
-        }
-        if ( timeout > 0 ) {
-            resource = resource.queryParam( "timeout", String.valueOf( timeout ) );
-        }
-
-        return resource;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/TransactionsCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/TransactionsCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/TransactionsCollection.java
deleted file mode 100644
index 6aa4bbf..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/queue/TransactionsCollection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.rest.test.resource.app.queue;
-
-
-import org.apache.usergrid.rest.test.resource.NamedResource;
-import org.apache.usergrid.rest.test.resource.ValueResource;
-
-
-/** @author tnine */
-public class TransactionsCollection extends ValueResource {
-
-
-    public TransactionsCollection( NamedResource parent ) {
-        super( "transactions", parent );
-    }
-
-
-    public Transaction transaction( String id ) {
-        return new Transaction( id, this );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/ApplicationsResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/ApplicationsResource.java
new file mode 100644
index 0000000..78f906f
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/ApplicationsResource.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.CredentialsResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+
+/**
+ * Holds the information required for building and chaining application objects to collections.
+ * app("applications").post();
+ */
+public class ApplicationsResource extends NamedResource {
+
+
+    public ApplicationsResource( final String name, final ClientContext context, final UrlResource parent ) {
+        super( name, context, parent );
+    }
+
+
+    public CollectionEndpoint collection(String name) {
+        return new CollectionEndpoint(name,context,this);
+    }
+
+
+    public TokenResource token() {
+        return new TokenResource( context, this );
+    }
+
+
+    /**
+     * Delete this application.
+     */
+    public ApiResponse delete() {
+        return getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept( MediaType.APPLICATION_JSON )
+            .delete( ApiResponse.class );
+    }
+
+    public CredentialsResource credentials(){
+        return new CredentialsResource(  context ,this );
+    }
+
+
+    /**
+     * Used to get an application entity.
+     */
+    public ApiResponse get() {
+        return getResource(true)
+            .type(MediaType.APPLICATION_JSON_TYPE)
+            .accept( MediaType.APPLICATION_JSON )
+            .get(ApiResponse.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
new file mode 100644
index 0000000..c3190dc
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/CollectionEndpoint.java
@@ -0,0 +1,355 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.rest.test.resource.model.*;
+import org.apache.usergrid.rest.test.resource.model.Collection;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+import org.apache.usergrid.services.ServiceParameter;
+import org.apache.usergrid.utils.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.*;
+
+
+/**
+ * //myorg/myapp/mycollection
+ */
+public class CollectionEndpoint extends NamedResource {
+    private static final Logger logger = LoggerFactory.getLogger(CollectionEndpoint.class);
+
+    protected List<String> acceptHeaders = new ArrayList<String> ();
+    private String matrix;
+
+    public CollectionEndpoint(String name, ClientContext context, UrlResource parent) {
+        super(name, context, parent);
+    }
+
+    public EntityEndpoint uniqueID(final String identifier){
+        return new EntityEndpoint(identifier, context, this);
+    }
+
+    public EntityEndpoint entity(final org.apache.usergrid.rest.test.resource.model.Entity entity){
+        String identifier = (String) entity.get("uuid");
+        return entity(identifier);
+    }
+
+    public EntityEndpoint entity(final UUID identifier ){
+        return entity(identifier.toString());
+    }
+
+
+    public EntityEndpoint entity(final String identifier ){
+        return uniqueID(identifier);
+    }
+
+    public CollectionEndpoint withAcceptHeader(final String acceptHeader) {
+        this.acceptHeaders.add(acceptHeader);
+        return this;
+    }
+
+    /**
+     * <pre>
+     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
+     * POST /users/fred/following/users/barney?token=<token>
+     *
+     * app.collection("users").uniqueID("fred").connection().collection("users").uniqueID("barney").post();
+     * POST /users/fred/groups/theitcrowd?token=<token>
+     * </pre>
+     */
+    public CollectionEndpoint collection(final String identifier){
+        return new CollectionEndpoint(identifier, context, this);
+    }
+
+
+
+    /**
+     * Get a list of entities.
+     *
+     * <pre>
+     * //with token
+     * app.collection("users").get(); //return entity
+     * GET /users?token=<token>
+     *
+     * //with query and token
+     * collection = app.collection("users").get(queryparam); //return collection (list of entities)
+     * GET /users?ql=select * where created > 0&token=<token>
+     *
+     * //with query and no token
+     * collection = app.collection("users").get(queryparam, false); //return collection (list of entities)
+     * GET /users?ql=select * where created > 0
+     *
+     * //with no query and no token
+     * collection = app.collection("users").get(null, false); //return collection (list of entities)
+     * GET /users
+     *
+     * collection = app.collection("users").get(collection);
+     * <pre>
+     */
+    public Collection get(){
+        return new Collection( get(org.apache.usergrid.rest.test.resource.model.ApiResponse.class,null,true));
+    }
+
+    public Collection get( final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters ){
+        return get(parameters, true);
+    }
+
+    public Collection get(final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters, final boolean useToken){
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+        if (this.acceptHeaders.size() > 0) {
+           acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        WebResource resource  = getResource(useToken);
+        resource = addParametersToResource(resource, parameters);
+
+        // use string type so we can log actual response from server
+        String responseString = resource.type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(acceptHeader)
+            .get(String.class);
+
+        logger.debug("Response from get: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return new Collection(response);
+    }
+
+    /**
+     * Gets the next page using only default settings with the passed in collection.
+     *
+     * <pre>
+     * Collection usersCollection =  app.collection("users").get();
+     * //iterate through the collection
+     * while(usersCollection.hasNext()){
+     *  Entity bob = usersCollection.next();
+     *     assert("blah",bob.get("words"));
+     * }
+     * usersCollection = app.collections("users").getNextPage(usersCollection.cursor);
+     * </pre>
+     */
+    //TODO: add queryParameters here
+    public Collection getNextPage(Collection collection, org.apache.usergrid.rest.test.resource.model.QueryParameters passedParameters ,final boolean useToken) {
+        String acceptHeader = MediaType.APPLICATION_JSON;
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        WebResource resource = getResource(useToken);
+        org.apache.usergrid.rest.test.resource.model.QueryParameters queryParameters = passedParameters;
+        if( queryParameters == null){
+            queryParameters = new org.apache.usergrid.rest.test.resource.model.QueryParameters();
+        }
+
+        queryParameters.setCursor(collection.getCursor());
+        resource = addParametersToResource(resource, queryParameters);
+
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(acceptHeader)
+                .get(org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+
+        return new Collection(response);
+    }
+
+    /**
+     * DELETE on a collection endpoint with query (use DELETE on entity for single entity delete).
+     *
+     * <pre>
+     * //with token
+     * app.collection("users").delete(parameters);
+     * DELETE /users?ql=select * where created > 0&token=<token>
+     *
+     * //without token
+     * app.collection("users").delete(parameters, false);
+     * DELETE /users?ql=select * where created > 0
+     *
+     * app.collection("users").delete(null, false);
+     * DELETE /users
+     * </pre>
+     */
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse delete( final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters ){
+        return delete(parameters, true);
+    }
+
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse delete(final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters, final boolean useToken) {
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        WebResource resource  = getResource(useToken);
+        resource = addParametersToResource(resource, parameters);
+        return resource.type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(acceptHeader)
+            .delete(org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+    }
+
+    /**
+     * Post an entity to a collection.
+     *
+     * <pre>
+     * app.collection("users").post(entity);
+     * POST /users {"color","red"}
+     * </pre>
+     */
+    public org.apache.usergrid.rest.test.resource.model.Entity post(org.apache.usergrid.rest.test.resource.model.Entity payload){
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        // use string type so we can log actual response from server
+        String responseString = getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(acceptHeader)
+            .post(String.class, payload);
+
+        logger.debug("Response from post: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return new org.apache.usergrid.rest.test.resource.model.Entity(response);
+    }
+
+    public org.apache.usergrid.rest.test.resource.model.Entity post() {
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        // use string type so we can log actual response from server
+        String responseString = getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(acceptHeader)
+            .post(String.class);
+
+        logger.debug("Response from post: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return new org.apache.usergrid.rest.test.resource.model.Entity(response);
+    }
+
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse post(List<org.apache.usergrid.rest.test.resource.model.Entity> entityList) {
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        // use string type so we can log actual response from server
+        String responseString = getResource(true)
+            .type( MediaType.APPLICATION_JSON_TYPE )
+            .accept(acceptHeader)
+            .post(String.class, entityList );
+
+        logger.debug("Response from post: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return response;
+    }
+
+    /**
+     * PUT a payload to a collection.
+     *
+     * <pre>
+     * app.collection("users").put(entity, param);
+     * PUT /users?ql=select * where created > 0&token=<token>
+     *
+     * app.collection("users").put(entity, false, param);
+     * PUT /users?ql=select * where created > 0
+     * </pre>
+     */
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse put( final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters, org.apache.usergrid.rest.test.resource.model.Entity entity ){
+        return put(parameters, true, entity);
+    }
+
+    public org.apache.usergrid.rest.test.resource.model.ApiResponse put(final org.apache.usergrid.rest.test.resource.model.QueryParameters parameters, final boolean useToken, org.apache.usergrid.rest.test.resource.model.Entity entity) {
+
+        String acceptHeader = MediaType.APPLICATION_JSON;
+        if (this.acceptHeaders.size() > 0) {
+            acceptHeader = StringUtils.join(this.acceptHeaders, ',');
+        }
+
+        WebResource resource  = getResource(useToken);
+        addParametersToResource(getResource(), parameters);
+
+        // use string type so we can log actual response from server
+        String responseString = resource.type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(acceptHeader)
+            .post(String.class, entity);
+
+        logger.debug("Response from put: " + responseString);
+
+        ObjectMapper mapper = new ObjectMapper();
+        org.apache.usergrid.rest.test.resource.model.ApiResponse response;
+        try {
+            response = mapper.readValue( new StringReader(responseString), org.apache.usergrid.rest.test.resource.model.ApiResponse.class);
+        } catch (IOException e) {
+            throw new RuntimeException("Error parsing response", e);
+        }
+
+        return response;
+    }
+
+    public CollectionEndpoint matrix(org.apache.usergrid.rest.test.resource.model.QueryParameters parameters) {
+        this.matrix = getMatrixValue(parameters);
+        return this;
+    }
+
+    @Override
+    public String getMatrix(){
+        return matrix != null ? matrix : "";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/DatabaseResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/DatabaseResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/DatabaseResource.java
new file mode 100644
index 0000000..e1dcd9c
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/DatabaseResource.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.persistence.cassandra.Setup;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Contains methods pertaining to system/database/*
+ */
+public class DatabaseResource extends NamedResource {
+
+    public DatabaseResource( final ClientContext context, final UrlResource parent ) {
+        super( "database", context, parent );
+    }
+
+    public SetupResource setup(){
+        return new SetupResource (context, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/EntityEndpoint.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/EntityEndpoint.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/EntityEndpoint.java
new file mode 100644
index 0000000..70b2c3a
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/EntityEndpoint.java
@@ -0,0 +1,174 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+public class EntityEndpoint extends NamedResource {
+
+    public EntityEndpoint(String identifier, ClientContext context, UrlResource parent) {
+        super(identifier, context, parent);
+    }
+
+
+    /**
+     *
+     * GET a single entity
+     *
+     * @return Entity
+     *
+     *
+     * entity = app.collection("users").uniqueID("fred").get(); //return one entity
+     * GET /users/fred
+     *
+     * entity = app.collection("users").entity(entity).get(); //return one entity
+     * GET /users/username_in_entity_obj
+     *
+     */
+    public Entity get(){
+        return get(true);
+    }
+
+    public Entity get(final boolean useToken){
+        return get(useToken,null);
+    }
+    public Entity get(final Token token){
+        return get(true,token);
+    }
+
+    public Entity get(final boolean useToken, final Token token){
+        WebResource resource  = getResource(useToken,token);
+        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                .get(ApiResponse.class);
+
+        return new Entity(response);
+    }
+
+    //For testing purposes only
+    public Entity get(QueryParameters parameters, final boolean useToken){
+        WebResource resource  = getResource(useToken);
+        resource = addParametersToResource(resource, parameters);
+        ApiResponse response = resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                                       .get(ApiResponse.class);
+
+        return new Entity(response);
+    }
+
+
+    /**
+     * DELETE a single entity
+     *
+     *
+     * app.collection("users").entity(entity).delete();
+     * DELETE /users/username?token=<token>
+     *
+     * app.collection("users").entity(entity).delete(false);
+     * DELETE /users/uuid
+     */
+    public ApiResponse delete(){
+        return delete(true);
+    }
+
+    public ApiResponse delete(final boolean useToken){
+        WebResource resource  = getResource(useToken);
+        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                .delete(ApiResponse.class);
+    }
+
+    /**
+     * Put the entity to the collection
+     * @param entity
+     * @return
+     *
+     * app.collection("users").entity(entity).put(entity);
+     * PUT /users/uuid {}
+     *
+     * app.collection("users").uniqueID("fred").put(entity);
+     * PUT /users/fred {"color":"red"}
+     */
+    public Entity put(Entity entity){
+        ApiResponse response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                .put(ApiResponse.class, entity);
+        return new Entity(response);
+    }
+
+
+    /**
+     * POST with no payload
+     *
+     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
+     * POST /users/fred/following/users/barney?token=<token>
+     *
+     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post(false);
+     * POST /users/fred/following/users/barney
+     *
+     */
+    public Entity post(){
+        return post(true);
+    }
+
+    public Entity post(final boolean useToken){
+        WebResource resource  = getResource(useToken);
+        ApiResponse response = resource.type(MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                .post(ApiResponse.class);
+
+        return new Entity(response);
+    }
+
+    /**
+     *
+     * app.collection("users").uniqueID("fred").connection("following).get();
+     * GET /users/fred/following
+     *
+     * app.collection("users").uniqueID("fred").connection("following").collection("users").uniqueID("barney").post();
+     * POST /users/fred/following/users/barney?token=<token>
+     *
+     * app.collection("users").uniqueID("fred").connection().collection("users").uniqueID("barney").post();
+     * POST /users/fred/following/users/barney?token=<token>
+     *
+     */
+    public CollectionEndpoint connection(final String connection,final String collection) {
+        return new CollectionEndpoint(connection+"/"+collection, context, this);
+    }
+    public CollectionEndpoint connection(final String connection) {
+        return new CollectionEndpoint(connection, context, this);
+
+    }
+    public CollectionEndpoint collection(final String identifier) {
+        return new CollectionEndpoint(identifier, context, this);
+    }
+    public CollectionEndpoint connection(){
+        return new CollectionEndpoint("", context, this);
+    }
+
+
+    public CollectionEndpoint activities() {
+        return collection("activities");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
new file mode 100644
index 0000000..2258312
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
@@ -0,0 +1,358 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+import com.sun.jersey.api.representation.Form;
+import com.sun.jersey.multipart.FormDataMultiPart;
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Base class that is extended by named endpoints.
+ * The NamedResource stores the parent of the class, the context in which the class operates and then Name of this resource
+ */
+public class NamedResource implements UrlResource {
+
+    public static String SLASH ="/" ;
+
+    protected final String name;
+    protected final ClientContext context;
+    /* Stores the path of the parent that called it.
+    i.e If we had a ApplicationResource ( an instance of a namedResource ) this would contain the OrganizationResource.
+     */
+    protected final UrlResource parent;
+
+
+    public NamedResource( final String name, final ClientContext context, final UrlResource parent ) {
+        this.name = name;
+        this.context = context;
+        this.parent = parent;
+    }
+
+
+    @Override
+    public String getPath() {
+        return name + getMatrix();
+    }
+
+    @Override
+    public WebResource getResource() {
+        return getResource(false);
+    }
+    public WebResource getResource(boolean useToken) {
+        return getResource(useToken,null);
+    }
+    public WebResource getResource(boolean useToken,Token token) {
+        WebResource resource = parent.getResource().path( getPath() );
+        token = token !=null ? token : this.context.getToken();
+        //error checking
+        if (token == null) {
+            return resource;
+        }
+        return  useToken    ? resource.queryParam("access_token",token.getAccessToken()) :  resource;
+    }
+
+    protected WebResource addParametersToResource(WebResource resource, final QueryParameters parameters){
+
+        if(parameters == null){
+            return resource;
+        }
+        if ( parameters.getQuery() != null ) {
+            resource = resource.queryParam( "ql", parameters.getQuery() );
+        }
+
+        if ( parameters.getCursor() != null ) {
+           resource = resource.queryParam( "cursor", parameters.getCursor() );
+        }
+
+        if ( parameters.getStart() != null ) {
+            resource = resource.queryParam("start", parameters.getStart().toString());
+        }
+
+        if ( parameters.getLimit() != null ) {
+             resource = resource.queryParam("limit", parameters.getLimit().toString());
+        }
+        //We can also post the params as queries
+        if ( parameters.getFormPostData().size() > 0){
+            Map<String,String> formData = parameters.getFormPostData();
+            Set<String> keySet = formData.keySet();
+            Iterator<String> keyIterator = keySet.iterator();
+
+
+            while(keyIterator.hasNext()){
+                String key = keyIterator.next();
+                String value = formData.get( key );
+                resource = resource.queryParam( key, value );
+            }
+        }
+        return resource;
+    }
+
+    protected String getMatrixValue(final QueryParameters parameters) {
+
+        StringBuilder sb = new StringBuilder();
+        if (parameters == null) {
+            return null;
+        }
+        if (parameters.getQuery() != null) {
+            sb.append(";");
+            sb.append("ql").append("=").append(parameters.getQuery());
+        }
+
+        if (parameters.getCursor() != null) {
+            sb.append(";");
+            sb.append("cursor").append("=").append(parameters.getCursor());
+        }
+        if (parameters.getStart() != null) {
+            sb.append(";");
+            sb.append("start").append("=").append(parameters.getStart());
+        }
+        if (parameters.getLimit() != null) {
+            sb.append(";");
+            sb.append("limit").append("=").append(parameters.getLimit());
+        }
+        //We can also post the params as queries
+        if (parameters.getFormPostData().size() > 0) {
+            Map<String, String> formData = parameters.getFormPostData();
+            Set<String> keySet = formData.keySet();
+            Iterator<String> keyIterator = keySet.iterator();
+
+
+            while (keyIterator.hasNext()) {
+                if (sb.length() > 0)
+                    sb.append(";");
+                String key = keyIterator.next();
+                String value = formData.get(key);
+                sb.append(key).append("=").append(value);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
+     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
+     * @param map
+     * @return
+     */
+    //For edge cases like Organizations and Tokens
+    public ApiResponse post(Map map) {
+        return post( true, ApiResponse.class, map, null, false );
+
+    }
+
+    //For edge cases like Organizations and Tokens
+    public ApiResponse post(boolean useToken, Map map, QueryParameters queryParameters) {
+        return post( useToken, ApiResponse.class, map, queryParameters, false );
+
+    }
+
+    /**
+     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
+     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
+     * @param type
+     * @param <T>
+     * @return
+     */
+    //For edge cases like Organizations and Tokens
+    public <T> T post(Class<T> type) {
+        return post(true,type,null,null,false);
+
+    }
+
+    /**
+     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
+     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
+     * @param type
+     * @param requestEntity
+     * @param <T>
+     * @return
+     */
+    //For edge cases like Organizations and Tokens
+    public <T> T post(Class<T> type, Entity requestEntity) {
+        return post(true,type,requestEntity,null,false);
+
+    }
+
+    /**
+     * Need to refactor all instances of tokens to either be passed in or manually set during the test.
+     * There isn't any reason we would want a rest forwarding framework to set something on behave of the user.
+     * @param type
+     * @param requestEntity
+     * @param <T>
+     * @return
+     */
+    //For edge cases like Organizations and Tokens
+    public <T> T post(Class<T> type, Map requestEntity) {
+        return post(true,type,requestEntity,null,false);
+
+    }
+
+    public <T> T post( boolean useToken, Class<T> type, Map requestEntity) {
+        return post(useToken, type, requestEntity, null, false);
+
+    }
+
+    /**
+     * Used to test POST using form payloads.
+     * @param type
+     * @param requestEntity
+     * @param <T>
+     * @return
+     */
+    public <T> T post(Class<T> type, Form requestEntity) {
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return getResource()
+            .accept(MediaType.APPLICATION_JSON)
+            .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE)
+            .entity(requestEntity, MediaType.APPLICATION_FORM_URLENCODED_TYPE)
+            .post(gt.getRawClass());
+
+    }
+
+
+    //Used for empty posts
+    public <T> T post( boolean useToken, Class<T> type, Map entity, final QueryParameters queryParameters) {
+        WebResource resource = getResource(useToken);
+        resource = addParametersToResource(resource, queryParameters);
+        WebResource.Builder builder = resource
+            .type(MediaType.APPLICATION_JSON_TYPE)
+            .accept( MediaType.APPLICATION_JSON );
+
+        if(entity!=null){
+            builder.entity(entity);
+        }
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return builder
+            .post(gt.getRawClass());
+
+    }
+
+    //Used for empty posts
+    public <T> T post( boolean useToken, Class<T> type, Map entity, final QueryParameters queryParameters, boolean useBasicAuthentication ) {
+        WebResource resource = getResource(useToken);
+        resource = addParametersToResource(resource, queryParameters);
+        WebResource.Builder builder = resource
+            .type(MediaType.APPLICATION_JSON_TYPE)
+            .accept( MediaType.APPLICATION_JSON );
+
+        if(entity!=null){
+            builder.entity(entity);
+        }
+
+        if(useBasicAuthentication){
+            //added httpBasicauth filter to all setup calls because they all do verification this way.
+            HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
+            resource.addFilter( httpBasicAuthFilter );
+        }
+
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return builder.post( gt.getRawClass() );
+
+    }
+
+    //For edge cases like Organizations and Tokens without any payload
+    public <T> T get(Class<T> type) {
+        return get(type,null,true);
+
+    }
+
+    //For edge cases like Organizations and Tokens without any payload
+    public <T> T get(Class<T> type, boolean useToken) {
+        return get( type, null, useToken );
+    }
+
+
+
+    public <T> T get(Class<T> type,QueryParameters queryParameters) {
+        return get( type, queryParameters, true );
+    }
+
+    public <T> T get(Class<T> type,QueryParameters queryParameters, boolean useToken) {
+        WebResource resource = getResource(useToken);
+        if(queryParameters!=null) {
+            resource = addParametersToResource(resource, queryParameters);
+        }
+        GenericType<T> gt = new GenericType<>((Class) type);
+        return resource.type(MediaType.APPLICATION_JSON_TYPE)
+            .accept( MediaType.APPLICATION_JSON )
+            .get( gt.getRawClass() );
+
+    }
+
+    public String getMatrix() {
+        return "";
+    }
+
+    public ApiResponse post( boolean useToken, FormDataMultiPart multiPartForm ) {
+        WebResource resource = getResource( useToken );
+        return resource.type( MediaType.MULTIPART_FORM_DATA_TYPE ).post( ApiResponse.class, multiPartForm );
+    }
+
+    public ApiResponse post( FormDataMultiPart multiPartForm ) {
+        return post( true, multiPartForm );
+    }
+
+    public ApiResponse put( boolean useToken, byte[] data, MediaType type ) {
+        WebResource resource = getResource(useToken);
+        return resource.type( type ).put( ApiResponse.class, data );
+    }
+
+    public ApiResponse put( byte[] data, MediaType type ) {
+        return put( true, data, type );
+    }
+
+    public ApiResponse put( boolean useToken, FormDataMultiPart multiPartForm ) {
+        WebResource resource = getResource(useToken);
+        return resource.type( MediaType.MULTIPART_FORM_DATA_TYPE ).put( ApiResponse.class, multiPartForm );
+    }
+
+    public ApiResponse put( FormDataMultiPart multiPartForm ) {
+        return put( true, multiPartForm );
+    }
+
+    public InputStream getAssetAsStream( boolean useToken ) {
+        WebResource resource = getResource(useToken);
+        return resource.accept( MediaType.APPLICATION_OCTET_STREAM_TYPE ).get( InputStream.class );
+    }
+
+    public InputStream getAssetAsStream() {
+        return getAssetAsStream( true );
+    }
+
+    public ApiResponse delete( ) {
+        return delete(true);
+    }
+
+    public ApiResponse delete( boolean useToken ) {
+        return getResource(useToken).delete( ApiResponse.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/OrganizationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/OrganizationResource.java
new file mode 100644
index 0000000..4338677
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/OrganizationResource.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Organization;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Holds the information required for building and chaining organization objects to applications.
+ * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
+ */
+public class OrganizationResource extends NamedResource {
+
+
+    public OrganizationResource( final String name, final ClientContext context, final UrlResource parent ) {
+        super( name, context, parent );
+    }
+
+    public ApplicationsResource app(final String name){
+        return new ApplicationsResource( name, context ,this );
+    }
+
+    public Organization get(){
+        throw new UnsupportedOperationException("service doesn't exist");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/RootResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/RootResource.java
new file mode 100644
index 0000000..8537251
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/RootResource.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * Contains the root element for classes. Contains the client context that holds a token for the management calls,
+ * and also contains the serverUrl so we know what endpoint we need to hit.
+ * Contains the two top level functions that can be called from the "root" ( actual root is the serverUrl )
+ * 1.) Is the management resource i.e /management/org/blah/...
+ * 2.) Is the organization resource i.e /<orgname>/<appname>...
+ * This is where top level elements are contained and managemend
+ */
+//TODO: check to see if this actually ever gets called. It doesn't seem like so remove once verified.
+public class RootResource implements UrlResource {
+
+
+    private final String serverUrl;
+    private final ClientContext context;
+
+
+    /**
+     *
+     * @param serverUrl The serverurl that has stood up the UG instance i.e localhost:8080
+     * @param context Contains the token that will be used for the following resources.
+     */
+    public RootResource( final String serverUrl, final ClientContext context ) {
+        this.serverUrl = serverUrl;
+        this.context = context;
+    }
+
+
+    /**
+     * Returns the serverUrl that the root resource is pointing to.
+     * @return serverUrl
+     */
+    @Override
+    public String getPath() {
+        return serverUrl;
+    }
+
+    @Override
+    public WebResource getResource() {
+        //TODO: fix this to return the proper resource in the scope we expect it, might not be needed here.
+        return null;
+    }
+
+    /**
+     * Get the management resource
+     * @return
+     */
+    public ManagementResource management(){
+        return new ManagementResource( context, this);
+    }
+
+
+    /**
+     * Get the organization resource
+     * @param orgName
+     * @return OrganizationResource Returns an instance of the OrganizationResource to continue builder pattern
+     */
+    public OrganizationResource  org(final String orgName){
+        return new OrganizationResource( orgName,context,  this );
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
new file mode 100644
index 0000000..b374cdc
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
+
+
+/**
+ * Functions as the endpoint for all resources that hit /system/ * /setup
+ */
+public class SetupResource extends NamedResource {
+
+    public SetupResource( final ClientContext context, final UrlResource parent ) {
+        super("setup",context,parent);
+    }
+
+    public Entity get(QueryParameters queryParameters){
+
+        WebResource resource = getResource();
+        resource = addParametersToResource( resource, queryParameters );
+
+        //added httpBasicauth filter to all setup calls because they all do verification this way.
+        HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( "superuser","superpassword" );
+        resource.addFilter( httpBasicAuthFilter );
+
+        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
+                                .get( Entity.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
new file mode 100644
index 0000000..6a97dad
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+import org.apache.usergrid.rest.test.resource.model.Entity;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+
+/**
+ * Handles making rest calls to system resources.
+ */
+public class SystemResource extends NamedResource {
+
+    public SystemResource(final ClientContext context, final UrlResource parent ) {
+        super( "system",context, parent );
+    }
+
+    //Dirty hack for path resource in new branch of two-dot-o
+    public SystemResource(final String name,final ClientContext context, final UrlResource parent ) {
+        super( name,context, parent );
+    }
+
+
+    public DatabaseResource database() {
+        return new DatabaseResource(context, this);
+    }
+
+    public SystemResource addToPath( String pathPart ) {
+        return new SystemResource( pathPart, context, this );
+    }
+
+    public ApiResponse put(){
+        ApiResponse
+            response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                                        .put(ApiResponse.class);
+        return response;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/TokenResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/TokenResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/TokenResource.java
new file mode 100644
index 0000000..59ad354
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/TokenResource.java
@@ -0,0 +1,89 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import com.sun.jersey.api.client.WebResource;
+import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+import org.apache.usergrid.rest.test.resource.model.Token;
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Classy class class.
+ */
+public class TokenResource extends NamedResource {
+    public TokenResource(final ClientContext context, final UrlResource parent) {
+        super("token", context, parent);
+    }
+
+
+    /**
+     * Obtains an access token and sets the token for the context to use in later calls
+     *
+     * @return
+     */
+    public Token post(QueryParameters params) {
+        WebResource resource = getResource(false);
+        resource = addParametersToResource(resource, params);
+        Token token = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+            .get(Token.class);
+
+        this.context.setToken(token);
+        return token;
+    }
+
+    /**
+     * Obtains an access token and sets the token for the context to use in later calls
+     *
+     * @return
+     */
+    public Token post() {
+        Token token = getResource().accept(MediaType.APPLICATION_JSON).post(Token.class);
+        this.context.setToken(token);
+        return token;
+    }
+
+    /**
+     * Obtains an access token and sets the token for the context to use in later calls
+     *
+     * @param token
+     * @return
+     */
+    public Token post(Token token) {
+        token = getResource(false).type(MediaType.APPLICATION_JSON_TYPE)
+            .accept(MediaType.APPLICATION_JSON).post(Token.class, token);
+        this.context.setToken(token);
+        return token;
+    }
+
+    public TokenResource setToken(Token token) {
+        this.context.setToken(token);
+        return this;
+    }
+
+    public TokenResource clearToken() {
+        this.context.setToken(null);
+        return this;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/876dc8d3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/UrlResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/UrlResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/UrlResource.java
new file mode 100644
index 0000000..eb16d4d
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/UrlResource.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.usergrid.rest.test.resource.endpoints;
+
+
+import org.apache.usergrid.rest.test.resource.state.ClientContext;
+
+import com.sun.jersey.api.client.WebResource;
+
+
+/**
+ * Interface that returns the path that is currently being pointed to.
+ */
+public interface UrlResource {
+
+    /**
+     * Get the url path to this resource
+     * example: http://localhost:8080/management/orgs/<org_name>
+     * @return
+     */
+    public String getPath();
+
+    /**
+     * Get the resource
+     * @return
+     */
+    public WebResource getResource();
+
+
+}