Merge branch 'two-dot-o-dev' into usergrid-103-upgrade-jersey

Conflicts:
        stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
        
stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
        stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
        
stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
        
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
        
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
        
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java


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

Branch: refs/heads/two-dot-o-dev
Commit: 1f77ca167b29b2ab847b8e1e0dae09332993bdd1
Parents: 3749e74 bc3ce1b
Author: Dave Johnson <[email protected]>
Authored: Tue Sep 8 17:05:47 2015 -0400
Committer: Dave Johnson <[email protected]>
Committed: Tue Sep 8 17:05:47 2015 -0400

----------------------------------------------------------------------
 README.md                                       |   3 +-
 portal/bower.json                               |   2 +-
 portal/js/data/data-controller.js               |   1 -
 portal/js/global/page-controller.js             |   3 +-
 portal/js/global/ug-service.js                  |  19 +-
 portal/js/login/login-controller.js             |   5 +
 portal/package.json                             |   2 +-
 stack/awscluster/gatling-cluster-cf.json        |   2 +-
 .../src/main/groovy/configure_usergrid.groovy   |   5 +-
 .../main/resources/usergrid-default.properties  |  67 +++---
 .../src/test/resources/usergrid-test.properties |   8 +-
 .../usergrid/corepersistence/CoreModule.java    |  18 +-
 .../corepersistence/CpEntityManager.java        |  14 +-
 .../corepersistence/CpEntityManagerFactory.java |  20 +-
 .../usergrid/corepersistence/CpSetup.java       |   3 +-
 .../asyncevents/AmazonAsyncEventService.java    |   4 +-
 .../index/ApplicationIndexLocationStrategy.java |   3 +-
 .../corepersistence/index/CoreIndexFig.java     |  13 +-
 .../index/ManagementIndexLocationStrategy.java  |   9 +-
 .../results/EntityQueryExecutor.java            |   3 +-
 .../service/AggregationService.java             |  64 +++++
 .../service/AggregationServiceFactory.java      |  27 +++
 .../service/AggregationServiceImpl.java         | 114 +++++++++
 .../service/ApplicationService.java             |  32 +++
 .../service/ApplicationServiceImpl.java         | 134 +++++++++++
 .../corepersistence/util/CpNamingUtils.java     |   2 +-
 .../apache/usergrid/count/SimpleBatcher.java    |   2 +-
 .../usergrid/persistence/AbstractEntity.java    |  22 +-
 .../org/apache/usergrid/persistence/Entity.java |   9 +-
 .../persistence/EntityManagerFactory.java       |  10 +
 .../org/apache/usergrid/persistence/Query.java  |   4 +-
 .../usergrid/persistence/cassandra/Setup.java   |  14 +-
 .../main/resources/usergrid-core-context.xml    |   6 +-
 .../java/org/apache/usergrid/Application.java   |   7 +
 .../org/apache/usergrid/CoreApplication.java    |   4 +
 .../java/org/apache/usergrid/CoreITSetup.java   |   3 +
 .../org/apache/usergrid/CoreITSetupImpl.java    |   6 +
 .../corepersistence/AggregationServiceTest.java |  79 +++++++
 .../corepersistence/CpEntityMapUtilsTest.java   |  81 +++++++
 .../corepersistence/StaleIndexCleanupTest.java  |  13 +-
 .../corepersistence/index/IndexNamingTest.java  |  23 +-
 .../persistence/ApplicationServiceIT.java       |  99 ++++++++
 .../usergrid/persistence/CoreSchemaManager.java |   2 +-
 .../usergrid/persistence/EntityManagerIT.java   |   8 +-
 .../apache/usergrid/persistence/IndexIT.java    |   6 +-
 .../cassandra/EntityManagerFactoryImplIT.java   |   2 +-
 .../resources/usergrid-custom-test.properties   |   6 +-
 .../usergrid-scheduler-test.properties          |   2 +
 .../persistence/collection/MvccEntity.java      |   8 +
 .../mvcc/entity/impl/MvccEntityImpl.java        |  30 ++-
 .../collection/mvcc/stage/delete/MarkStart.java |   2 +-
 .../serialization/SerializationFig.java         |   2 +-
 .../MvccEntitySerializationStrategyImpl.java    |   4 +-
 .../MvccEntitySerializationStrategyV3Impl.java  |  31 ++-
 ...ccEntitySerializationStrategyV3ImplTest.java |   1 -
 .../src/test/resources/dynamic-test.properties  |   3 +
 .../src/test/resources/usergrid-CHOP.properties |   3 +
 .../src/test/resources/usergrid-UNIT.properties |   3 +
 .../src/test/resources/usergrid.properties      |   3 +-
 .../persistence/core/astyanax/CassandraFig.java |   2 +-
 .../core/executor/TaskExecutorFactory.java      |  64 ++++-
 .../persistence/core/guice/CommonModule.java    |   2 +
 .../core/guice/SettingsValidationCluster.java   |  26 +++
 .../persistence/core/guicyfig/ClusterFig.java   |  14 +-
 .../guice/SettingsValidationClusterTest.java    |  39 ++++
 .../src/test/resources/usergrid-UNIT.properties |   3 +
 .../src/test/resources/usergrid.properties      |   3 +-
 .../graph/impl/SimpleSearchEdgeType.java        |   4 +-
 .../graph/impl/SimpleSearchIdType.java          |   3 +-
 .../shard/impl/ShardGroupCompactionImpl.java    |   2 +-
 .../persistence/graph/GraphManagerIT.java       |   5 +-
 .../graph/test/util/EdgeTestUtils.java          |   2 +-
 .../src/test/resources/usergrid-AWS.properties  |   2 +
 .../src/test/resources/usergrid-CHOP.properties |   3 +
 .../test/resources/usergrid-SHARD.properties    |   3 +
 .../src/test/resources/usergrid-UNIT.properties |   3 +
 .../src/test/resources/usergrid.properties      |   3 +-
 .../persistence/model/entity/Entity.java        |   3 +
 .../model/entity/EntityToMapConverter.java      |   5 +-
 .../model/entity/MapToEntityConverter.java      |  19 +-
 .../model/field/value/EntityObject.java         |  10 +
 stack/corepersistence/queryindex/pom.xml        |   7 +
 .../usergrid/persistence/index/EntityIndex.java |  56 +++--
 .../usergrid/persistence/index/IndexFig.java    |  13 +-
 .../persistence/index/guice/IndexModule.java    |   6 +-
 .../index/impl/EntityToMapConverter.java        |   5 +-
 .../index/impl/EsEntityIndexImpl.java           |  51 +++-
 .../persistence/index/impl/IndexingUtils.java   |   2 +
 .../EsIndexMappingMigrationPlugin.java          | 148 ++++++++++++
 .../persistence/index/usergrid-mappings.json    |   5 +
 .../persistence/index/impl/EntityIndexTest.java |  87 +++++--
 .../impl/EsIndexMappingMigrationPluginTest.java |  64 +++++
 .../src/test/resources/dynamic-test.properties  |   2 +
 .../src/test/resources/usergrid-CHOP.properties |   3 +
 .../src/test/resources/usergrid-UNIT.properties |   5 +-
 .../src/test/resources/usergrid.properties      |   3 +-
 .../usergrid/persistence/queue/QueueFig.java    |  27 ++-
 .../usergrid/persistence/queue/QueueScope.java  |   8 +-
 .../queue/impl/SNSQueueManagerImpl.java         | 124 +++++-----
 .../persistence/queue/QueueManagerTest.java     |   2 +-
 .../resources/usergrid-standalone.properties    |   5 +-
 stack/loadtests/.gitignore                      |   1 +
 stack/loadtests/README.md                       | 234 +++++++++++++++----
 stack/loadtests/pom.xml                         |  13 +-
 .../runAuditGetAllAppCollectionEntities.sh      |  68 ++++++
 .../loadtests/runAuditGetCollectionEntities.sh  |   1 +
 .../runAuditVerifyCollectionEntities.sh         |   1 +
 stack/loadtests/runCollectionQueryTest.sh       |   3 +-
 .../runCustomInjectRandomEntityByUuidTest.sh    |   1 +
 stack/loadtests/runDeleteEntities.sh            |   1 +
 .../loadtests/runGetEntitiesByNameSequential.sh |   1 +
 stack/loadtests/runGetEntitiesByUuid.sh         |  92 ++++++++
 stack/loadtests/runLoadEntities.sh              |   1 +
 .../loadtests/runLoadLargeMultiFieldEntities.sh | 107 +++++++++
 stack/loadtests/runLoadNoNameEntities.sh        |   1 +
 stack/loadtests/runLoadSortableEntities.sh      |   3 +-
 stack/loadtests/runOrgAppSetup.sh               |  88 +++++++
 .../loadtests/runRandomEntityByNameQueryTest.sh |  91 ++++++++
 stack/loadtests/runRandomEntityByNameTest.sh    |   5 +-
 stack/loadtests/runRandomEntityByUuidTest.sh    |  84 -------
 stack/loadtests/runUpdateEntities.sh            |   1 +
 stack/loadtests/runtests.sh                     | 120 ----------
 stack/loadtests/runtests_deprecated.sh          | 120 ++++++++++
 .../datagenerators/EntityDataGenerator.scala    |  19 +-
 .../datagenerators/FeederGenerator.scala        |   8 +-
 .../usergrid/enums/ConfigProperties.scala       |  27 ++-
 .../usergrid/enums/CsvFeedPatternType.scala     |  30 +++
 .../org/apache/usergrid/enums/EntityType.scala  |   3 +-
 .../apache/usergrid/enums/ScenarioType.scala    |   3 +-
 .../org/apache/usergrid/helpers/Headers.scala   |  63 +++++
 .../org/apache/usergrid/helpers/Setup.scala     |  39 +++-
 .../org/apache/usergrid/helpers/Utils.scala     |   3 +-
 .../scenarios/ApplicationScenarios.scala        |   3 +-
 .../usergrid/scenarios/AuditScenarios.scala     |  23 +-
 .../scenarios/ConnectionScenarios.scala         |   3 +-
 .../usergrid/scenarios/DeviceScenarios.scala    |   3 +-
 .../scenarios/EntityCollectionScenarios.scala   |  21 +-
 .../usergrid/scenarios/EntityScenarios.scala    |   2 +-
 .../usergrid/scenarios/GeoScenarios.scala       |   4 +-
 .../scenarios/NotificationScenarios.scala       |   3 +-
 .../usergrid/scenarios/NotifierScenarios.scala  |   3 +-
 .../scenarios/OrganizationScenarios.scala       |   3 +-
 .../usergrid/scenarios/TokenScenarios.scala     |   2 +-
 .../usergrid/scenarios/UserScenarios.scala      |   4 +-
 .../org/apache/usergrid/settings/Headers.scala  |  62 -----
 .../org/apache/usergrid/settings/Settings.scala |  75 +++++-
 .../usergrid/simulations/AuditSimulation.scala  |   6 +-
 .../simulations/ConfigurableSimulation.scala    |   3 +-
 .../simulations/CustomInjectionSimulation.scala |   2 +-
 .../simulations/deprecated/AppSimulation.scala  |   2 +-
 .../deprecated/ConnectionsSimulation.scala      |   2 +-
 .../deprecated/DeleteUsersSimulation.scala      |   2 +-
 .../deprecated/GetEntitySimulation.scala        |   2 +-
 .../deprecated/GetUserPagesSimulation.scala     |   2 +-
 .../deprecated/GetUsersSimulation.scala         |   2 +-
 .../deprecated/PostCustomEntitySimulation.scala |   2 +-
 .../deprecated/PostUsersSimulation.scala        |   2 +-
 .../PushNotificationTargetUserSimulation.scala  |   2 +-
 .../deprecated/PutCustomEntitySimulation.scala  |   2 +-
 .../deprecated/PutUsersSimulation.scala         |   2 +-
 .../deprecated/SetupSimulation.scala            |   2 +-
 stack/loadtests/src/test/resources/gatling.conf |   6 +-
 .../src/test/resources/logback-test.xml         |   2 +-
 stack/loadtests/src/test/resources/logback.xml  |   2 +-
 stack/loadtests/src/test/scala/Engine.scala     |   5 +-
 .../src/test/scala/IDEPathHelper.scala          |  13 +-
 stack/loadtests/src/test/scala/Recorder.scala   |   8 +-
 stack/loadtests/testConfig.sh                   |   5 +
 stack/pom.xml                                   |   1 +
 .../resources/usergrid-custom-test.properties   |   5 +-
 .../usergrid/rest/ApplicationsResource.java     |  99 ++++++++
 .../apache/usergrid/rest/DatabaseResource.java  |  99 ++++++++
 .../apache/usergrid/rest/SystemResource.java    |  51 ++--
 .../rest/applications/ServiceResource.java      |  24 +-
 .../applications/ApplicationResource.java       |  70 +++++-
 .../resources/usergrid-rest-deploy-context.xml  |   2 +-
 .../usergrid/rest/CollectionMetadataIT.java     | 141 +++++++++++
 .../apache/usergrid/rest/SystemResourceIT.java  |  47 +++-
 .../collection/users/UserResourceIT.java        |   3 +-
 .../rest/management/ManagementResourceIT.java   |  44 +++-
 .../resource/endpoints/BoostrapResource.java    |  49 ++++
 .../resource/endpoints/DatabaseResource.java    |   4 +
 .../test/resource/endpoints/NamedResource.java  |  27 ++-
 .../test/resource/endpoints/SetupResource.java  |   2 +-
 .../test/resource/endpoints/SystemResource.java |  32 ++-
 .../rest/test/resource/model/Entity.java        |   2 +
 .../test/resource/model/QueryParameters.java    |   8 +
 .../resources/corepersistence-UNIT.properties   |   3 +
 .../resources/usergrid-custom-test.properties   |   4 +-
 stack/scripts/migrate_entity_data.py            |  42 +++-
 .../management/AccountCreationProps.java        |   2 -
 .../usergrid/management/ManagementService.java  |  15 ++
 .../cassandra/ManagementServiceImpl.java        | 219 ++++++++++-------
 .../usergrid/services/AbstractService.java      |  28 ++-
 .../usergrid/services/ServiceManager.java       |  14 +-
 .../usergrid/services/ServiceRequest.java       |  50 ++--
 .../notifications/ApplicationQueueManager.java  |   2 +-
 .../notifications/NotificationsService.java     |   5 +-
 .../services/notifications/QueueListener.java   |   6 +-
 .../usergrid/services/queues/QueueListener.java |   2 +-
 .../resources/usergrid-custom-test.properties   |   3 +-
 201 files changed, 3626 insertions(+), 916 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
index 0000000,86adbcc..b702276
mode 000000,100644..100644
--- 
a/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
+++ 
b/stack/rest/src/main/java/org/apache/usergrid/rest/ApplicationsResource.java
@@@ -1,0 -1,100 +1,99 @@@
+ /*
+  *
+  *  * 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;
+ 
 -import com.sun.jersey.api.json.JSONWithPadding;
 -import org.apache.usergrid.persistence.Entity;
++import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+ import org.apache.usergrid.persistence.EntityManager;
+ import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+ import org.springframework.context.annotation.Scope;
+ import org.springframework.stereotype.Component;
+ 
+ import javax.ws.rs.*;
+ import javax.ws.rs.core.Context;
+ import javax.ws.rs.core.MediaType;
+ import javax.ws.rs.core.UriInfo;
+ import java.util.HashMap;
+ import java.util.Map;
+ import java.util.UUID;
+ import java.util.concurrent.atomic.AtomicInteger;
+ 
+ /**
+  * Classy class class.
+  */
+ @Component
+ @Scope( "singleton" )
+ @Produces( {
+     MediaType.APPLICATION_JSON, "application/javascript", 
"application/x-javascript", "text/ecmascript",
+     "application/ecmascript", "text/jscript"
+ } )
+ public class ApplicationsResource extends AbstractContextResource {
+ 
+     private static final Logger logger = 
LoggerFactory.getLogger(ApplicationsResource.class);
+ 
+ 
+     public ApplicationsResource() {
 -
+         logger.info( "ApplicationsResource initialized" );
 -    } {
 -
+     }
+ 
+     @RequireSystemAccess
+     @DELETE
++    @JSONP
+     @Path( "{applicationId}" )
 -    public JSONWithPadding clearApplication( @Context UriInfo ui,
 -                                             @PathParam("applicationId") UUID 
applicationId,
 -                                             @QueryParam( 
"confirmApplicationName" ) String confirmApplicationName,
 -                                             @QueryParam( "callback" ) 
@DefaultValue( "callback" ) String callback )
++    public ApiResponse clearApplication( @Context UriInfo ui,
++        @PathParam("applicationId") UUID applicationId,
++        @QueryParam( "confirmApplicationName" ) String confirmApplicationName,
++        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback 
)
++
+         throws Exception {
+ 
+         if(confirmApplicationName == null){
+             throw new IllegalArgumentException("please make add a QueryString 
for confirmApplicationName");
+         }
+ 
+         final EntityManager em =  emf.getEntityManager(applicationId);
+         final String name =  em.getApplication().getApplicationName();
+         if(!name.toLowerCase().equals(confirmApplicationName.toLowerCase())){
 -            throw new IllegalArgumentException("confirmApplicationName: " + 
confirmApplicationName + " does not equal " + name);
++            throw new IllegalArgumentException(
++                "confirmApplicationName: " + confirmApplicationName + " does 
not equal " + name);
+         }
+         final ApiResponse response = createApiResponse();
+         response.setAction( "clear application" );
+ 
+         logger.info( "clearing up application" );
+         final AtomicInteger itemsDeleted = new AtomicInteger(0);
+         try {
+             management.deleteAllEntities(applicationId)
+                 .count()
+                 .doOnNext(count -> itemsDeleted.set(count))
+                 .toBlocking().lastOrDefault(0);
+         }
+         catch ( Exception e ) {
+             logger.error( "Unable to delete all items, deleted: " + 
itemsDeleted.get(), e );
+         }
+         Map<String,Object> data = new HashMap<>();
+         data.put("count",itemsDeleted.get());
+         response.setData(data);
+         response.setSuccess();
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/main/java/org/apache/usergrid/rest/DatabaseResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/main/java/org/apache/usergrid/rest/DatabaseResource.java
index 0000000,a8c5fee..2b13e81
mode 000000,100644..100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/DatabaseResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/DatabaseResource.java
@@@ -1,0 -1,98 +1,99 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package org.apache.usergrid.rest;
+ 
+ 
+ import javax.ws.rs.DefaultValue;
+ import javax.ws.rs.PUT;
+ import javax.ws.rs.Path;
+ import javax.ws.rs.Produces;
+ import javax.ws.rs.QueryParam;
+ import javax.ws.rs.core.Context;
+ import javax.ws.rs.core.MediaType;
+ import javax.ws.rs.core.UriInfo;
+ 
++import com.fasterxml.jackson.jaxrs.json.annotation.JSONP;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
+ import org.springframework.context.annotation.Scope;
+ import org.springframework.stereotype.Component;
+ 
+ import org.apache.usergrid.rest.security.annotations.RequireSystemAccess;
+ 
 -import com.sun.jersey.api.json.JSONWithPadding;
 -
+ 
+ @Component
+ @Scope( "singleton" )
+ @Produces( {
+     MediaType.APPLICATION_JSON, "application/javascript", 
"application/x-javascript", "text/ecmascript",
+     "application/ecmascript", "text/jscript"
+ } )
+ public class DatabaseResource extends AbstractContextResource {
+ 
+     private static final Logger logger = LoggerFactory.getLogger( 
DatabaseResource.class );
+ 
+ 
+     public DatabaseResource() {
+         logger.info( "DatabaseResource initialized" );
+     }
+ 
+ 
+     @RequireSystemAccess
+     @PUT
++    @JSONP
+     @Path( "setup" )
 -    public JSONWithPadding runDatabaseSetup( @Context UriInfo ui,
 -                                             @QueryParam( "callback" ) 
@DefaultValue( "callback" ) String callback )
++    public ApiResponse runDatabaseSetup( @Context UriInfo ui,
++        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback 
)
+         throws Exception {
+ 
+         ApiResponse response = createApiResponse();
+         response.setAction( "cassandra setup" );
+ 
+         logger.info( "Setting up Cassandra" );
+ 
+ 
+         emf.setup();
+ 
+ 
+         response.setSuccess();
+ 
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
+ 
+ 
+     @RequireSystemAccess
+     @PUT
++    @JSONP
+     @Path( "bootstrap" )
 -    public JSONWithPadding runSystemSetup( @Context UriInfo ui,
 -                                           @QueryParam( "callback" ) 
@DefaultValue( "callback" ) String callback )
++    public ApiResponse runSystemSetup( @Context UriInfo ui,
++        @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback 
)
+         throws Exception {
+ 
+         ApiResponse response = createApiResponse();
+         response.setAction( "cassandra setup" );
+ 
+         logger.info( "Setting up Cassandra" );
+ 
+ 
+         emf.boostrap();
+         management.setup();
+ 
+         response.setSuccess();
+ 
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
+ }
+ 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
----------------------------------------------------------------------
diff --cc stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
index bf2882c,f266441..3497621
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
@@@ -49,38 -57,10 +49,13 @@@ public class SystemResource extends Abs
  
      @RequireSystemAccess
      @GET
-     @Path( "database/setup" )
-     @JSONP
-     @Produces({MediaType.APPLICATION_JSON, "application/javascript"})
-     public ApiResponse getSetup( @Context UriInfo ui,
-                                      @QueryParam( "callback" ) @DefaultValue( 
"callback" ) String callback )
-             throws Exception {
- 
-         ApiResponse response = createApiResponse();
-         response.setAction( "cassandra setup" );
- 
-         logger.info( "Setting up Cassandra" );
- 
- 
-         emf.setup();
 +
- 
-         management.setup();
- 
-         response.setSuccess();
- 
-         return response;
-     }
- 
- 
-     @RequireSystemAccess
-     @GET
      @Path( "superuser/setup" )
 -    public JSONWithPadding getSetupSuperuser( @Context UriInfo ui,
 -                                              @QueryParam( "callback" ) 
@DefaultValue( "callback" ) String callback )
 +    @JSONP
 +    @Produces({MediaType.APPLICATION_JSON, "application/javascript"})
 +    public ApiResponse getSetupSuperuser( @Context UriInfo ui,
-                                               @QueryParam( "callback" ) 
@DefaultValue( "callback" ) String callback )
-             throws Exception {
++           @QueryParam( "callback" ) @DefaultValue( "callback" ) String 
callback )
+         throws Exception {
  
          ApiResponse response = createApiResponse();
          response.setAction( "superuser setup" );
@@@ -96,11 -76,13 +71,13 @@@
  
          response.setSuccess();
  
 -        return new JSONWithPadding( response, callback );
 +        return response;
      }
  
+ 
+ 
      @Path( "migrate" )
-     public MigrateResource migrate(){
+     public MigrateResource migrate() {
          return getSubResource( MigrateResource.class );
      }
  

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
index 5c83bbc,be8af2d..fa7e16f
--- 
a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
+++ 
b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java
@@@ -50,13 -50,16 +50,10 @@@ import javax.ws.rs.core.Context
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.UriInfo;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.Properties;
- import java.util.UUID;
+ import java.util.*;
  
 -import static javax.servlet.http.HttpServletResponse.SC_ACCEPTED;
 -import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
 -import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
 -import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
 -import static javax.servlet.http.HttpServletResponse.SC_OK;
 +import static javax.servlet.http.HttpServletResponse.*;
  import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 -import org.apache.usergrid.persistence.EntityManager;
 -import org.apache.usergrid.persistence.core.util.Health;
  
  
  
@Component("org.apache.usergrid.rest.management.organizations.applications.ApplicationResource")
@@@ -157,12 -154,70 +154,73 @@@ public class ApplicationResource extend
  
          ClientCredentialsInfo credentials =
                  new ClientCredentialsInfo( 
management.getClientIdForApplication( applicationId ),
-                         management.newClientSecretForApplication( 
applicationId ) );
+                         
management.newClientSecretForApplication(applicationId) );
  
          response.setCredentials( credentials );
 -        return new JSONWithPadding( response, callback );
 +        return response;
      }
  
+     @RequireOrganizationAccess
+     @GET
++    @JSONP
+     @Path("_size")
 -    public JSONWithPadding getApplicationSize(
++    public ApiResponse getApplicationSize(
+         @Context UriInfo ui, @QueryParam("callback") 
@DefaultValue("callback") String callback )
+         throws Exception {
+ 
+         ApiResponse response = createApiResponse();
+         response.setAction( "get application size for all entities" );
+         long size = management.getApplicationSize(this.applicationId);
+         Map<String,Object> map = new HashMap<>();
+         Map<String,Object> innerMap = new HashMap<>();
+         Map<String,Object> sumMap = new HashMap<>();
+         innerMap.put("application",size);
+         sumMap.put("size",innerMap);
+         map.put("aggregation", sumMap);
+         response.setMetadata(map);
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
+ 
+     @RequireOrganizationAccess
+     @GET
++    @JSONP
+     @Path("{collection_name}/_size")
 -    public JSONWithPadding getCollectionSize(
++    public ApiResponse getCollectionSize(
+         @Context UriInfo ui,
+         @PathParam( "collection_name" ) String collection_name,
+         @QueryParam("callback") @DefaultValue("callback") String callback )
+         throws Exception {
+         ApiResponse response = createApiResponse();
+         response.setAction("get collection size for all entities");
+         long size = management.getCollectionSize(this.applicationId, 
collection_name);
+         Map<String,Object> map = new HashMap<>();
+         Map<String,Object> sumMap = new HashMap<>();
+         Map<String,Object> innerMap = new HashMap<>();
+         innerMap.put(collection_name,size);
+         sumMap.put("size",innerMap);
+         map.put("aggregation",sumMap);
+         response.setMetadata(map);
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
+ 
+     @RequireOrganizationAccess
+     @GET
++    @JSONP
+     @Path("collections/_size")
 -    public JSONWithPadding getEachCollectionSize(
++    public ApiResponse getEachCollectionSize(
+         @Context UriInfo ui,
+         @QueryParam("callback") @DefaultValue("callback") String callback )
+         throws Exception {
+         ApiResponse response = createApiResponse();
+         response.setAction("get collection size for all entities");
+         Map<String,Long> sizes = 
management.getEachCollectionSize(this.applicationId);
+         Map<String,Object> map = new HashMap<>();
+         Map<String,Object> sumMap = new HashMap<>();
+         sumMap.put("size",sizes);
+         map.put("aggregation",sumMap);
+         response.setMetadata(map);
 -        return new JSONWithPadding( response, callback );
++        return response;
+     }
  
      @POST
      @Path("sia-provider")

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/CollectionMetadataIT.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/CollectionMetadataIT.java
index 0000000,4ab5490..4e58935
mode 000000,100644..100644
--- 
a/stack/rest/src/test/java/org/apache/usergrid/rest/CollectionMetadataIT.java
+++ 
b/stack/rest/src/test/java/org/apache/usergrid/rest/CollectionMetadataIT.java
@@@ -1,0 -1,142 +1,141 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *      http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ package org.apache.usergrid.rest;
+ 
+ 
 -import com.sun.jersey.api.client.UniformInterfaceException;
 -import org.apache.usergrid.persistence.index.utils.UUIDUtils;
+ import org.apache.usergrid.rest.test.resource.AbstractRestIT;
 -import org.apache.usergrid.rest.test.resource.model.ApiResponse;
+ import org.apache.usergrid.rest.test.resource.model.Entity;
+ import org.apache.usergrid.rest.test.resource.model.QueryParameters;
+ import org.junit.Test;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
++
+ import java.util.Map;
+ 
 -import static org.junit.Assert.*;
++import static org.junit.Assert.assertNotNull;
++import static org.junit.Assert.assertNull;
+ 
+ 
+ public class CollectionMetadataIT extends AbstractRestIT {
+ 
+     private static final Logger LOG = LoggerFactory.getLogger( 
CollectionMetadataIT.class );
+ 
+ 
+     public CollectionMetadataIT() throws Exception {
+         super();
+     }
+ 
+     private final String collectionName = 
"collectionQueryParameterCollection";
+ 
+     /**
+      * USERGRID-918: control inclusion/exclusion of connection metadata via 
query parameter
+      */
+     @Test
+     public void testCollectionQueryParameter() throws Exception {
+ 
+         // create entities
+         Entity e1 = new Entity();
+         e1.put("name", "entity1");
+         e1 = this.app().collection(collectionName).post(e1);
+         assertNotNull(e1);
+ 
+         Entity e2 = new Entity();
+         e2.put("name", "entity2");
+         e2 = this.app().collection(collectionName).post(e2);
+         assertNotNull(e2);
+ 
+         Entity e3 = new Entity();
+         e3.put("name", "entity3");
+         e3 = this.app().collection(collectionName).post(e3);
+         assertNotNull(e3);
+ 
+         refreshIndex();
+ 
+         // create connections
+         // e1 hates e3
+         // e2 likes e1
+         // e1 has 1 in (likes) & 1 out (hates) connection
+         // e2 has one out (likes) connection
+         // e3 has one in (hates) connection
+         
this.app().collection(collectionName).entity(e1).connection("hates").entity(e3).post();
+         
this.app().collection(collectionName).entity(e2).connection("likes").entity(e1).post();
+         refreshIndex();
+ 
+         // no query param, "all", and invalid param all the same
+         checkMetadata(e1, null, "hates", "likes");
+         checkMetadata(e1, "all", "hates", "likes");
+         checkMetadata(e1, "foo", "hates", "likes");
+         checkMetadata(e2, null, "likes", null);
+         checkMetadata(e2, "all", "likes", null);
+         checkMetadata(e2, "foo", "likes", null);
+         checkMetadata(e3, null, null, "hates");
+         checkMetadata(e3, "all", null, "hates");
+         checkMetadata(e3, "foo", null, "hates");
+ 
+         // "none" query param blocks connections and connecting
+         checkMetadata(e1, "none", null, null);
+         checkMetadata(e2, "none", null, null);
+         checkMetadata(e3, "none", null, null);
+ 
+         // "in" query param blocks connections
+         checkMetadata(e1, "in", null, "likes");
+         checkMetadata(e2, "in", null, null);
+         checkMetadata(e3, "in", null, "hates");
+ 
+         // "out" query param blocks connecting
+         checkMetadata(e1, "out", "hates", null);
+         checkMetadata(e2, "out", "likes", null);
+         checkMetadata(e3, "out", null, null);
+ 
+     }
+ 
+     /**
+      * validates that connections and connecting data are as expected
+      *
+      * if paramStr = null, means don't send query parameter
+      * if connectionsType or connectingType = null, means that section 
shouldn't exist
+      *
+      * unchecked warnings suppressed to avoid warnings casting payload 
entries to maps
+      */
+     @SuppressWarnings("unchecked")
+     private void checkMetadata(Entity origEntity, String paramStr, String 
connectionsType, String connectingType) throws Exception {
+         QueryParameters params = new QueryParameters();
+         if (paramStr != null)
+             params.setConnections(paramStr);
+ 
+         Entity e = 
this.app().collection(collectionName).entity(origEntity).get(params,true);
+ 
+         Map <String,Object> metadata = (Map<String,Object>)e.get("metadata");
+         assertNotNull(metadata);
+ 
+         Map <String,Object> connections = 
(Map<String,Object>)metadata.get("connections");
+         if (connectionsType != null) {
+             assertNotNull(connections);
+             assertNotNull(connections.get(connectionsType));
+         } else {
+             assertNull(connections);
+         }
+ 
+         Map <String,Object> connecting = 
(Map<String,Object>)metadata.get("connecting");
+         if (connectingType != null) {
+             assertNotNull(connecting);
+             assertNotNull(connecting.get(connectingType));
+         } else {
+             assertNull(connecting);
+         }
+     }
+ }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
index 354589c,83e29fa..e70d1b2
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/SystemResourceIT.java
@@@ -20,9 -20,14 +20,12 @@@ package org.apache.usergrid.rest
  import org.apache.usergrid.rest.test.resource.AbstractRestIT;
  import org.apache.usergrid.rest.test.resource.model.Entity;
  import org.apache.usergrid.rest.test.resource.model.QueryParameters;
 +import org.junit.Test;
  
+ import java.util.LinkedHashMap;
+ 
+ import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertNotNull;
 -import static org.junit.Assert.assertTrue;
  
  
  /**

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/management/ManagementResourceIT.java
index a26c8c7,7f86ad1..68fc172
--- 
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
@@@ -134,11 -133,11 +134,11 @@@ public class ManagementResourceIT exten
          try {
              this.management().orgs().org( 
this.clientSetup.getOrganizationName() ).get( String.class );
          }
 -        catch ( UniformInterfaceException uie ) {
 -            status = uie.getResponse().getClientResponseStatus();
 +        catch ( ClientErrorException uie ) {
 +            status = Response.Status.fromStatusCode( 
uie.getResponse().getStatus() );
          }
  
-         assertNull( status );
+         assertNull(status);
  
          //test getting the organization by org
  
@@@ -146,11 -145,11 +146,11 @@@
          try {
              this.management().orgs().org( 
this.clientSetup.getOrganizationName() ).get( String.class );
          }
 -        catch ( UniformInterfaceException uie ) {
 -            status = uie.getResponse().getClientResponseStatus();
 +        catch ( ClientErrorException uie ) {
 +            status = Response.Status.fromStatusCode( 
uie.getResponse().getStatus() );
          }
  
-         assertNull( status );
+         assertNull(status);
      }
  
  

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

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/NamedResource.java
index dc6de4b,1a9c776..c8979f0
--- 
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,17 -27,7 +22,15 @@@ import org.apache.usergrid.rest.test.re
  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 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.client.authentication.HttpAuthenticationFeature;
 +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;
 +import javax.ws.rs.core.Form;
 +import javax.ws.rs.core.GenericType;
  import javax.ws.rs.core.MediaType;
  import java.io.InputStream;
  import java.util.Iterator;
@@@ -284,10 -306,10 +286,9 @@@ public class NamedResource implements U
              resource = addParametersToResource(resource, queryParameters);
          }
          GenericType<T> gt = new GenericType<>((Class) type);
 -        return resource.type(MediaType.APPLICATION_JSON_TYPE)
 +        return resource.request()
              .accept( MediaType.APPLICATION_JSON )
 -            .get(gt.getRawClass());
 -
 +            .get( gt );
- 
      }
  
      public String getMatrix() {
@@@ -305,9 -326,8 +306,9 @@@
      }
  
      public ApiResponse put( boolean useToken, byte[] data, MediaType type ) {
-         WebTarget resource = getTarget(useToken );
 -        WebResource resource = getResource(useToken);
 -        return resource.type( type ).put(ApiResponse.class, data);
++        WebTarget resource = getTarget( useToken );
 +        return resource.request().put(
 +            javax.ws.rs.client.Entity.entity(data, type), ApiResponse.class );
      }
  
      public ApiResponse put( byte[] data, MediaType type ) {
@@@ -338,6 -357,14 +339,14 @@@
      }
  
      public ApiResponse delete( boolean useToken ) {
 -        return getResource(useToken).delete(ApiResponse.class);
 +        return getTarget(useToken).request().delete( ApiResponse.class );
      }
+ 
+     public ApiResponse delete( boolean useToken, QueryParameters 
queryParameters ) {
 -        WebResource resource = getResource(useToken);
++        WebTarget resource = getTarget(useToken);
+         if(queryParameters!=null) {
+             resource = addParametersToResource(resource, queryParameters);
+         }
 -        return resource.delete( ApiResponse.class );
++        return resource.request().delete( ApiResponse.class );
+     }
  }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SetupResource.java
index f11b062,ba2534f..2b2b1b4
--- 
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
@@@ -34,15 -37,16 +34,15 @@@ public class SetupResource extends Name
          super("setup",context,parent);
      }
  
-     public Entity get(QueryParameters queryParameters){
+     public Entity put(QueryParameters queryParameters){
  
 -        WebResource resource = getResource();
 +        WebTarget resource = getTarget();
          resource = addParametersToResource( resource, queryParameters );
  
 -        //added httpBasicauth filter to all setup calls because they all do 
verification this way.
 -        HTTPBasicAuthFilter httpBasicAuthFilter = new HTTPBasicAuthFilter( 
"superuser","superpassword" );
 -        resource.addFilter( httpBasicAuthFilter );
 +        HttpAuthenticationFeature feature = 
HttpAuthenticationFeature.basicBuilder()
 +            .credentials( "superuser", "superpassword" ).build();
  
 -        return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( 
MediaType.APPLICATION_JSON )
 -                                .put( Entity.class);
 +        return resource.register( feature ).request()
 +            .accept( MediaType.APPLICATION_JSON ).get( Entity.class );
      }
  }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/1f77ca16/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
----------------------------------------------------------------------
diff --cc 
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
index 35ffc21,c6a0586..4dd6dbc
--- 
a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
+++ 
b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/endpoints/SystemResource.java
@@@ -18,10 -18,16 +18,13 @@@
  package org.apache.usergrid.rest.test.resource.endpoints;
  
  
 -import javax.ws.rs.core.MediaType;
 -
 -import com.sun.jersey.api.client.WebResource;
 -import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
  import org.apache.usergrid.rest.test.resource.model.ApiResponse;
 -import org.apache.usergrid.rest.test.resource.model.Entity;
+ import org.apache.usergrid.rest.test.resource.model.QueryParameters;
  import org.apache.usergrid.rest.test.resource.state.ClientContext;
++import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
  
 -import java.util.UUID;
++import javax.ws.rs.client.WebTarget;
 +import javax.ws.rs.core.MediaType;
  
  
  /**
@@@ -43,16 -44,25 +41,36 @@@ public class SystemResource extends Nam
          return new DatabaseResource(context, this);
      }
  
-     public SystemResource addToPath( String pathPart ) {
-         return new SystemResource( pathPart, context, this );
+ 
+     public ApplicationsResource applications(String appid) {
+         return new ApplicationsResource(appid,context,this);
+     }
++
+     public class ApplicationsResource extends NamedResource {
 -        public ApplicationsResource(final String appid, final ClientContext 
context, final UrlResource parent ) {
 -            super( "applications/"+appid,context, parent );
++
++        public ApplicationsResource(final String appid, final ClientContext 
context, final UrlResource parent) {
++            super( "applications/" + appid, context, parent );
+         }
 -        public ApiResponse delete(QueryParameters queryParameters){
+ 
 -            WebResource resource = getResource();
++        public ApiResponse delete(QueryParameters queryParameters) {
++
++            WebTarget resource = getTarget();
+             resource = addParametersToResource( resource, queryParameters );
+ 
 -            //added httpBasicauth filter to all setup calls because they all 
do verification this way.
 -            HTTPBasicAuthFilter httpBasicAuthFilter = new 
HTTPBasicAuthFilter( "superuser","superpassword" );
 -            resource.addFilter(httpBasicAuthFilter);
++            HttpAuthenticationFeature feature = 
HttpAuthenticationFeature.basicBuilder()
++                .credentials( "superuser", "superpassword" ).build();
++
++            return resource.register( feature ).request().delete( 
ApiResponse.class );
+ 
 -            return resource.type( MediaType.APPLICATION_JSON_TYPE ).accept( 
MediaType.APPLICATION_JSON )
 -                .delete(ApiResponse.class);
+         }
      }
 +
 +    public ApiResponse put(){
 +        ApiResponse
 +            response = getTarget(true)
 +                .request()
 +                .accept(MediaType.APPLICATION_JSON)
 +                .put( javax.ws.rs.client.Entity.json(null), 
ApiResponse.class);
 +        return response;
 +    }
  }

Reply via email to