usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [09/31] usergrid git commit: Changes to configure our filters correctly, and numerous other test fixes. Only 7 REST tests are not passing.
Date Sun, 20 Sep 2015 22:03:45 GMT
http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
index 787306c..0db7601 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/groups/GroupResourceIT.java
@@ -24,7 +24,7 @@ import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 
 import static org.junit.Assert.*;
@@ -149,7 +149,7 @@ public class GroupResourceIT extends AbstractRestIT {
         try {
             this.createGroup(groupName, groupSpacePath);
             fail("Should not be able to create a group with a space in the path");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "illegal_argument", node.get( "error" ).textValue() );
@@ -192,7 +192,7 @@ public class GroupResourceIT extends AbstractRestIT {
         try {
             this.app().collection("groups").uniqueID(groupName).get();
             fail("Entity still exists");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "entity_not_found", node.get( "error" ).textValue() );
@@ -298,7 +298,7 @@ public class GroupResourceIT extends AbstractRestIT {
         try {
             this.app().collection("role").entity(role).get();
             fail("Entity still exists");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "entity_not_found", node.get( "error" ).textValue() );
@@ -367,7 +367,7 @@ public class GroupResourceIT extends AbstractRestIT {
         try {
             this.app().collection("cats").uniqueID(catName).put(fluffy);
             fail("permissions should not allow this");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ) );
             assertEquals( "unauthorized", node.get( "error" ).textValue() );
@@ -377,7 +377,7 @@ public class GroupResourceIT extends AbstractRestIT {
         try {
             this.app().collection("cats").uniqueID(catName).delete();
             fail("permissions should not allow this");
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             //verify the correct error was returned
             JsonNode node = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "unauthorized", node.get( "error" ).textValue() );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
index af3ce9b..3655300 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
@@ -25,7 +25,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 import java.util.Map;
 
@@ -71,7 +71,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
 
             this.app().collection("users").entity(scott).collection("likes").collection("peeps").entity(peep).get();
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             // Should return a 404 Not Found
             assertEquals(404, uie.getResponse().getStatus());
         }
@@ -162,7 +162,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
             //attempt to retrieve thing1
             thing2 = this.app().collection("things").entity(thing2).get();
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             // Should return a 404 Not Found
             assertEquals(404, uie.getResponse().getStatus());
         }
@@ -198,7 +198,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
             //attempt to retrieve thing1
             thing1 = this.app().collection("things").entity(thing1).get();
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             // Should return a 404 Not Found
             assertEquals(404, uie.getResponse().getStatus());
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
index f90b6ae..cfd08e5 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
@@ -30,7 +30,7 @@ import org.junit.Test;
 
 import org.apache.usergrid.utils.MapUtils;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -152,7 +152,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         int status = 0;
         try {
             data = devices.entity("device2").get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals( status,404 );
@@ -176,7 +176,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         status = 0;
         try{
         data = devices.entity("device1").get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals( status,404 );
@@ -283,7 +283,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         int status = 200;
         try {
             likeRestaurants.entity("arrogantbutcher").get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals(status, 404);
@@ -291,7 +291,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         status = 200;
         try {
             likeRestaurants.entity( arrogantButcherId ).get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals(status, 404);
@@ -320,7 +320,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
          status = 200;
         try {
             data = likeRestaurants.entity( "4peaks" ).get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals( status,404 );
@@ -331,7 +331,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         try {
             likeRestaurants.entity( peaksId ).get();
 
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
         assertEquals( status,404 );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
index f9f1743..49d7c00 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/PermissionsResourceIT.java
@@ -28,7 +28,7 @@ import org.apache.usergrid.utils.UUIDUtils;
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Response;
 import java.io.IOException;
 
@@ -106,7 +106,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
         int status = 0;
         try {
             node = this.app().collection("users").entity(USER).collection("roles").entity(ROLE).get();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status = e.getResponse().getStatus();
         }
 
@@ -158,7 +158,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
         try {
             this.app().collection("users").entity(user).collection("groups").entity( groupPath ).collection( "users" ).entity( user ).get();
             fail("Should not have been able to retrieve the user as it was deleted");
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             status=e.getResponse().getStatus();
             assertEquals( 404,status );
         }
@@ -198,7 +198,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
         //Call a get on a existing entity with no access token and check if we get a 401
         try {
             this.app().collection( "roles" ).entity( "guest" ).get( false );
-        }catch(ResponseProcessingException uie){
+        }catch(ClientErrorException uie){
             assertEquals( 401,uie.getResponse().getStatus() );
         }
 
@@ -209,13 +209,13 @@ public class PermissionsResourceIT extends AbstractRestIT {
         //Call a get on a non existing entity that doesn't need permissions and check it we get a 404.
         try {
             this.app().collection( "roles" ).entity( "banana" ).get( false );
-        }catch(ResponseProcessingException uie){
+        }catch(ClientErrorException uie){
             assertEquals( 404,uie.getResponse().getStatus() );
         }
 
         try {
             this.app().collection( "roles" ).entity( UUIDUtils.newTimeUUID() ).get( false );
-        }catch(ResponseProcessingException uie){
+        }catch(ClientErrorException uie){
             assertEquals( 404,uie.getResponse().getStatus() );
         }
     }
@@ -302,7 +302,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
             this.app().collection("reviews").entity("noca").delete();
             fail( "this should have failed due to having insufficient permissions" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = uie.getResponse().getStatus();
         }
 
@@ -315,7 +315,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
             this.app().collection("reviews").entity("4peaks").delete();
             fail( "this should have failed due to having insufficient permissions" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = uie.getResponse().getStatus();
         }
 
@@ -355,7 +355,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
             this.app().collection("reviews").entity("cowboyciao").delete();
             fail( "this should have failed due to having insufficient permissions" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = uie.getResponse().getStatus();
         }
 
@@ -369,7 +369,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
             this.app().collection("reviews").entity("currycorner").delete();
             fail( "this should have failed due to having insufficient permissions" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = uie.getResponse().getStatus();
         }
 
@@ -472,7 +472,7 @@ public class PermissionsResourceIT extends AbstractRestIT {
             this.app().collection("books").post(book);
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = uie.getResponse().getStatus();
         }
         assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), status );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
index 71a8447..dc8daf9 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
@@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.rest.applications.utils.UserRepo;
 import org.apache.usergrid.utils.UUIDUtils;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Response;
 import java.io.IOException;
 
@@ -588,7 +588,7 @@ public class UserResourceIT extends AbstractRestIT {
             userRoles = this.app().collection("roles").entity(roleId1).connection("users")
                 .get(new QueryParameters().setQuery("select%20*%20where%20username%20=%20'" + email + "'"));
             assertNull(userRoles);
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             assertEquals( Response.Status.NOT_FOUND.getStatusCode(), e.getResponse().getStatus());
         }
 
@@ -817,7 +817,7 @@ public class UserResourceIT extends AbstractRestIT {
         int responseStatus = 0;
         try {
             usersResource.entity("edanuff").connection("password").post(data);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = uie.getResponse().getStatus();
         }
 
@@ -869,7 +869,7 @@ public class UserResourceIT extends AbstractRestIT {
             role = usersResource.entity(createdId).collection("roles").entity(roleName).get();
 
             assertNull(role);
-        } catch (ResponseProcessingException e) {
+        } catch (ClientErrorException e) {
             assertEquals(e.getResponse().getStatus(), Response.Status.NOT_FOUND.getStatusCode());
         }
     }
@@ -907,7 +907,7 @@ public class UserResourceIT extends AbstractRestIT {
 
             usersResource.entity("edanuff").get();
             assertFalse(true);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
         }
 
@@ -919,7 +919,7 @@ public class UserResourceIT extends AbstractRestIT {
             this.app().token().setToken(token2);
 
             usersResource.entity("edanuff").get();
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
         }
 
@@ -955,7 +955,7 @@ public class UserResourceIT extends AbstractRestIT {
             this.app().token().setToken(token3);
             usersResource.entity("edanuff").get();
 
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
         }
 
@@ -969,7 +969,7 @@ public class UserResourceIT extends AbstractRestIT {
 
 
             status = Response.Status.OK.getStatusCode();
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
         }
 
@@ -1002,7 +1002,7 @@ public class UserResourceIT extends AbstractRestIT {
             userResource.entity("test_1").connection("token").get(
                 new QueryParameters().addParam("access_token", "blah"), false);
             assertTrue(false);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
             log.info("Error Response Body: " + uie.getResponse().readEntity(String.class));
         }
@@ -1013,7 +1013,7 @@ public class UserResourceIT extends AbstractRestIT {
             userResource.entity("test_2").connection("token").get(
                 new QueryParameters().addParam("access_token", token.getAccessToken()), false);
             assertTrue(false);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
             log.info("Error Response Body: " + uie.getResponse().readEntity(String.class));
         }
@@ -1041,7 +1041,7 @@ public class UserResourceIT extends AbstractRestIT {
         try {
             this.app().token().post(new Token("test_1", "test123"));
             fail("request for deactivated user should fail");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             status = uie.getResponse().getStatus();
             JsonNode body = mapper.readTree(uie.getResponse().readEntity(String.class));
             assertEquals("user not activated", body.findPath("error_description").textValue());

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
index c4b24b4..0692667 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
@@ -21,7 +21,7 @@ import org.apache.usergrid.rest.test.resource.model.Collection;
 import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 
 import static org.junit.Assert.assertEquals;
@@ -54,7 +54,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }
@@ -80,7 +80,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }
@@ -106,7 +106,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }
@@ -132,7 +132,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }
@@ -158,7 +158,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }
@@ -184,7 +184,7 @@ public class BadGrammarQueryTest extends QueryTestBase {
             QueryParameters params = new QueryParameters().setQuery(query);
             this.app().collection(collectionName).get(params);
             fail("This should throw an exception");
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             //Check for an exception
             assertEquals(400, uie.getResponse().getStatus());
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
index fba7c66..f47fba0 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BasicGeoTests.java
@@ -22,7 +22,7 @@ import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -62,7 +62,7 @@ public class BasicGeoTests extends AbstractRestIT {
         try {
             node = this.app().collection( collectionType ).post( entityData ).getEntity();
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ) );
             fail( nodeError.get( "error" ).textValue() );
         }
@@ -100,7 +100,7 @@ public class BasicGeoTests extends AbstractRestIT {
         try {
             entity = this.app().collection( collectionType ).post( entityData ).getEntities().get(0);
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ) );
             fail( nodeError.get( "error" ).textValue() );
         }
@@ -116,7 +116,7 @@ public class BasicGeoTests extends AbstractRestIT {
         try {
             node = context.collection( collectionType ).get(entityName);
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
             fail( nodeError.get( "error" ).textValue() );
         }
@@ -134,7 +134,7 @@ public class BasicGeoTests extends AbstractRestIT {
             //entity.put(entityData);
 
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
             fail( nodeError.get( "error" ).textValue() );
         }
@@ -177,7 +177,7 @@ public class BasicGeoTests extends AbstractRestIT {
             node = this.app().collection( collectionType ).post( misspelledLatitudeEntityData ).getEntity();
             fail("System allowed misspelled location property - latitudee, which it should not");
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             //verify the correct error was returned
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ) );
             assertEquals( "illegal_argument", nodeError.get( "error" ).textValue() );
@@ -193,7 +193,7 @@ public class BasicGeoTests extends AbstractRestIT {
             node = this.app().collection( collectionType ).post( misspelledLongitudeEntityData ).getEntity();
             fail("System allowed misspelled location property - longitudee, which it should not");
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             //verify the correct error was returned
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "illegal_argument", nodeError.get( "error" ).textValue() );
@@ -224,7 +224,7 @@ public class BasicGeoTests extends AbstractRestIT {
             node = this.app().collection( collectionType ).post( latitudeOnlyEntityData ).getEntity();
             fail("System allowed location with only one point, latitude, which it should not");
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             //verify the correct error was returned
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "illegal_argument", nodeError.get( "error" ).textValue() );
@@ -240,7 +240,7 @@ public class BasicGeoTests extends AbstractRestIT {
             node = this.app().collection( collectionType ).post( notDoubleLatLonEntityData ).getEntity();
             fail("System allowed misspelled location values that are not doubles for latitude and longitude, which it should not");
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             //verify the correct error was returned
             JsonNode nodeError = mapper.readTree( e.getResponse().readEntity( String.class ));
             assertEquals( "illegal_argument", nodeError.get( "error" ).textValue() );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
index 7edc2a7..431d224 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AccessTokenIT.java
@@ -27,7 +27,7 @@ import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.apache.usergrid.rest.test.resource.model.Token;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.Response;
 
@@ -65,7 +65,7 @@ public class AccessTokenIT extends AbstractRestIT {
         Response.Status responseStatus = null;
         try {
             management().users().user( clientSetup.getUsername() ).get( ApiResponse.class);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -198,8 +198,8 @@ public class AccessTokenIT extends AbstractRestIT {
 
         try {
             management().token().post( Token.class,payload );
-        } catch (ResponseProcessingException uie) {
-            assertEquals(Response.Status.BAD_REQUEST, uie.getResponse().getStatus());
+        } catch (ClientErrorException uie) {
+            assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus());
         }
 
     }
@@ -218,7 +218,7 @@ public class AccessTokenIT extends AbstractRestIT {
 
         try {
             management().token().post( Token.class, payload );
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus());
         }
 
@@ -246,7 +246,7 @@ public class AccessTokenIT extends AbstractRestIT {
             management().users().user( clientSetup.getUsername() ).get();
             fail( "Token1 should have been revoked" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus());
         }
 
@@ -257,7 +257,7 @@ public class AccessTokenIT extends AbstractRestIT {
             management().users().user( clientSetup.getUsername() ).get();
             fail( "Token2 should have been revoked" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus());
         }
     }
@@ -287,7 +287,7 @@ public class AccessTokenIT extends AbstractRestIT {
             management().users().user( clientSetup.getUsername() ).get();
             fail( "Token1 should have been revoked" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus());
         }
 
@@ -297,7 +297,7 @@ public class AccessTokenIT extends AbstractRestIT {
             management().token().setToken( token2 );
             management().users().user( clientSetup.getUsername() ).get();
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "Token2 shouldn't have been revoked" );
 
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
index 09c49e1..9864e65 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/AdminUsersIT.java
@@ -31,7 +31,8 @@ import org.jvnet.mock_javamail.Mailbox;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMultipart;
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
+import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.Response;
 import java.io.IOException;
@@ -83,7 +84,7 @@ public class AdminUsersIT extends AbstractRestIT {
         try {
             management.token().post(false, Token.class, new Token( username, password ),null);
             fail( "We shouldn't be able to get a token using the old password" );
-        }catch(ResponseProcessingException uie) {
+        }catch(ClientErrorException uie) {
             errorParse( 400,"invalid_grant",uie );
         }
     }
@@ -120,7 +121,7 @@ public class AdminUsersIT extends AbstractRestIT {
             management.users().user( username ).password().post( Entity.class ,passwordPayload );
             fail("We shouldn't be able to change the password with the same payload");
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             errorParse( Response.Status.BAD_REQUEST.getStatusCode(),"auth_invalid_username_or_password",uie );
         }
 
@@ -146,14 +147,14 @@ public class AdminUsersIT extends AbstractRestIT {
 
         this.refreshIndex();
 
-        assertNotNull(management.token().post( false,Token.class, new Token( username, "testPassword" ) ,null ));
+        assertNotNull( management.token().post( false, Token.class, new Token(username, "testPassword"), null ));
 
 
-        //Check that we cannot get the token using the old password
+        // Check that we cannot get the token using the old password
         try {
             management.token().post( false,Token.class, new Token( username, password) ,null);
             fail( "We shouldn't be able to get a token using the old password" );
-        }catch(ResponseProcessingException uie) {
+        } catch(ClientErrorException uie) {
             errorParse( 400,"invalid_grant",uie );
         }
     }
@@ -236,7 +237,7 @@ public class AdminUsersIT extends AbstractRestIT {
                 management().token().get( queryParameters );
                 fail( "Admin user should not be able to log in." );
             }
-            catch ( ResponseProcessingException uie ) {
+            catch ( ClientErrorException uie ) {
                 assertEquals( "Admin user should have failed with 403", 403, uie.getResponse().getStatus() );
             }
 
@@ -494,7 +495,7 @@ public class AdminUsersIT extends AbstractRestIT {
 
             fail( "should fail with conflict" );
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             assertEquals( 409, e.getResponse().getStatus() );
         }
 
@@ -513,7 +514,7 @@ public class AdminUsersIT extends AbstractRestIT {
 
             fail( "should fail with conflict" );
         }
-        catch ( ResponseProcessingException e ) {
+        catch ( ClientErrorException e ) {
             assertEquals( 409, e.getResponse().getStatus() );
         }
     }
@@ -617,20 +618,24 @@ public class AdminUsersIT extends AbstractRestIT {
      * Makes sure you can't create a already existing organization from a user connection.
      * @throws Exception
      */
-    //TODO: figure out what is the expected behavior from this test. While it fails it is not sure what it should return
+    // TODO: figure out what is the expected behavior from this test.
+    // While it fails it is not sure what it should return
     @Test
     public void createOrgFromUserConnectionFail() throws Exception {
 
-        Token token = management().token().post(Token.class ,new Token( clientSetup.getUsername(),clientSetup.getPassword() ) );
+        Token token = management().token()
+            .post( Token.class, new Token( clientSetup.getUsername(), clientSetup.getPassword() ) );
         management().token().setToken( token );
+
         // try to create the same org again off the connection
         try {
-            management().users().user( clientSetup.getUsername() ).organizations().post( clientSetup.getOrganization(),token );
+            management().users().user( clientSetup.getUsername() ).organizations()
+                .post( clientSetup.getOrganization(), token );
 
             fail( "Should have thrown unique exception on org name" );
         }
-        catch ( ResponseProcessingException uie ) {
-            assertEquals(500,uie.getResponse().getStatus());
+        catch ( InternalServerErrorException ise ) {
+            assertEquals(500, ise.getResponse().getStatus());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
index a4f5f2d..939363f 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ExportResourceIT.java
@@ -23,7 +23,7 @@ import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Response;
 import java.util.HashMap;
 import java.util.Map;
@@ -48,7 +48,7 @@ public class ExportResourceIT extends AbstractRestIT {
             management().orgs().org( clientSetup.getOrganizationName() )
                         .app().addToPath( clientSetup.getAppUuid() ).addToPath( "export" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail("We got back " + uie.getResponse().getStatus() + " instead of having a successful call" );
         }
 
@@ -68,7 +68,7 @@ public class ExportResourceIT extends AbstractRestIT {
                         .app().addToPath( clientSetup.getAppUuid()).addToPath( "collection" )
                         .addToPath( "users" ).addToPath( "export" ).post(ApiResponse.class,payloadBuilder() );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -92,7 +92,7 @@ public class ExportResourceIT extends AbstractRestIT {
             exportEntity = management().orgs().org( clientSetup.getOrganizationName() )
                                        .addToPath( "export" ).post( ApiResponse.class, payloadBuilder() );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -106,7 +106,7 @@ public class ExportResourceIT extends AbstractRestIT {
             exportEntity = management().orgs().org( clientSetup.getOrganizationName() )
                                        .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -135,7 +135,7 @@ public class ExportResourceIT extends AbstractRestIT {
                                        .app().addToPath( clientSetup.getAppUuid() )
                                        .addToPath( "export" ).post( ApiResponse.class, payloadBuilder() );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -150,7 +150,7 @@ public class ExportResourceIT extends AbstractRestIT {
             exportEntity = management().orgs().org( clientSetup.getOrganizationName() )
                                        .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -180,7 +180,7 @@ public class ExportResourceIT extends AbstractRestIT {
             exportEntity = management().orgs().org( clientSetup.getOrganizationName() )
                                        .addToPath( "export" ).addToPath( uuid ).get( ApiResponse.class );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             fail( "We got back "+uie.getResponse().getStatus()+" instead of having a successful call" );
         }
 
@@ -201,7 +201,7 @@ public class ExportResourceIT extends AbstractRestIT {
                                        .addToPath( "export" ).addToPath( fake.toString() ).get( ApiResponse.class );
             fail( "Should not have been able to get fake uuid" );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
 
         }
@@ -219,7 +219,7 @@ public class ExportResourceIT extends AbstractRestIT {
                 new HashMap<String, Object>() );
             fail( "Should not have passed, The payload is empty." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -233,7 +233,7 @@ public class ExportResourceIT extends AbstractRestIT {
                         .addToPath( "export" ).post( ApiResponse.class, new HashMap<String, Object>()  );
             fail( "Should not have passed, The payload is empty." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -250,7 +250,7 @@ public class ExportResourceIT extends AbstractRestIT {
 
             fail( "Should not have passed, The payload is empty." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -267,7 +267,7 @@ public class ExportResourceIT extends AbstractRestIT {
                         .addToPath( "export" ).addToPath( fake.toString() ).get(ApiResponse.class ,false);
             fail( "Should not have passed as we didn't have an access token." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -283,7 +283,7 @@ public class ExportResourceIT extends AbstractRestIT {
                         .addToPath( "export" ).addToPath( fake.toString() ).get(ApiResponse.class ,false);
             fail( "Should not have passed as we didn't have an access token." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -298,7 +298,7 @@ public class ExportResourceIT extends AbstractRestIT {
                         .addToPath( "export" ).addToPath( fake.toString() ).get(ApiResponse.class ,false);
             fail( "Should not have passed as we didn't have an access token." );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.UNAUTHORIZED.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -317,7 +317,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -339,7 +339,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -361,7 +361,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -380,7 +380,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -402,7 +402,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -424,7 +424,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -445,7 +445,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -461,7 +461,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -477,7 +477,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -498,7 +498,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -515,7 +515,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -532,7 +532,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }
@@ -554,7 +554,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -572,7 +572,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
 
@@ -590,7 +590,7 @@ public class ExportResourceIT extends AbstractRestIT {
             fail( "Should not have passed as we were missing an important part of the payload" );
 
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             assertEquals( Response.Status.BAD_REQUEST.getStatusCode(), uie.getResponse().getStatus() );
         }
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
index c55f953..784ff67 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
@@ -49,7 +49,7 @@ import org.junit.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Response;
 import java.io.File;
 import java.util.ArrayList;
@@ -211,7 +211,7 @@ public class ImportResourceIT extends AbstractRestIT {
             this.management().orgs().org( org ).app().addToPath(app)
                 .addToPath("imports").addToPath(entity.getUuid().toString()).get();
             fail("Should not be able to read import job with unauthorized token");
-        } catch (ResponseProcessingException ex) {
+        } catch (ClientErrorException ex) {
             errorParse(401, "unauthorized", ex);
         }
 
@@ -229,7 +229,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);
@@ -249,7 +249,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);
@@ -271,7 +271,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);
@@ -294,7 +294,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);
@@ -307,7 +307,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);
@@ -320,7 +320,7 @@ public class ImportResourceIT extends AbstractRestIT {
 
         try {
             this.management().orgs().org( org ).app().addToPath(app).addToPath("imports").post(Entity.class,payload);
-        } catch (ResponseProcessingException uie) {
+        } catch (ClientErrorException uie) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
         assertEquals(Response.Status.BAD_REQUEST, responseStatus);

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
index 386f3b9..a26c8c7 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
@@ -30,7 +30,7 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -99,11 +99,12 @@ public class ManagementResourceIT extends AbstractRestIT {
     @Test
     public void crossOrgsNotViewable() throws Exception {
 
-        String username = "test" + UUIDUtils.newTimeUUID();
-        String name = "someguy2";
-        String email = "someguy" + "@usergrid.com";
+        String differentiator = UUIDUtils.newTimeUUID().toString();
+        String username = "test" + differentiator;
+        String name = "someguy2" + differentiator;
+        String email = "someguy" + differentiator + "@usergrid.com";
         String password = "password";
-        String orgName = "someneworg" + UUIDUtils.newTimeUUID();
+        String orgName = "someneworg" + differentiator;
 
         Entity payload =
                 new Entity().chainPut("company", "Apigee" );
@@ -121,7 +122,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             returnVal = this.management().orgs().org( orgName ).get(String.class);
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -133,7 +134,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             this.management().orgs().org( this.clientSetup.getOrganizationName() ).get( String.class );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -145,7 +146,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             this.management().orgs().org( this.clientSetup.getOrganizationName() ).get( String.class );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -336,7 +337,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             userdata = management.users().user(clientSetup.getEmail()).get();
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -455,7 +456,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
            management.token().post( JsonNode.class, payload );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus());
         }
 
@@ -476,7 +477,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             management.token().post( JsonNode.class, payload );
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             responseStatus = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -507,7 +508,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             response = management.users().user(clientSetup.getUsername()).get();
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -530,7 +531,7 @@ public class ManagementResourceIT extends AbstractRestIT {
         try {
             management.users().user(clientSetup.getUsername()).get();
         }
-        catch ( ResponseProcessingException uie ) {
+        catch ( ClientErrorException uie ) {
             status = Response.Status.fromStatusCode( uie.getResponse().getStatus() );
         }
 
@@ -589,7 +590,7 @@ public class ManagementResourceIT extends AbstractRestIT {
 
                 fail( "Validation should have failed" );
 
-            } catch (ResponseProcessingException actual) {
+            } catch (ClientErrorException actual) {
                 assertEquals( 404, actual.getResponse().getStatus() );
                 String errorMsg = actual.getResponse().readEntity( JsonNode.class )
                     .get( "error_description" ).toString();
@@ -640,7 +641,7 @@ public class ManagementResourceIT extends AbstractRestIT {
                 ApiResponse postResponse = pathResource( "management/token" ).post( false, ApiResponse.class, loginInfo );
                 fail( "Login as Admin User must fail when validate external tokens is enabled" );
 
-            } catch (ResponseProcessingException actual) {
+            } catch (ClientErrorException actual) {
                 assertEquals( 400, actual.getResponse().getStatus() );
                 String errorMsg = actual.getResponse().readEntity( JsonNode.class )
                     .get( "error_description" ).toString();
@@ -648,7 +649,7 @@ public class ManagementResourceIT extends AbstractRestIT {
                 assertTrue( errorMsg.contains( "Admin Users must login via" ) );
 
             } catch (Exception e) {
-                fail( "We expected a ResponseProcessingException" );
+                fail( "We expected a ClientErrorException" );
             }
 
             // login as superuser must succeed

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
index a0ebf6e..64ad8b0 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/OrganizationsIT.java
@@ -29,7 +29,7 @@ import org.apache.usergrid.persistence.index.utils.UUIDUtils;
 import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 import org.apache.usergrid.rest.test.resource.RestClient;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.Response;
 
@@ -123,7 +123,7 @@ public class OrganizationsIT extends AbstractRestIT {
             clientSetup.getRestClient().management().orgs().post( orgTestDuplicatePayload );
             fail("Should not have been able to create duplicate organization");
         }
-        catch ( ResponseProcessingException ex ) {
+        catch ( ClientErrorException ex ) {
             errorParse( 400,duplicateUniquePropertyExistsErrorMessage, ex );
         }
 
@@ -135,7 +135,7 @@ public class OrganizationsIT extends AbstractRestIT {
             tokenError = clientSetup.getRestClient().management().token().post(false,Token.class, tokenPayload,null );
             fail( "Should not have created user" );
         }
-        catch ( ResponseProcessingException ex ) {
+        catch ( ClientErrorException ex ) {
             errorParse( 400,invalidGrantErrorMessage, ex );
 
         }
@@ -179,7 +179,7 @@ public class OrganizationsIT extends AbstractRestIT {
             clientSetup.getRestClient().management().orgs().post( orgDuplicatePayload );
             fail( "Should not have created organization" );
         }
-        catch ( ResponseProcessingException ex ) {
+        catch ( ClientErrorException ex ) {
             errorParse( 400,duplicateUniquePropertyExistsErrorMessage,ex);
         }
 
@@ -190,7 +190,7 @@ public class OrganizationsIT extends AbstractRestIT {
             tokenError = clientSetup.getRestClient().management().token().post(false,Token.class, tokenPayload,null );
             fail( "Should not have created organization" );
         }
-        catch ( ResponseProcessingException ex ) {
+        catch ( ClientErrorException ex ) {
             errorParse( 400,invalidGrantErrorMessage,ex );
         }
 
@@ -222,7 +222,7 @@ public class OrganizationsIT extends AbstractRestIT {
         try{
             Organization organizationReturned = clientSetup.getRestClient().management().orgs().post(queryParameters);
             fail();
-        }catch (ResponseProcessingException e){
+        }catch (ClientErrorException e){
             assertEquals("ensure bad request",e.getResponse().getStatus(), 400);
         }
 
@@ -295,7 +295,7 @@ public class OrganizationsIT extends AbstractRestIT {
             //Delete default organization
             clientSetup.getRestClient().management().orgs().org( clientSetup.getOrganizationName() ).delete();
             fail( "Delete is not implemented yet" );
-        }catch(ResponseProcessingException uie){
+        }catch(ClientErrorException uie){
             assertEquals( Response.Status.NOT_IMPLEMENTED ,uie.getResponse().getStatus());
         }
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
index fc18292..efa1536 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
@@ -30,7 +30,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.mail.*;
 import javax.mail.internet.MimeMultipart;
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
 import java.io.IOException;
@@ -109,7 +109,7 @@ public class RegistrationIT extends AbstractRestIT {
                     .request()
                     .accept(MediaType.APPLICATION_JSON)
                     .put( javax.ws.rs.client.Entity.form(form) );
-            } catch (ResponseProcessingException e) {
+            } catch (ClientErrorException e) {
                 assertEquals("Should receive a 404 Not Found", 404, e.getResponse().getStatus());
             }
         } finally {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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
index cc5807e..4282853 100644
--- 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
@@ -29,10 +29,16 @@ import org.apache.usergrid.rest.test.resource.model.Token;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 import org.glassfish.jersey.client.ClientConfig;
 import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.test.DeploymentContext;
 import org.glassfish.jersey.test.JerseyTest;
+import org.glassfish.jersey.test.external.ExternalTestContainerFactory;
+import org.glassfish.jersey.test.spi.TestContainer;
+import org.glassfish.jersey.test.spi.TestContainerFactory;
 import org.junit.Rule;
 
-import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.ClientErrorException;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Application;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLClassLoader;
@@ -56,13 +62,14 @@ public class AbstractRestIT extends JerseyTest {
     @Rule
     public ClientSetup clientSetup = new ClientSetup( this.getBaseURI().toString() );
 
-//    protected static final Application descriptor;
-//
-//    public AbstractRestIT() {
-//        super( descriptor );
-//    }
+    protected static final Application descriptor = new Application();
 
 
+    @Override
+    protected Application configure() {
+        return descriptor;
+    }
+
     protected ObjectMapper mapper = new ObjectMapper();
 
     static {
@@ -109,10 +116,31 @@ public class AbstractRestIT extends JerseyTest {
         }
     }
 
-//    @Override
-//    protected TestContainerFactory getTestContainerFactory() {
-//        return new ExternalTestContainerFactory();
-//    }
+    @Override
+    protected TestContainerFactory getTestContainerFactory() {
+        final URI baseURI = getBaseURI();
+        return (uri, deploymentContext) -> new TestContainer() {
+            @Override
+            public ClientConfig getClientConfig() {
+                return clientConfig;
+            }
+
+            @Override
+            public URI getBaseUri() {
+                return baseURI;
+            }
+
+            @Override
+            public void start() {
+                // noop
+            }
+
+            @Override
+            public void stop() {
+                // noop
+            }
+        };
+    }
 
     ///myorg/
     protected OrganizationResource org(){
@@ -151,13 +179,13 @@ public class AbstractRestIT extends JerseyTest {
 
 
     /**
-     * Takes in the expectedStatus message and the expectedErrorMessage then compares it to the ResponseProcessingException
+     * Takes in the expectedStatus message and the expectedErrorMessage then compares it to the ClientErrorException
      * to make sure that we got what we expected.
      * @param expectedStatus
      * @param expectedErrorMessage
      * @param uie
      */
-    public void errorParse(int expectedStatus, String expectedErrorMessage, ResponseProcessingException uie){
+    public void errorParse(int expectedStatus, String expectedErrorMessage, ClientErrorException uie){
         assertEquals(expectedStatus,uie.getResponse().getStatus());
         JsonNode errorJson = uie.getResponse().readEntity( JsonNode.class );
         assertEquals( expectedErrorMessage, errorJson.get( "error" ).asText() );
@@ -165,16 +193,16 @@ public class AbstractRestIT extends JerseyTest {
     }
 
 
-    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(String username, String password) {
+        Token token = new Token(username, password);
+        return this.clientSetup.getRestClient().management().token()
+            .post( false, Token.class, token, 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
-        );
+    protected Token getAdminToken() {
+        Token token = new Token(this.clientSetup.getUsername(), this.clientSetup.getPassword());
+        return this.clientSetup.getRestClient().management().token()
+            .post( false, Token.class, token, null, false);
     }
     public Map<String, Object> getRemoteTestProperties() {
         return clientSetup.getRestClient().testPropertiesResource().get().getProperties();

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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
index 3254173..f13e215 100644
--- 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
@@ -30,6 +30,7 @@ import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.BadRequestException;
 import java.io.IOException;
 
 
@@ -95,7 +96,7 @@ public class ClientSetup implements TestRule {
         try {
             restClient.superuserSetup();
             superuserToken = restClient.management().token().get(superuserName, superuserPassword);
-        } catch ( Exception e ) {
+        } catch ( BadRequestException e ) {
             if ( logger.isDebugEnabled() ) {
                 logger.debug( "Error creating superuser, may already exist", e );
             } else {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/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
index 23fa6c3..827f874 100644
--- 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
@@ -22,6 +22,7 @@ import org.apache.usergrid.rest.test.resource.endpoints.mgmt.ManagementResource;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
 import org.glassfish.jersey.client.ClientConfig;
 import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import org.glassfish.jersey.media.multipart.MultiPartFeature;
 
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
@@ -40,7 +41,9 @@ public class RestClient implements UrlResource {
 
     public WebTarget resource;
     ClientConfig config = new ClientConfig();
-    Client client = ClientBuilder.newClient( config );
+
+    Client client = ClientBuilder.newClient( config )
+        .register(MultiPartFeature.class);
 
     /**
      *
@@ -111,9 +114,11 @@ public class RestClient implements UrlResource {
     }
 
     public void superuserSetup() {
-        this.getTarget().path( "system/superuser/setup" ).request()
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "superuser")
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "superpassword" )
+
+        HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
+            .credentials( "superuser", "superpassword" ).build();
+
+        getTarget().path( "system/superuser/setup" ).register( feature ).request()
             .accept( MediaType.APPLICATION_JSON )
             .get( JsonNode.class );
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
index 336d709..34e3a84 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
@@ -22,8 +22,10 @@ import org.apache.usergrid.rest.test.resource.model.Entity;
 import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 import org.apache.usergrid.rest.test.resource.model.Token;
 import org.apache.usergrid.rest.test.resource.state.ClientContext;
-import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import static org.glassfish.jersey.client.authentication.HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME;
+import static org.glassfish.jersey.client.authentication.HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
+import org.glassfish.jersey.media.multipart.MultiPart;
 
 import javax.ws.rs.client.Invocation;
 import javax.ws.rs.client.WebTarget;
@@ -46,11 +48,10 @@ public class NamedResource implements UrlResource {
 
     protected final String name;
     protected final ClientContext context;
-    /* Stores the path of the parent that called it.
-    i.e If we had a ApplicationResource ( an instance of a namedResource ) this would contain the OrganizationResource.
-     */
-    protected final UrlResource parent;
 
+    /** Stores the path of the parent that called it. i.e If we had a ApplicationResource
+       (an instance of a namedResource) this would contain the OrganizationResource. */
+    protected final UrlResource parent;
 
     public NamedResource( final String name, final ClientContext context, final UrlResource parent ) {
         this.name = name;
@@ -58,7 +59,6 @@ public class NamedResource implements UrlResource {
         this.parent = parent;
     }
 
-
     @Override
     public String getPath() {
         return name + getMatrix();
@@ -68,17 +68,19 @@ public class NamedResource implements UrlResource {
     public WebTarget getTarget() {
         return getTarget( false );
     }
+
     public WebTarget getTarget(boolean useToken) {
         return getTarget( useToken, null );
     }
-    public WebTarget getTarget(boolean useToken,Token token) {
+
+    public WebTarget getTarget(boolean useToken, Token token) {
         WebTarget resource = parent.getTarget().path( getPath() );
         token = token !=null ? token : this.context.getToken();
         //error checking
         if (token == null) {
             return resource;
         }
-        return  useToken    ? resource.queryParam("access_token",token.getAccessToken()) :  resource;
+        return useToken ? resource.queryParam("access_token", token.getAccessToken()) :  resource;
     }
 
     protected WebTarget addParametersToResource(WebTarget resource, final QueryParameters parameters){
@@ -246,8 +248,10 @@ public class NamedResource implements UrlResource {
 
 
         if ( useBasicAuthentication ) {
-            builder = builder.property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "superuser")
-                             .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "superpassword");
+            String uname = (String)entity.get("username");
+            String pword = (String)entity.get("password");
+            builder = builder.property( HTTP_AUTHENTICATION_BASIC_USERNAME, uname )
+                             .property( HTTP_AUTHENTICATION_BASIC_PASSWORD, pword );
         }
 
         // it's OK for the entity to be null
@@ -258,7 +262,7 @@ public class NamedResource implements UrlResource {
 
     //For edge cases like Organizations and Tokens without any payload
     public <T> T get(Class<T> type) {
-        return get(type,null,true);
+        return get(type, null, true);
 
     }
 
@@ -273,9 +277,9 @@ public class NamedResource implements UrlResource {
         return get( type, queryParameters, true );
     }
 
-    public <T> T get(Class<T> type,QueryParameters queryParameters, boolean useToken) {
+    public <T> T get(Class<T> type, QueryParameters queryParameters, boolean useToken) {
         WebTarget resource = getTarget( useToken );
-        if(queryParameters!=null) {
+        if (queryParameters != null) {
             resource = addParametersToResource(resource, queryParameters);
         }
         GenericType<T> gt = new GenericType<>((Class) type);
@@ -289,13 +293,13 @@ public class NamedResource implements UrlResource {
         return "";
     }
 
-    public ApiResponse post( boolean useToken, FormDataMultiPart multiPartForm ) {
+    public ApiResponse post( boolean useToken, MultiPart multiPartForm ) {
         WebTarget resource = getTarget( useToken );
         return resource.request().post(
             javax.ws.rs.client.Entity.entity( multiPartForm, multiPartForm.getMediaType() ), ApiResponse.class );
     }
 
-    public ApiResponse post( FormDataMultiPart multiPartForm ) {
+    public ApiResponse post( MultiPart multiPartForm ) {
         return post( true, multiPartForm );
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
index 75f1b6b..f11b062 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
@@ -39,10 +39,10 @@ public class SetupResource extends NamedResource {
         WebTarget resource = getTarget();
         resource = addParametersToResource( resource, queryParameters );
 
-        return resource.request()
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_USERNAME, "superuser")
-            .property( HttpAuthenticationFeature.HTTP_AUTHENTICATION_BASIC_PASSWORD, "superpassword" )
-            .accept( MediaType.APPLICATION_JSON )
-            .get( Entity.class );
+        HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
+            .credentials( "superuser", "superpassword" ).build();
+
+        return resource.register( feature ).request()
+            .accept( MediaType.APPLICATION_JSON ).get( Entity.class );
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
index 096422c..0569ac2 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/mgmt/OrgResource.java
@@ -28,7 +28,10 @@ import org.apache.usergrid.rest.test.resource.state.ClientContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.client.Entity;
+import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
@@ -100,11 +103,14 @@ public class OrgResource  extends NamedResource {
     public Organization post(Organization organization){
 
         // use string type so we can log actual response from server
-        String responseString = getTarget(false).request()
-            .accept( MediaType.APPLICATION_JSON )
-            .post( Entity.json(organization), String.class );
-
-        logger.debug("Response from post: " + responseString);
+        String responseString = null;
+        try {
+            responseString = getTarget( false ).request()
+                .accept( MediaType.APPLICATION_JSON )
+                .post( Entity.json( organization ), String.class );
+        } catch ( ClientErrorException e ) {
+            logger.info("Response from post: " + e.getMessage() + ": " + e.getResponse().readEntity( String.class ));
+        }
 
         ObjectMapper mapper = new ObjectMapper();
         ApiResponse response;
@@ -120,9 +126,9 @@ public class OrgResource  extends NamedResource {
         return org;
     }
     public Organization post(Organization organization, Token token){
-        ApiResponse response = getTarget(true,token).request()
+        ApiResponse response = getTarget( true, token ).request()
             .accept( MediaType.APPLICATION_JSON )
-            .post( Entity.json(organization), ApiResponse.class );
+            .post( Entity.json( organization ), ApiResponse.class );
 
         Organization org = new Organization(response);
         org.setOwner( response );
@@ -134,7 +140,7 @@ public class OrgResource  extends NamedResource {
 
         // use string type so we can log actual response from server
         String responseString = getTarget().request()
-            .accept(MediaType.APPLICATION_JSON)
+            .accept( MediaType.APPLICATION_JSON )
             .post( Entity.json( organization ), String.class );
 
         logger.debug("Response from put: " + responseString);

http://git-wip-us.apache.org/repos/asf/usergrid/blob/eb2aa6ff/stack/rest/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/log4j.properties b/stack/rest/src/test/resources/log4j.properties
index 71dd540..201550b 100644
--- a/stack/rest/src/test/resources/log4j.properties
+++ b/stack/rest/src/test/resources/log4j.properties
@@ -18,7 +18,7 @@
 # and the pattern to %c instead of %l.  (%l is slower.)
 
 # output messages into a rolling log file as well as stdout
-log4j.rootLogger=WARN,stdout
+log4j.rootLogger=ERROR,stdout
 
 # stdout
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
@@ -26,12 +26,12 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) %c{1} - %m%n
 
+log4j.logger.org.glassfish=DEBUG
+log4j.logger.org.apache.shiro=DEBUG
 log4j.logger.org.apache.usergrid=INFO
+
 #log4j.logger.org.apache.usergrid.cassandra=DEBUG
 #log4j.logger.org.apache.usergrid.persistence.cassandra=DEBUG
-log4j.category.org.apache=ERROR
-log4j.category.org.apache.usergrid=WARN
-log4j.category.org.apache.usergrid.rest=INFO
 
 log4j.logger.org.apache.usergrid.persistence.cassandra.CounterUtils=ERROR
 log4j.logger.org.apache.usergrid.persistence.cassandra.DB=WARN
@@ -46,6 +46,20 @@ log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR
 log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG
 log4j.logger.org.apache.usergrid.rest.filters.MeteringFilter=ERROR
 
+log4j.logger.org.apache.usergrid.rest=DEBUG
+log4j.logger.org.apache.usergrid.rest.exceptions=DEBUG
+
+#log4j.logger.org.apache.usergrid.rest.NotificationsIT=DEBUG
+#log4j.logger.org.apache.usergrid.cassandra.CassandraResource=DEBUG
+#log4j.logger.org.apache.usergrid.rest.TomcatResource=INFO
+#log4j.logger.org.apache.usergrid.rest.management=DEBUG
+#log4j.logger.org.apache.usergrid.rest.management.users=DEBUG
+#log4j.logger.org.apache.usergrid.rest.organizations.users=DEBUG
+#log4j.logger.org.apache.usergrid.rest.applications.users.UsersResource=DEBUG
+#log4j.logger.org.apache.usergrid.rest.applications.ServiceResource=DEBUG
+#log4j.logger.org.apache.usergrid.rest.security=DEBUG
+#log4j.logger.org.apache.usergrid.security=DEBUG
+
 #log4j.logger.org.apache.usergrid.corepersistence=DEBUG
 #log4j.logger.org.apache.usergrid.corepersistence.CpRelationManager=DEBUG
 #log4j.logger.org.apache.usergrid.corepersistence.CpEntityManager=DEBUG
@@ -69,19 +83,7 @@ log4j.logger.org.apache.usergrid.rest.filters.MeteringFilter=ERROR
 #log4j.logger.org.apache.usergrid.services.notifiers=DEBUG
 #log4j.logger.org.apache.usergrid.services.groups.users.devices=DEBUG
 
-log4j.logger.org.apache.usergrid.rest=DEBUG
-log4j.logger.org.apache.usergrid.rest.exceptions=DEBUG
-#log4j.logger.org.apache.usergrid.rest.NotificationsIT=DEBUG
-#log4j.logger.org.apache.usergrid.cassandra.CassandraResource=DEBUG
-#log4j.logger.org.apache.usergrid.rest.TomcatResource=INFO
-#log4j.logger.org.apache.usergrid.rest.management=DEBUG
-#log4j.logger.org.apache.usergrid.rest.management.users=DEBUG
-#log4j.logger.org.apache.usergrid.rest.organizations.users=DEBUG
-#log4j.logger.org.apache.usergrid.rest.applications.users.UsersResource=DEBUG
-#log4j.logger.org.apache.usergrid.rest.applications.ServiceResource=DEBUG
-#log4j.logger.org.apache.usergrid.rest.security=DEBUG
-#log4j.logger.org.apache.usergrid.security=DEBUG
-
 #log4j.logger.org.elasticsearch=DEBUG
 #log4j.logger.com.netflix.hystrix=DEBUG
 #log4j.logger.org.antlr=DEBUG
+


Mime
View raw message