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 2014/12/16 21:46:18 UTC

[1/2] incubator-usergrid git commit: add test abstractions

Repository: incubator-usergrid
Updated Branches:
  refs/heads/UG-rest-test-framework-overhaul 4ddf6ad90 -> 802d7dc39


add test abstractions


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

Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: ed25b255b3be2406138a9bd7b2bc224c194242ab
Parents: 4ddf6ad
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 16 13:35:01 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 16 13:35:01 2014 -0700

----------------------------------------------------------------------
 .../rest/test/resource2point0/ClientSetup.java  |  2 +-
 .../endpoints/AbstractCollectionResource.java   | 83 ++++++++++++++++++++
 .../endpoints/AbstractEntityResource.java       | 58 ++++++++++++++
 .../endpoints/CollectionResource.java           | 46 ++---------
 .../endpoints/EntityResource.java               | 22 +-----
 .../resource2point0/endpoints/UserResource.java | 40 ++++++++++
 .../endpoints/UsersResource.java                | 49 ++++++++++++
 .../test/resource2point0/model/Application.java |  7 +-
 .../rest/test/resource2point0/model/Entity.java | 15 +++-
 9 files changed, 258 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/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 3d5c637..0b1c860 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
@@ -88,7 +88,7 @@ public class ClientSetup implements TestRule {
 
         username = "user_"+name + UUIDUtils.newTimeUUID();
         orgName = "org_"+name+UUIDUtils.newTimeUUID();
-        orgName = "app_"+name+UUIDUtils.newTimeUUID();
+        appName = "app_"+name+UUIDUtils.newTimeUUID();
 
         organization = restClient.management().orgs().post(new Organization( orgName,username,username+"@usergrid.com",username,username, null  ));
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractCollectionResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractCollectionResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractCollectionResource.java
new file mode 100644
index 0000000..7e5afa3
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractCollectionResource.java
@@ -0,0 +1,83 @@
+/*
+ *
+ *  * 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.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.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Classy class class.
+ */
+public abstract class AbstractCollectionResource<T,K> extends NamedResource {
+    public AbstractCollectionResource(String name, ClientContext context, UrlResource parent) {
+        super(name, context, parent);
+    }
+
+    public K entity(final String identifier){
+        return instantiateK(identifier, context, this);
+    }
+
+    /**
+     * Get a list of entities
+     * @return
+     */
+    public ApiResponse get( final QueryParameters parameters){
+        return get(parameters,true);
+    }
+    /**
+     * Get a list of entities
+     * @return
+     */
+    public ApiResponse get(final QueryParameters parameters, final boolean useToken){
+        WebResource resource  = getResource(useToken);
+        addParametersToResource(getResource(), parameters);
+        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
+                .get(ApiResponse.class);
+    }
+
+    /**
+     * Post the entity to the users collection
+     * @param entity
+     * @return
+     */
+    public T post(final T entity){
+        return instantiateT(getResource(true).post(ApiResponse.class, entity));
+    }
+
+    /**
+     * Put the entity to the users collection
+     * @param entity
+     * @return
+     */
+    public T put(final T entity){
+        return instantiateT(getResource(true).put(ApiResponse.class, entity));
+    }
+
+    protected abstract T instantiateT(ApiResponse response);
+
+    protected abstract K instantiateK(String identifier, ClientContext context, UrlResource parent);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractEntityResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractEntityResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractEntityResource.java
new file mode 100644
index 0000000..28f20a9
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/AbstractEntityResource.java
@@ -0,0 +1,58 @@
+/*
+ *
+ *  * 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.ApiResponse;
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Classy class class.
+ */
+public abstract class AbstractEntityResource<T> extends NamedResource {
+
+    public AbstractEntityResource(String identifier, ClientContext context, UrlResource parent) {
+        super(identifier, context, parent);
+    }
+
+    public T get() {
+        WebResource resource = getResource(true);
+        ApiResponse response = resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+                .get(ApiResponse.class);
+        return instantiateT(response);
+    }
+
+    public ApiResponse post(final T entity) {
+        WebResource resource = getResource(true);
+        return resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+                .post(ApiResponse.class, entity);
+    }
+
+    public ApiResponse put(final T entity) {
+        WebResource resource = getResource(true);
+        return resource.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON)
+                .put(ApiResponse.class, entity);
+    }
+
+    protected abstract T instantiateT(ApiResponse response);
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionResource.java
index 87f0098..695d677 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/CollectionResource.java
@@ -36,55 +36,25 @@ import javax.ws.rs.core.MediaType;
  * Holds POST,PUT,GET,DELETE methods for Collections. Models the rest endpoints for the different ways
  * to get an entity out of UG.
  */
-public  class CollectionResource extends NamedResource {
+public  class CollectionResource extends AbstractCollectionResource<Entity,EntityResource> {
 
 
     public CollectionResource(final String name, final ClientContext context, final UrlResource parent) {
         super( name, context, parent );
     }
 
-    public EntityResource entity(final String identifier){
-        return new EntityResource( identifier, context, this );
-    }
 
-    /**
-     * Get a list of entities
-     * @return
-     */
-    public ApiResponse get( final QueryParameters parameters){
-       return get(parameters,true);
-    }
-    /**
-     * Get a list of entities
-     * @return
-     */
-    public ApiResponse get(final QueryParameters parameters, final boolean useToken){
-        WebResource resource  = getResource(useToken);
-        addParametersToResource(getResource(), parameters);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .get(ApiResponse.class);
+    @Override
+    protected Entity instantiateT(ApiResponse response) {
+        Entity entity = new Entity(response);
+        return entity;
     }
 
-    /**
-     * Post the entity to the users collection
-     * @param entity
-     * @return
-     */
-    public ApiResponse post(final Entity entity){
-        return getResource(true).post(ApiResponse.class,entity);
-    }
+    @Override
+    protected EntityResource instantiateK(String identifier, ClientContext context, UrlResource parent) {
+        return new EntityResource( identifier, context, this );
 
-    /**
-     * Put the entity to the users collection
-     * @param entity
-     * @return
-     */
-    public ApiResponse put(final Entity entity){
-        return getResource(true).post(ApiResponse.class,entity);
     }
 
 
-
-
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityResource.java
index fb4e5f8..f432d9b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/EntityResource.java
@@ -31,27 +31,13 @@ import javax.ws.rs.core.MediaType;
 /**
  * Classy class class.
  */
-public class EntityResource extends NamedResource {
+public class EntityResource extends AbstractEntityResource<Entity> {
     public EntityResource(String name, ClientContext context, UrlResource parent) {
         super(name, context, parent);
     }
 
-
-    public ApiResponse get(){
-        WebResource resource  =getResource(true);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .get(ApiResponse.class);
-    }
-
-    public ApiResponse post(final Entity entity){
-        WebResource resource  =getResource(true);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .post(ApiResponse.class,entity);
-    }
-
-    public ApiResponse put(final Entity entity){
-        WebResource resource  =getResource(true);
-        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-                .put(ApiResponse.class,entity);
+    @Override
+    protected Entity instantiateT(ApiResponse response) {
+        return new Entity(response);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UserResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UserResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UserResource.java
new file mode 100644
index 0000000..22b47ce
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UserResource.java
@@ -0,0 +1,40 @@
+/*
+ *
+ *  * 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 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.User;
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+/**
+ * Classy class class.
+ */
+public class UserResource extends AbstractEntityResource<User>  {
+    public UserResource(String name, ClientContext context, UrlResource parent) {
+        super(name, context, parent);
+    }
+
+    @Override
+    protected User instantiateT(ApiResponse response) {
+        return new User(response);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UsersResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UsersResource.java
new file mode 100644
index 0000000..4eb39b9
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/UsersResource.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.resource2point0.endpoints;
+
+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.User;
+import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+import java.util.Map;
+
+/**
+ * Classy class class.
+ */
+public class UsersResource extends AbstractCollectionResource<User,UserResource> {
+
+    public UsersResource( ClientContext context, UrlResource parent) {
+        super("users", context, parent);
+    }
+
+    @Override
+    protected User instantiateT(ApiResponse response) {
+        return new User(response);
+    }
+
+    @Override
+    protected UserResource instantiateK(String name, ClientContext context, UrlResource parent) {
+        return new UserResource(name,context,parent);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/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
index 16e4718..75566f2 100644
--- 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
@@ -21,6 +21,7 @@
 package org.apache.usergrid.rest.test.resource2point0.model;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Classy class class.
@@ -33,10 +34,6 @@ public class Application extends Entity {
     }
 
     public Application(ApiResponse response){
-        if(response.getEntities() !=null &&  response.getEntities().size()>=1){
-            List<Entity>  entities =  response.getEntities();
-            Entity entity = entities.get(0);
-            this.putAll(entity.dynamic_properties);
-        }
+        super(response);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ed25b255/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
index 23d7f38..77218f3 100644
--- 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
@@ -51,12 +51,23 @@ public class Entity implements Serializable, Map<String,Object> {
 
     private CollectionResource targetResource;
 
+    public Entity(){}
+
+    public Entity(ApiResponse response){
+        if(response.getEntities() !=null &&  response.getEntities().size()>=1){
+            List<Entity>  entities =  response.getEntities();
+            Map<String,Object> entity = entities.get(0);
+            this.putAll(entity);
+        }
+    }
+
     /**
      * Performs deep copy on entity passed in and save over what we currently have
      */
     public void save(){
-        List<Entity> response = targetResource.put(this).getEntities();
-        Entity entity = response.get(0);
+        targetResource.put(this);
+        ApiResponse response = targetResource.entity(this.getName()).get();
+        Entity entity = new Entity(response);
         this.dynamic_properties.putAll(entity.getDynamicProperties());
     }
 


[2/2] incubator-usergrid git commit: add test abstractions

Posted by sf...@apache.org.
add test abstractions


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

Branch: refs/heads/UG-rest-test-framework-overhaul
Commit: 802d7dc3985920c429e4fdee4a39b0f3a890521e
Parents: ed25b25
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 16 13:45:55 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 16 13:45:55 2014 -0700

----------------------------------------------------------------------
 .../test/resource2point0/AbstractRestIT.java    |   5 +-
 .../rest/test/resource2point0/ClientSetup.java  |   6 -
 .../endpoints/ApplicationResource.java          | 116 ++++---------------
 .../endpoints/ApplicationsResource.java         |  88 ++++++++++++++
 .../endpoints/OrganizationResource.java         |   9 +-
 .../rest/test/resource2point0/model/Entity.java |   3 +-
 6 files changed, 115 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/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
index 102de4b..1e0aa30 100644
--- 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
@@ -21,9 +21,8 @@ import java.net.URI;
 import java.net.URLClassLoader;
 import java.util.Arrays;
 
-import org.apache.usergrid.rest.test.resource2point0.endpoints.ApplicationResource;
+import org.apache.usergrid.rest.test.resource2point0.endpoints.ApplicationsResource;
 import org.apache.usergrid.rest.test.resource2point0.endpoints.OrganizationResource;
-import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Rule;
 
@@ -100,7 +99,7 @@ public class AbstractRestIT extends JerseyTest {
         return clientSetup.restClient.org(clientSetup.getOrganization().getName());
     }
 
-    protected ApplicationResource getApplicationResource(){
+    protected ApplicationsResource getApplicationResource(){
         return clientSetup.restClient.org(clientSetup.getOrganization().getName()).app(clientSetup.getAppName());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/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 0b1c860..278ad69 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
@@ -22,10 +22,7 @@ package org.apache.usergrid.rest.test.resource2point0;
 
 
 import java.io.IOException;
-import java.util.Map;
 
-import org.apache.usergrid.rest.test.resource2point0.endpoints.ApplicationResource;
-import org.apache.usergrid.rest.test.resource2point0.endpoints.OrganizationResource;
 import org.apache.usergrid.rest.test.resource2point0.model.Application;
 import org.apache.usergrid.rest.test.resource2point0.model.Token;
 import org.junit.rules.TestRule;
@@ -33,10 +30,7 @@ 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.resource2point0.model.ApiResponse;
 import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.security.TestAdminUser;
-import org.apache.usergrid.utils.MapUtils;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
index a724a48..e8754ac 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationResource.java
@@ -1,112 +1,40 @@
 /*
- * 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
+ *  * 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.
  *
- * 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;
 
+package org.apache.usergrid.rest.test.resource2point0.endpoints;
 
-import org.apache.usergrid.rest.test.resource.app.Collection;
 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.state.ClientContext;
 
-import javax.ws.rs.core.MediaType;
-
-
 /**
- * Holds the information required for building and chaining application objects to collections.
- * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
- * This class also holds how we're currently interaction with collections.
+ * Classy class class.
  */
-public class ApplicationResource extends NamedResource {
-
-
-    public ApplicationResource( final String name,final ClientContext context,  final UrlResource parent ) {
-        super( name, context, parent );
-    }
-
-
-
-
-    public Application post(Application application){
-        ApiResponse response =getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                .post( ApiResponse.class, application );
-
-        return new Application(response);
-
-    }
-
-    public Application put(Application application){
-        ApiResponse response =getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                .put(ApiResponse.class, application );
-
-        return new Application(response);
+public class ApplicationResource extends AbstractEntityResource<Application> {
 
+    public ApplicationResource(String identifier, ClientContext context, UrlResource parent) {
+        super(identifier, context, parent);
     }
 
-
-    public Application get(){
-        ApiResponse response =getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                .get(ApiResponse.class);
-
+    @Override
+    protected Application instantiateT(ApiResponse response) {
         return new Application(response);
-
     }
-
-    public void delete(Application application){
-        ApiResponse response =getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept( MediaType.APPLICATION_JSON )
-                .delete(ApiResponse.class );
-    }
-
-
-    public CollectionResource collection(final String name){ return new CollectionResource(name,context,this);}
-
-    /**
-     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
-     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
-     * @return
-     */
-    public CollectionResource users(){
-        return new CollectionResource("users", context , this);
-    }
-
-    /**
-     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
-     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
-     * @return
-     */
-    public CollectionResource roles(){
-        return new CollectionResource("roles", context , this);
-    }
-
-    /**
-     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
-     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
-     * @return
-     */
-    public CollectionResource permissions(){
-        return new CollectionResource("permissions", context , this);
-    }
-
-    /**
-     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
-     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
-     * @return
-     */
-    public CollectionResource notifications(){
-        return new CollectionResource("notifications", context , this);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/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
new file mode 100644
index 0000000..5825f4f
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/ApplicationsResource.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.resource2point0.endpoints;
+
+
+import org.apache.usergrid.rest.test.resource.app.Collection;
+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.state.ClientContext;
+
+import javax.ws.rs.core.MediaType;
+
+
+/**
+ * Holds the information required for building and chaining application objects to collections.
+ * Should also contain the GET,PUT,POST,DELETE methods of functioning in here.
+ * This class also holds how we're currently interaction with collections.
+ */
+public class ApplicationsResource extends AbstractCollectionResource<Application,ApplicationResource> {
+
+
+    public ApplicationsResource(final String name, final ClientContext context, final UrlResource parent) {
+        super( name, context, parent );
+    }
+
+    @Override
+    protected Application instantiateT(ApiResponse response) {
+        return new Application(response);
+    }
+
+    @Override
+    protected ApplicationResource instantiateK(String identifier, ClientContext context, UrlResource parent) {
+        return new ApplicationResource(identifier,context,parent);
+    }
+
+    public CollectionResource collection(final String name){ return new CollectionResource(name,context,this);}
+
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public CollectionResource users(){
+        return new CollectionResource("users", context , this);
+    }
+
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public CollectionResource roles(){
+        return new CollectionResource("roles", context , this);
+    }
+
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public CollectionResource permissions(){
+        return new CollectionResource("permissions", context , this);
+    }
+
+    /**
+     * Currently hardcoded to users, this is because we expect to create and chain different cases of collections.
+     * The pattern should look like: orgs.apps.users , orgs.apps.groups and so on...
+     * @return
+     */
+    public CollectionResource notifications(){
+        return new CollectionResource("notifications", context , this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/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
index d862892..9834b6b 100644
--- 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
@@ -24,11 +24,6 @@ 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.state.ClientContext;
-import org.apache.usergrid.utils.MapUtils;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
 
 
 /**
@@ -42,8 +37,8 @@ public class OrganizationResource extends NamedResource {
         super( name, context, parent );
     }
 
-    public ApplicationResource app(final String app){
-        return new ApplicationResource( app, context ,this );
+    public ApplicationsResource app(final String app){
+        return new ApplicationsResource( app, context ,this );
     }
 
     public void post(Map<String,String> organization) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/802d7dc3/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
index 77218f3..9ccdb8f 100644
--- 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
@@ -66,8 +66,7 @@ public class Entity implements Serializable, Map<String,Object> {
      */
     public void save(){
         targetResource.put(this);
-        ApiResponse response = targetResource.entity(this.getName()).get();
-        Entity entity = new Entity(response);
+        Entity entity = targetResource.entity(this.getName()).get();
         this.dynamic_properties.putAll(entity.getDynamicProperties());
     }