You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/01/22 00:00:10 UTC
[50/50] incubator-usergrid git commit: Refactored Guice Injector to
be a spring bean
Refactored Guice Injector to be a spring bean
Modified setup lifecycle to seperate system configuration from column family initialization
Added index delete to post test invocation
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e80df0d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e80df0d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e80df0d5
Branch: refs/heads/USERGRID-273
Commit: e80df0d5a50a92fabe8898173d8c9db1559bc5af
Parents: d35cba6 6ebbe50
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Jan 21 15:58:12 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Jan 21 15:58:12 2015 -0700
----------------------------------------------------------------------
portal/Gruntfile.js | 1 -
stack/.editorconfig | 42 +
.../corepersistence/CpEntityDeleteListener.java | 101 --
.../CpEntityIndexDeleteListener.java | 98 --
.../corepersistence/CpEntityManager.java | 124 +-
.../corepersistence/CpRelationManager.java | 35 +-
.../usergrid/corepersistence/CpSetup.java | 16 +-
.../usergrid/corepersistence/GuiceFactory.java | 4 +
.../usergrid/corepersistence/GuiceModule.java | 41 +-
.../HybridEntityManagerFactory.java | 209 ---
.../usergrid/corepersistence/HybridSetup.java | 72 -
.../events/EntityDeletedHandler.java | 68 +
.../events/EntityVersionCreatedHandler.java | 69 +
.../events/EntityVersionDeletedHandler.java | 102 ++
.../results/FilteringLoader.java | 7 +-
.../CpEntityDeleteListenerTest.java | 91 --
.../CpEntityIndexDeleteListenerTest.java | 111 --
.../corepersistence/StaleIndexCleanupTest.java | 219 ++-
.../corepersistence/TestGuiceModule.java | 30 -
.../migration/GraphShardVersionMigrationIT.java | 5 +-
.../usergrid/persistence/CollectionIT.java | 15 +-
.../query/AbstractIteratingQueryIT.java | 2 +-
.../resources/usergrid-custom-test.properties | 3 +
.../collection/EntityCollectionManager.java | 13 +-
.../collection/EntityDeletedFactory.java | 34 +
.../persistence/collection/EntitySet.java | 4 +-
.../collection/EntityVersionCleanupFactory.java | 35 +
.../collection/EntityVersionCreatedFactory.java | 31 +
.../persistence/collection/VersionSet.java | 22 +-
.../collection/event/EntityDeleted.java | 5 +-
.../collection/event/EntityVersionCreated.java | 14 +-
.../collection/event/EntityVersionDeleted.java | 11 +-
.../collection/guice/CollectionModule.java | 24 +-
.../collection/impl/CollectionScopeImpl.java | 4 +-
.../impl/EntityCollectionManagerImpl.java | 86 +-
.../collection/impl/EntityDeletedTask.java | 148 ++
.../impl/EntityVersionCleanupTask.java | 224 ++--
.../impl/EntityVersionCreatedTask.java | 122 ++
.../mvcc/stage/delete/MarkCommit.java | 137 +-
.../impl/EntityVersionSerializer.java | 3 -
.../collection/guice/TestCollectionModule.java | 4 -
.../impl/EntityVersionCleanupTaskTest.java | 450 ++++---
.../impl/EntityVersionCreatedTaskTest.java | 244 ++++
.../core/task/NamedTaskExecutorImpl.java | 141 +-
.../core/task/NamedTaskExecutorImplTest.java | 56 +-
.../usergrid/persistence/index/EntityIndex.java | 20 +-
.../persistence/index/EntityIndexBatch.java | 7 +-
.../index/impl/EsEntityIndexBatchImpl.java | 9 +-
.../index/impl/EsEntityIndexImpl.java | 142 +-
.../persistence/index/impl/IndexingUtils.java | 105 +-
stack/pom.xml | 2 +
.../rest/management/ManagementResource.java | 2 +
.../apache/usergrid/rest/PartialUpdateTest.java | 170 ++-
.../apache/usergrid/rest/TestContextSetup.java | 6 +-
.../applications/assets/AssetResourceIT.java | 43 +-
.../collection/DuplicateNameIT.java | 2 +-
.../activities/ActivityResourceIT.java | 133 +-
.../collection/activities/PutTest.java | 33 +-
.../collection/devices/DevicesResourceIT.java | 39 +-
.../collection/groups/GroupResourceIT.java | 592 +++++---
.../collection/groups/UpdateGroupIT.java | 114 --
.../collection/paging/PagingEntitiesTest.java | 141 --
.../collection/paging/PagingResourceIT.java | 442 +++---
.../users/ConnectionResourceTest.java | 282 ++--
.../collection/users/OwnershipResourceIT.java | 424 +++---
.../collection/users/PermissionsResourceIT.java | 723 ++++------
.../collection/users/RetrieveUsersTest.java | 40 +-
.../collection/users/UserResourceIT.java | 1260 +++++++-----------
.../applications/queries/AndOrQueryTest.java | 418 ++++--
.../queries/BadGrammarQueryTest.java | 197 ++-
.../applications/queries/GeoPagingTest.java | 562 ++++----
.../applications/queries/MatrixQueryTests.java | 181 ++-
.../rest/applications/queries/OrderByTest.java | 394 ++++--
.../applications/queries/QueryTestBase.java | 72 +
.../rest/applications/utils/TestUtils.java | 19 +
.../rest/applications/utils/UserRepo.java | 51 +-
.../rest/management/OrganizationsIT.java | 471 +++----
.../rest/test/resource/TestContext.java | 3 +-
.../test/resource2point0/AbstractRestIT.java | 159 +++
.../rest/test/resource2point0/ClientSetup.java | 113 ++
.../rest/test/resource2point0/DumbClient.java | 58 +
.../rest/test/resource2point0/RestClient.java | 114 ++
.../endpoints/ApplicationsResource.java | 48 +
.../endpoints/CollectionEndpoint.java | 221 +++
.../endpoints/EntityEndpoint.java | 176 +++
.../endpoints/NamedResource.java | 109 ++
.../endpoints/OrganizationResource.java | 55 +
.../resource2point0/endpoints/RootResource.java | 85 ++
.../endpoints/TokenResource.java | 61 +
.../resource2point0/endpoints/UrlResource.java | 44 +
.../endpoints/mgmt/ApplicationResource.java | 48 +
.../endpoints/mgmt/ManagementResource.java | 44 +
.../endpoints/mgmt/OrgResource.java | 114 ++
.../endpoints/mgmt/OrganizationResource.java | 83 ++
.../endpoints/mgmt/TokenResource.java | 54 +
.../endpoints/mgmt/UsersResource.java | 61 +
.../resource2point0/model/ActivityEntity.java | 49 +
.../test/resource2point0/model/ApiResponse.java | 219 +++
.../test/resource2point0/model/Application.java | 39 +
.../model/ChangePasswordEntity.java | 33 +
.../test/resource2point0/model/Collection.java | 98 ++
.../rest/test/resource2point0/model/Entity.java | 204 +++
.../resource2point0/model/Organization.java | 117 ++
.../resource2point0/model/QueryParameters.java | 93 ++
.../rest/test/resource2point0/model/Token.java | 72 +
.../rest/test/resource2point0/model/User.java | 101 ++
.../resource2point0/state/ClientContext.java | 39 +
.../resources/usergrid-custom-test.properties | 2 +
.../notifications/apns/APNsAdapter.java | 4 +-
.../notifications/apns/EntityPushManager.java | 3 +-
110 files changed, 8319 insertions(+), 4777 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
index 0000000,0000000..89f89a3
new file mode 100644
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java
@@@ -1,0 -1,0 +1,4 @@@
++package org.apache.usergrid.corepersistence;
++
++
++public class GuiceFactory {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
index e00769a,ed6cba2..bbf776f
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
@@@ -37,7 -42,17 +42,18 @@@ import org.slf4j.LoggerFactory
/**
* Guice Module that encapsulates Core Persistence.
*/
-public class GuiceModule extends AbstractModule {
+public class GuiceModule extends AbstractModule {
++ private static final Logger log = LoggerFactory.getLogger( GuiceModule.class );
+
+ private static final Logger logger = LoggerFactory.getLogger(GuiceModule.class);
+
+ private EntityManagerFactory emf;
+
+ public static final String EVENTS_DISABLED = "corepersistence.events.disabled";
+
+ GuiceModule( EntityManagerFactory emf ) {
+ this.emf = emf;
+ }
@Override
protected void configure() {
@@@ -49,15 -68,26 +69,26 @@@
install(new MapModule());
install(new QueueModule());
- bind(CpEntityDeleteListener.class).asEagerSingleton();
- bind(CpEntityIndexDeleteListener.class).asEagerSingleton();
bind(ManagerCache.class).to( CpManagerCache.class );
- Multibinder<DataMigration> dataMigrationMultibinder = Multibinder.newSetBinder( binder(), DataMigration.class );
- Multibinder<DataMigration> dataMigrationMultibinder =
++ Multibinder<DataMigration> dataMigrationMultibinder =
+ Multibinder.newSetBinder( binder(), DataMigration.class );
dataMigrationMultibinder.addBinding().to( EntityTypeMappingMigration.class );
dataMigrationMultibinder.addBinding().to( GraphShardVersionMigration.class );
dataMigrationMultibinder.addBinding().to( EntityDataMigration.class );
- Multibinder<EntityDeleted> entityBinder =
++ Multibinder<EntityDeleted> entityBinder =
+ Multibinder.newSetBinder(binder(), EntityDeleted.class);
+ entityBinder.addBinding().to(EntityDeletedHandler.class);
+
- Multibinder<EntityVersionDeleted> versionBinder =
++ Multibinder<EntityVersionDeleted> versionBinder =
+ Multibinder.newSetBinder(binder(), EntityVersionDeleted.class);
+ versionBinder.addBinding().to(EntityVersionDeletedHandler.class);
+
+ Multibinder<EntityVersionCreated> versionCreatedMultibinder =
+ Multibinder.newSetBinder( binder(), EntityVersionCreated.class );
+ versionCreatedMultibinder.addBinding().to(EntityVersionCreatedHandler.class);
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridEntityManagerFactory.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridEntityManagerFactory.java
index 42dc805,af4acdb..0000000
deleted file mode 100644,100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridEntityManagerFactory.java
+++ /dev/null
@@@ -1,209 -1,213 +1,0 @@@
--/*
-- * Copyright 2014 The Apache Software Foundation.
-- *
-- * Licensed 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.corepersistence;
--
--import java.util.Map;
--import java.util.UUID;
--import org.apache.usergrid.persistence.EntityManager;
--import org.apache.usergrid.persistence.EntityManagerFactory;
--import org.apache.usergrid.persistence.cassandra.CassandraService;
--import org.apache.usergrid.persistence.cassandra.CounterUtils;
--import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl;
--import org.apache.usergrid.persistence.core.util.Health;
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
--import org.springframework.beans.BeansException;
--import org.springframework.context.ApplicationContext;
--import org.springframework.context.ApplicationContextAware;
--
--
--/**
-- * Can read from either old EntityManagerImpl or new CpEntityManager, can write to either or both.
-- */
--public class HybridEntityManagerFactory implements EntityManagerFactory, ApplicationContextAware {
-- private static final Logger logger = LoggerFactory.getLogger( CpEntityManagerFactory.class );
-- private final EntityManagerFactory factory;
--
--
-- public HybridEntityManagerFactory(
-- CassandraService cass, CounterUtils counterUtils, boolean skipAggCounters ) {
--
-- boolean useCP = cass.getPropertiesMap().get("usergrid.persistence").equals("CP");
-- if ( useCP ) {
-- logger.info("HybridEntityManagerFactory: configured for New Core Persistence engine");
-- factory = new CpEntityManagerFactory(cass, counterUtils );
-- } else {
-- logger.info("HybridEntityManagerFactory: configured for Classic Usergrid persistence");
-- factory = new EntityManagerFactoryImpl( cass, counterUtils, skipAggCounters );
-- }
- }
-
- public EntityManagerFactory getImplementation() {
- return factory;
-- }
--
-- @Override
-- public String getImpementationDescription() throws Exception {
-- return factory.getImpementationDescription();
-- }
--
-- @Override
-- public EntityManager getEntityManager(UUID applicationId) {
-- return factory.getEntityManager(applicationId);
-- }
--
-- @Override
-- public UUID createApplication(String organizationName, String name) throws Exception {
-- return factory.createApplication(organizationName, name);
-- }
--
-- @Override
-- public UUID createApplication(String organizationName, String name,
-- Map<String, Object> properties) throws Exception {
-- return factory.createApplication(organizationName, name, properties);
-- }
--
-- @Override
-- public UUID importApplication(String organization, UUID applicationId, String name,
-- Map<String, Object> properties) throws Exception {
-- return factory.importApplication(organization, applicationId, name, properties);
-- }
--
-- @Override
-- public UUID lookupApplication(String name) throws Exception {
-- return factory.lookupApplication(name);
-- }
--
-- @Override
-- public Map<String, UUID> getApplications() throws Exception {
-- return factory.getApplications();
-- }
--
-- @Override
-- public void setup() throws Exception {
-- factory.setup();
-- }
--
-- @Override
-- public Map<String, String> getServiceProperties() {
-- return factory.getServiceProperties();
-- }
--
-- @Override
-- public boolean updateServiceProperties(Map<String, String> properties) {
-- return factory.updateServiceProperties(properties);
-- }
--
-- @Override
-- public boolean setServiceProperty(String name, String value) {
-- return factory.setServiceProperty(name, value);
-- }
--
-- @Override
-- public boolean deleteServiceProperty(String name) {
-- return factory.deleteServiceProperty(name);
-- }
--
-- @Override
-- public UUID initializeApplication(String orgName, UUID appId, String appName,
-- Map<String, Object> props) throws Exception {
-- return factory.initializeApplication(orgName, appId, appName, props);
-- }
--
-- @Override
-- public UUID getManagementAppId() {
-- return factory.getManagementAppId();
-- }
--
-- @Override
-- public UUID getDefaultAppId() {
-- return factory.getDefaultAppId();
-- }
--
-- @Override
-- public void refreshIndex() {
-- factory.refreshIndex();
-- }
--
-- @Override
-- public void setApplicationContext(ApplicationContext ac) throws BeansException {
-- factory.setApplicationContext(ac);
-- }
--
--
-- @Override
-- public long performEntityCount() {
-- return factory.performEntityCount();
-- }
--
--
-- @Override
-- public void flushEntityManagerCaches() {
-- factory.flushEntityManagerCaches();
-- }
--
-- @Override
-- public void rebuildInternalIndexes(ProgressObserver po) throws Exception {
-- factory.rebuildInternalIndexes(po);
-- }
--
-- @Override
-- public void rebuildAllIndexes(ProgressObserver po) throws Exception {
-- factory.rebuildAllIndexes(po);
-- }
--
-- @Override
-- public void rebuildApplicationIndexes(UUID appId, ProgressObserver po) throws Exception {
-- factory.rebuildApplicationIndexes(appId, po);
-- }
--
--
-- @Override
-- public void migrateData() throws Exception {
-- factory.migrateData();
-- }
--
--
-- @Override
-- public String getMigrateDataStatus() {
-- return factory.getMigrateDataStatus();
-- }
--
--
-- @Override
-- public int getMigrateDataVersion() {
-- return factory.getMigrateDataVersion();
-- }
--
--
-- @Override
-- public void setMigrationVersion( final int version ) {
-- factory.setMigrationVersion( version );
-- }
--
--
-- @Override
-- public void rebuildCollectionIndex(UUID appId, String collection, ProgressObserver po) {
-- factory.rebuildCollectionIndex(appId, collection, po);
-- }
--
-- @Override
-- public void addIndex(UUID appId, String suffix,final int shards,final int replicas) {
-- factory.addIndex(appId,suffix,shards,replicas);
-- }
--
-- @Override
-- public Health getEntityStoreHealth() {
-- return factory.getEntityStoreHealth();
-- }
--}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridSetup.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridSetup.java
index 963f8db,963f8db..0000000
deleted file mode 100644,100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridSetup.java
+++ /dev/null
@@@ -1,72 -1,72 +1,0 @@@
--/*
-- * Copyright 2014 The Apache Software Foundation.
-- *
-- * Licensed 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.corepersistence;
--
--import java.util.Properties;
--import java.util.UUID;
--import org.apache.usergrid.persistence.EntityManagerFactory;
--import org.apache.usergrid.persistence.cassandra.CassandraService;
--import org.apache.usergrid.persistence.cassandra.Setup;
--import org.apache.usergrid.persistence.cassandra.SetupImpl;
--
--
--public class HybridSetup implements Setup {
--
-- private final Setup setup;
--
-- public HybridSetup(Properties props, EntityManagerFactory emf, CassandraService cass ) {
--
-- boolean useCP = cass.getPropertiesMap().get("usergrid.persistence").equals("CP");
-- if ( useCP ) {
-- setup = new CpSetup( emf, cass);
-- } else {
-- setup = new SetupImpl( emf, cass );
-- }
--
-- }
--
-- @Override
-- public void init() throws Exception {
-- setup.init();
-- }
--
-- @Override
-- public void setupSystemKeyspace() throws Exception {
-- setup.setupSystemKeyspace();
-- }
--
-- @Override
-- public void setupStaticKeyspace() throws Exception {
-- setup.setupStaticKeyspace();
-- }
--
-- @Override
-- public boolean keyspacesExist() {
-- return setup.keyspacesExist();
-- }
--
-- @Override
-- public void createDefaultApplications() throws Exception {
-- setup.createDefaultApplications();
-- }
--
-- @Override
-- public void setupApplicationKeyspace(UUID applicationId, String appName) throws Exception {
-- setup.setupApplicationKeyspace(applicationId, appName);
-- }
--
--}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
----------------------------------------------------------------------
diff --cc stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
index 6fce1dd,9a0b195..0000000
deleted file mode 100644,100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/TestGuiceModule.java
+++ /dev/null
@@@ -1,30 -1,37 +1,0 @@@
--/*
-- * Licensed to the Apache Software Foundation (ASF) under one
-- * or more contributor license agreements. See the NOTICE file
-- * distributed with this work for additional information
-- * regarding copyright ownership. The ASF licenses this file
-- * to you under the Apache License, Version 2.0 (the
-- * "License"); you may not use this file except in compliance
-- * with the License. You may obtain a copy of the License at
-- *
-- * http://www.apache.org/licenses/LICENSE-2.0
-- *
-- * Unless required by applicable law or agreed to in writing,
-- * software distributed under the License is distributed on an
-- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- * KIND, either express or implied. See the License for the
-- * specific language governing permissions and limitations
-- * under the License.
-- */
--package org.apache.usergrid.corepersistence;
--
--import com.google.inject.AbstractModule;
-import org.apache.usergrid.persistence.EntityManagerFactory;
--
--
--public class TestGuiceModule extends AbstractModule {
-
- private static EntityManagerFactory emf;
-
- public TestGuiceModule( EntityManagerFactory emf ) {
- this.emf = emf;
- }
--
-- @Override
-- protected void configure() {
- install( new GuiceModule() );
- install( new GuiceModule( emf ) );
-- }
--}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/GraphShardVersionMigrationIT.java
----------------------------------------------------------------------
diff --cc stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/GraphShardVersionMigrationIT.java
index 3083536,f287047..fdde80b
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/GraphShardVersionMigrationIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/migration/GraphShardVersionMigrationIT.java
@@@ -54,9 -49,9 +51,10 @@@ import rx.functions.Action1
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+ import org.junit.Ignore;
+@NotThreadSafe
public class GraphShardVersionMigrationIT extends AbstractCoreIT {
private Injector injector;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e80df0d5/stack/pom.xml
----------------------------------------------------------------------