You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/03/30 21:58:53 UTC
[49/50] incubator-usergrid git commit: Merge branch 'two-dot-o-dev'
into USERGRID-448-appinfofix
Merge branch 'two-dot-o-dev' into USERGRID-448-appinfofix
Conflicts:
stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d2be54be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d2be54be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d2be54be
Branch: refs/heads/two-dot-o-dev
Commit: d2be54be4e57004c55f8be372feb1b9d3974a157
Parents: e611793 a099d0f
Author: Dave Johnson <dm...@apigee.com>
Authored: Mon Mar 30 10:19:22 2015 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Mon Mar 30 10:19:22 2015 -0400
----------------------------------------------------------------------
.../corepersistence/CpEntityManagerFactory.java | 30 +-
.../corepersistence/CpRelationManager.java | 304 +++------
.../usergrid/corepersistence/CpSetup.java | 14 +-
.../results/CollectionRefsVerifier.java | 44 ++
.../CollectionResultsLoaderFactoryImpl.java | 60 ++
.../results/ConnectionRefsVerifier.java | 61 ++
.../ConnectionResultsLoaderFactoryImpl.java | 65 ++
.../results/ElasticSearchQueryExecutor.java | 212 ++++++
.../corepersistence/results/QueryExecutor.java | 37 ++
.../corepersistence/results/RefsVerifier.java | 42 --
.../results/ResultsLoaderFactory.java | 3 +-
.../results/ResultsLoaderFactoryImpl.java | 62 --
.../persistence/MultiQueryIterator.java | 6 +-
.../apache/usergrid/persistence/Results.java | 26 +-
.../cassandra/QueryProcessorImpl.java | 12 +-
.../usergrid/persistence/PathQueryIT.java | 46 +-
.../persistence/query/IteratingQueryIT.java | 38 +-
stack/core/src/test/resources/log4j.properties | 2 +
.../persistence/graph/GraphManagerIT.java | 2 +-
.../index/ApplicationEntityIndex.java | 5 +
.../usergrid/persistence/index/EntityIndex.java | 6 +-
.../usergrid/persistence/index/IndexFig.java | 16 +-
.../index/impl/BufferQueueInMemoryImpl.java | 10 +-
.../impl/EsApplicationEntityIndexImpl.java | 12 +
.../index/impl/EsEntityIndexImpl.java | 9 -
.../index/impl/EsIndexBufferConsumerImpl.java | 74 +--
.../usergrid/persistence/index/query/Query.java | 58 +-
.../persistence/index/utils/ListUtils.java | 3 +-
.../persistence/index/impl/EntityIndexTest.java | 26 +-
.../index/impl/IndexLoadTestsIT.java | 18 +-
.../organizations/OrganizationResource.java | 26 +-
.../applications/ApplicationResource.java | 44 +-
.../applications/imports/ImportsResource.java | 19 +-
.../java/org/apache/usergrid/rest/BasicIT.java | 302 +--------
.../apache/usergrid/rest/SystemResourceIT.java | 10 +-
.../applications/ApplicationResourceIT.java | 4 +-
.../collection/CollectionsResourceIT.java | 19 +-
.../collection/users/OwnershipResourceIT.java | 4 +-
.../collection/users/RetrieveUsersTest.java | 4 +-
.../collection/users/UserResourceIT.java | 4 +-
.../usergrid/rest/management/AccessTokenIT.java | 418 +++++-------
.../usergrid/rest/management/AdminUsersIT.java | 60 +-
.../rest/management/ExportResourceIT.java | 652 +++++++------------
.../rest/management/ImportResourceIT.java | 20 +-
.../rest/management/OrganizationsIT.java | 16 +-
.../organizations/AdminEmailEncodingIT.java | 3 +-
.../test/resource2point0/AbstractRestIT.java | 4 +-
.../rest/test/resource2point0/ClientSetup.java | 30 +-
.../rest/test/resource2point0/RestClient.java | 1 +
.../endpoints/NamedResource.java | 112 +++-
.../endpoints/SetupResource.java | 6 +
.../endpoints/mgmt/ApplicationResource.java | 8 +-
.../endpoints/mgmt/ManagementResource.java | 4 +
.../endpoints/mgmt/MeResource.java | 32 +
.../endpoints/mgmt/PasswordResource.java | 16 -
.../endpoints/mgmt/RevokeTokenResource.java | 32 +
.../endpoints/mgmt/RevokeTokensResource.java | 33 +
.../endpoints/mgmt/TokenResource.java | 25 +-
.../endpoints/mgmt/UserResource.java | 8 +
.../endpoints/mgmt/UsersResource.java | 15 -
.../cassandra/ManagementServiceImpl.java | 21 +-
61 files changed, 1638 insertions(+), 1617 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index e2e43ca,3cfc1a4..baac821
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@@ -122,9 -132,11 +125,10 @@@ public class CpEntityManagerFactory imp
this.counterUtils = counterUtils;
this.injector = injector;
this.entityIndex = injector.getInstance(EntityIndex.class);
+ this.entityIndexFactory = injector.getInstance(EntityIndexFactory.class);
this.managerCache = injector.getInstance( ManagerCache.class );
this.metricsFactory = injector.getInstance( MetricsFactory.class );
-
- this.orgApplicationCache = new OrgApplicationCacheImpl( this );
+ this.applicationIdCache = new ApplicationIdCacheImpl( this );
}
@@@ -152,9 -164,12 +156,11 @@@
em.getApplication();
}
- entityIndex.initializeIndex();
+ ApplicationScope appScope = new ApplicationScopeImpl(new SimpleId( CpNamingUtils.SYSTEM_APP_ID, "application" ) );
+ ApplicationEntityIndex applicationEntityIndex = entityIndexFactory.createApplicationEntityIndex(appScope);
+ applicationEntityIndex.initializeIndex();
entityIndex.refresh();
-
} catch (Exception ex) {
throw new RuntimeException("Fatal error creating system application", ex);
}
@@@ -233,14 -248,15 +239,17 @@@
}
+ /**
+ * @return UUID of newly created Entity of type application_info
+ */
@Override
- public UUID initializeApplication( String organizationName, UUID applicationId, String name,
+ public Entity initializeApplicationV2( String organizationName, final UUID applicationId, String name,
Map<String, Object> properties ) throws Exception {
- EntityManager em = getEntityManager(getManagementAppId());
-
- //Ensure our management system exists before creating our application
++ // Ensure our management system exists before creating our application
+ init();
+
- EntityManager em = getEntityManager( CpNamingUtils.SYSTEM_APP_ID);
++ EntityManager em = getEntityManager( CpNamingUtils.MANAGEMENT_APPLICATION_ID );
final String appName = buildAppName( organizationName, name );
@@@ -250,18 -265,63 +259,14 @@@
throw new ApplicationAlreadyExistsException( appName );
}
- // create application info entity
+ ApplicationScope applicationScope = new ApplicationScopeImpl(new SimpleId( applicationId,"application"));
+ ApplicationEntityIndex applicationEntityIndex = entityIndexFactory.createApplicationEntityIndex(applicationScope);
+ applicationEntityIndex.initializeIndex();
- try {
- em.create( CpNamingUtils.APPLICATION_INFO, properties );
- }
- catch ( DuplicateUniquePropertyExistsException e ) {
- throw new ApplicationAlreadyExistsException( appName );
- }
- entityIndex.refresh();
+ getSetup().setupApplicationKeyspace( applicationId, appName );
- final Optional<UUID> cachedValue = orgApplicationCache.getOrganizationId( organizationName );
-
-
- UUID orgUuid;
-
- if ( !cachedValue.isPresent() ) {
-
-
- // create new org because the specified one does not exist
- final String orgName = organizationName;
-
-
-
- try {
- final Entity orgInfo = em.create( "organization", new HashMap<String, Object>() {{
- put( PROPERTY_NAME, orgName );
- }} );
- orgUuid = orgInfo.getUuid();
- //evit so it's re-loaded later
- orgApplicationCache.evictOrgId( name );
- }
- catch ( DuplicateUniquePropertyExistsException e ) {
- //swallow, if it exists, just get it
- orgApplicationCache.evictOrgId( organizationName );
- orgUuid = orgApplicationCache.getOrganizationId( organizationName ).get();
- }
-
- } else{
- orgUuid = cachedValue.get();
- }
-
- // create appinfo entry in the system app
- final UUID appId = applicationId;
- final UUID orgId = orgUuid;
- Map<String, Object> appInfoMap = new HashMap<String, Object>() {{
- put( PROPERTY_NAME, appName );
- put( "applicationUuid", appId );
- put( "organizationUuid", orgId );
- }};
-
- try {
- em.create( "appinfo", appInfoMap );
- }
- catch ( DuplicateUniquePropertyExistsException e ) {
- throw new ApplicationAlreadyExistsException( appName );
- }
- entityIndex.refresh();
-
- // create application entity
if ( properties == null ) {
- properties = new TreeMap<String, Object>( CASE_INSENSITIVE_ORDER );
+ properties = new TreeMap<>( CASE_INSENSITIVE_ORDER );
}
properties.put( PROPERTY_NAME, appName );
EntityManager appEm = getEntityManager( applicationId);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
index 4ab7874,040f60f..b3eef4b
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
@@@ -98,13 -107,22 +107,10 @@@ public class CpSetup implements Setup
setupStaticKeyspace();
- //force the EMF creation of indexes before creating the default applications
- entityIndex.initializeIndex();
-
- logger.info( "Setting up management app" );
+ injector.getInstance( DataMigrationManager.class ).migrate();
- logger.info( "Setting up default applications" );
-
try {
- emf.initializeApplication( DEFAULT_ORGANIZATION, emf.getDefaultAppId(), DEFAULT_APPLICATION, null );
- }
- catch ( ApplicationAlreadyExistsException ex ) {
- logger.warn( "Application {}/{} already exists", DEFAULT_ORGANIZATION, DEFAULT_APPLICATION );
- }
- catch ( OrganizationAlreadyExistsException oaee ) {
- logger.warn( "Organization {} already exists", DEFAULT_ORGANIZATION );
- }
-
- try {
- emf.initializeApplication( DEFAULT_ORGANIZATION, emf.getManagementAppId(), MANAGEMENT_APPLICATION, null );
+ emf.initializeApplicationV2( DEFAULT_ORGANIZATION, emf.getManagementAppId(), MANAGEMENT_APPLICATION, null );
}
catch ( ApplicationAlreadyExistsException ex ) {
logger.warn( "Application {}/{} already exists", DEFAULT_ORGANIZATION, MANAGEMENT_APPLICATION );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
index ecee76b,d064b97..b2baac9
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
@@@ -189,10 -200,10 +200,10 @@@ public class EsIndexBufferConsumerImpl
}
while ( true );
}
- } ).subscribeOn(Schedulers.newThread()).doOnNext(new Action1<List<IndexOperationMessage>>() {
+ } ).doOnNext( new Action1<List<IndexOperationMessage>>() {
@Override
- public void call( List<IndexOperationMessage> containerList ) {
- if ( containerList.size() == 0 ) {
+ public void call(List<IndexOperationMessage> containerList) {
+ if (containerList.size() == 0) {
return;
}
@@@ -200,38 -211,22 +211,21 @@@
Timer.Context time = flushTimer.time();
- execute( containerList );
+ execute(containerList);
time.stop();
-
}
- } )
+ })
//ack after we process
- .doOnNext( new Action1<List<IndexOperationMessage>>() {
+ .doOnNext(new Action1<List<IndexOperationMessage>>() {
@Override
- public void call( final List<IndexOperationMessage> indexOperationMessages ) {
- bufferQueue.ack( indexOperationMessages );
+ public void call(final List<IndexOperationMessage> indexOperationMessages) {
+ bufferQueue.ack(indexOperationMessages);
//release so we know we've done processing
- inFlight.addAndGet( -1 * indexOperationMessages.size() );
+ inFlight.addAndGet(-1 * indexOperationMessages.size());
}
- })
- // TODO: implement on error resume next instead of onError
- // .onErrorResumeNext(new Func1<Throwable, Observable<IndexOperationMessage>>() {
- //
- // @Override
- // public Observable<IndexOperationMessage> call(Throwable throwable) {
- // return null;
- // }
- // })
- .doOnError(new Action1<Throwable>() {
- @Override
- public void call(final Throwable throwable) {
- } )
- log.error("An exception occurred when trying to deque and write to elasticsearch. Ignoring",
- throwable);
- indexErrorCounter.inc();
- }
- });
- .subscribeOn( Schedulers.newThread() );
++ } ).subscribeOn( Schedulers.newThread() );
//start in the background
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/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 1e7d1f9,d7dcd87..0bebb75
--- 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
@@@ -21,8 -24,10 +21,9 @@@ import com.google.common.base.Precondit
import com.sun.jersey.api.json.JSONWithPadding;
import org.apache.amber.oauth2.common.exception.OAuthSystemException;
import org.apache.amber.oauth2.common.message.OAuthResponse;
+ import org.apache.commons.lang.NullArgumentException;
import org.apache.commons.lang.StringUtils;
-import org.apache.usergrid.corepersistence.util.CpNamingUtils;
import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.export.ExportService;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
----------------------------------------------------------------------
diff --cc stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
index 7d047a3,bb5f958..5755c8e
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/imports/ImportsResource.java
@@@ -107,32 -114,37 +107,33 @@@ public class ImportsResource extends Ab
Map<String, Object> properties;
Map<String, Object> storage_info;
- if ((properties = (Map<String, Object>) json.get("properties")) == null) {
- throw new NullArgumentException("Could not find 'properties'");
++ if ( ( properties = ( Map<String, Object> ) json.get( "properties" ) ) == null ) {
++ throw new NullArgumentException( "Could not find 'properties'" );
+ }
- storage_info = (Map<String, Object>) properties.get("storage_info");
- String storage_provider = (String) properties.get("storage_provider");
- if (storage_provider == null) {
- throw new NullArgumentException("Could not find field 'storage_provider'");
++ storage_info = ( Map<String, Object> ) properties.get( "storage_info" );
++ String storage_provider = ( String ) properties.get( "storage_provider" );
++ if ( storage_provider == null ) {
++ throw new NullArgumentException( "Could not find field 'storage_provider'" );
+ }
- if (storage_info == null) {
- throw new NullArgumentException("Could not find field 'storage_info'");
++ if ( storage_info == null ) {
++ throw new NullArgumentException( "Could not find field 'storage_info'" );
+ }
- String bucketName = (String) storage_info.get("bucket_location");
- if ( ( properties = ( Map<String, Object> ) json.get( "properties" ) ) == null ) {
- throw new NullArgumentException( "Could not find 'properties'" );
- }
- storage_info = ( Map<String, Object> ) properties.get( "storage_info" );
- String storage_provider = ( String ) properties.get( "storage_provider" );
- if ( storage_provider == null ) {
- throw new NullArgumentException( "Could not find field 'storage_provider'" );
- }
- if ( storage_info == null ) {
- throw new NullArgumentException( "Could not find field 'storage_info'" );
- }
-
- String bucketName = ( String ) storage_info.get( "bucket_location" );
-
-
- String accessId = ( String ) storage_info.get( "s3_access_id" );
- String secretKey = ( String ) storage_info.get( "s3_key" );
-
- if ( bucketName == null ) {
- throw new NullArgumentException( "Could not find field 'bucketName'" );
- }
- if ( accessId == null ) {
- throw new NullArgumentException( "Could not find field 's3_access_id'" );
- }
- if ( secretKey == null ) {
++ String bucketName = ( String ) storage_info.get( "bucket_location" );
+
- throw new NullArgumentException( "Could not find field 's3_key'" );
- }
+ String accessId = (String) storage_info.get("s3_access_id");
+ String secretKey = (String) storage_info.get("s3_key");
+ if (bucketName == null) {
+ throw new NullArgumentException("Could not find field 'bucketName'");
+ }
+ if (accessId == null) {
+ throw new NullArgumentException("Could not find field 's3_access_id'");
+ }
+ if (secretKey == null) {
+ throw new NullArgumentException("Could not find field 's3_key'");
+ }
json.put( "organizationId", organization.getUuid() );
json.put( "applicationId", application.getId() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
----------------------------------------------------------------------
diff --cc stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
index a943bba,5e40037..67bc650
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/ApplicationResourceIT.java
@@@ -575,8 -584,7 +575,8 @@@ public class ApplicationResourceIT exte
String clientId = orgCredentials.getClientId();
String clientSecret = orgCredentials.getClientSecret();
- Token token = clientSetup.getRestClient().management().token().post(
- new Token("client_credentials", clientId, clientSecret));
- Token token = clientSetup.getRestClient().management().token().post(Token.class,new Token("client_credentials", clientId, clientSecret));
++ Token token = clientSetup.getRestClient().management().token()
++ .post(Token.class,new Token("client_credentials", clientId, clientSecret));
//GET the token endpoint, adding authorization header
Token apiResponse = this.app().token().getResource(false)
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/UserResourceIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
----------------------------------------------------------------------
diff --cc stack/rest/src/test/java/org/apache/usergrid/rest/management/ImportResourceIT.java
index 1ea9770,355c57a..9b5b09a
--- 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
@@@ -173,11 -171,15 +173,11 @@@ public class ImportResourceIT extends A
Entity payload = payloadBuilder();
// /management/orgs/orgname/apps/appname/import
- Entity entity = this.management()
- .orgs()
- .organization(org)
- .app()
+ Entity entity = this.management().orgs().organization(org).app()
.addToPath(app)
.addToPath("imports")
- .post(payload);
+ .post(Entity.class,payload);
-
assertNotNull(entity);
// test that you can access the organization using the currently set token.
@@@ -644,10 -625,8 +644,10 @@@
}});
}});
- Entity importEntity = this.management().orgs().organization(org).app().addToPath(app).addToPath("imports")
- .post(Entity.class,importPayload);
+ Entity importEntity = this.management().orgs().organization(org).app()
+ .addToPath(app)
+ .addToPath("imports")
- .post(importPayload);
++ .post(Entity.class,importPayload);
int maxRetries = 120;
int retries = 0;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --cc stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
index 034c302,90e2c64..c02c48b
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
@@@ -22,7 -22,7 +22,8 @@@ package org.apache.usergrid.rest.test.r
import javax.ws.rs.core.MediaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+ import org.apache.usergrid.rest.test.resource2point0.endpoints.CollectionEndpoint;
import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource;
import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource;
import org.apache.usergrid.rest.test.resource2point0.model.Application;
@@@ -57,29 -47,17 +58,30 @@@ public class ApplicationResource extend
}
- public void post(Application application) {
- getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
- .accept(MediaType.APPLICATION_JSON).post(application);
+ public ApiResponse post(Application application) {
+ ApiResponse apiResponse =getResource(true).type(MediaType.APPLICATION_JSON_TYPE)
+ .accept(MediaType.APPLICATION_JSON).post(ApiResponse.class,application);
+ return apiResponse;
}
-// public Entity post(Entity payload){
-// ApiResponse response = getResource(true).type( MediaType.APPLICATION_JSON_TYPE ).accept(MediaType.APPLICATION_JSON)
-// .post(ApiResponse.class, payload);
-// return new Entity(response);
-// }
+ public Entity post(Entity payload) {
+
+ String responseString = getResource(true)
+ .type( MediaType.APPLICATION_JSON_TYPE )
+ .accept(MediaType.APPLICATION_JSON)
+ .post(String.class, payload);
+
+ logger.debug("Response from post: " + responseString);
+
+ ApiResponse response;
+ try {
+ response = mapper.readValue(new StringReader(responseString), ApiResponse.class);
+ } catch (IOException e) {
+ throw new RuntimeException("Error parsing response", e);
+ }
+
+ return new Entity(response);
+ }
public Entity get() {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d2be54be/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --cc stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index cd8a404,0cf80b4..682044b
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@@ -1445,9 -1477,8 +1445,8 @@@ public class ManagementServiceImpl impl
BiMap<UUID, String> organizations = HashBiMap.create();
EntityManager em = emf.getEntityManager( smf.getManagementAppId() );
- Results results = em.getCollection(
- new SimpleEntityRef( User.ENTITY_TYPE, userId ), Schema.COLLECTION_GROUPS, null, 10000,
- Level.ALL_PROPERTIES, false );
- Results results = em.getCollection( new SimpleEntityRef( User.ENTITY_TYPE, userId ), "groups", null, 1000,
- Level.ALL_PROPERTIES, false );
++ Results results = em.getCollection( new SimpleEntityRef( User.ENTITY_TYPE, userId ),
++ Schema.COLLECTION_GROUPS, null, 1000, Level.ALL_PROPERTIES, false );
String path = null;