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

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

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 );
-    }
-}