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 2014/12/12 15:30:00 UTC
[01/50] [abbrv] incubator-usergrid git commit: add comment
Repository: incubator-usergrid
Updated Branches:
refs/heads/no-source-in-es b3c4c41b7 -> 9044001c9
refs/heads/two-dot-o-events a290e0d6b -> a8cc5870d
add comment
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/8cdfaf95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/8cdfaf95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/8cdfaf95
Branch: refs/heads/no-source-in-es
Commit: 8cdfaf9547da2a69a34b9b548167201c6a1a3068
Parents: 983b20b
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 10:14:55 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 10:14:55 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8cdfaf95/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 51fe63b..f2cbc6b 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -187,6 +187,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
log.debug( "De-indexing type {} with documentId '{}'" , entityType, indexId);
String[] indexes = entityIndex.getIndexes(EntityIndex.AliasType.Read);
+ //get the default index if no alias exists yet
if(indexes == null ||indexes.length == 0){
indexes = new String[]{indexIdentifier.getIndex(null)};
}
[48/50] [abbrv] incubator-usergrid git commit: Fixes TokenServiceIT
and bug in ManagementService counter test
Posted by sn...@apache.org.
Fixes TokenServiceIT and bug in ManagementService counter test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/31bb3f18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/31bb3f18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/31bb3f18
Branch: refs/heads/two-dot-o-events
Commit: 31bb3f18d358faa30ab451cfaf97aa78823d65fe
Parents: 2175834
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 17:03:34 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 17:03:34 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 5 ++-
.../security/tokens/TokenServiceIT.java | 40 ++++++++------------
.../usergrid/services/ServiceFactoryIT.java | 4 +-
3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index ddb2bbb..6957097 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -161,9 +161,10 @@ public class ManagementServiceIT {
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
- assertNotNull( counts.get( "admin_logins" ) );
- final long startCount = counts.get( "admin_logins" );
+ final Long existingCounts = counts.get( "admin_logins" );
+
+ final long startCount = existingCounts == null ? 0 : existingCounts;
setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 49d939c..67bc035 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.security.tokens;
import java.util.HashMap;
import java.util.Map;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
@@ -27,6 +28,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -73,15 +75,13 @@ public class TokenServiceIT {
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
- @BeforeClass
- public static void setup() throws Exception {
- log.info( "in setup" );
- adminUser =
- setup.getMgmtSvc().createAdminUser( "edanuff34", "Ed Anuff", "ed@anuff34.com", "test", false, false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "TokenServiceTestOrg", adminUser, true );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
- // TODO update to organizationName/applicationName
- setup.getMgmtSvc().createApplication( organization.getUuid(), "TokenServiceTestOrg/ed-application" ).getId();
+ @Before
+ public void setup() throws Exception {
+ log.info( "in setup" );
+ adminUser = newOrgAppAdminRule.getAdminInfo();
}
@@ -91,8 +91,8 @@ public class TokenServiceIT {
Map<String, Object> data = new HashMap<String, Object>() {
{
- put( "email", "ed@anuff34.com" );
- put( "username", "edanuff34" );
+ put( "email", adminUser.getEmail());
+ put( "username", adminUser.getUsername());
}
};
@@ -106,8 +106,8 @@ public class TokenServiceIT {
long last_access = tokenInfo.getAccessed();
assertEquals( "email_confirm", tokenInfo.getType() );
- assertEquals( "ed@anuff34.com", tokenInfo.getState().get( "email" ) );
- assertEquals( "edanuff34", tokenInfo.getState().get( "username" ) );
+ assertEquals( adminUser.getEmail(), tokenInfo.getState().get( "email" ) );
+ assertEquals( adminUser.getUsername(), tokenInfo.getState().get( "username" ) );
tokenInfo = setup.getTokenSvc().getTokenInfo( tokenStr );
@@ -311,9 +311,7 @@ public class TokenServiceIT {
@Test
public void appDefaultExpiration() throws Exception {
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo", "foobar", "foobar", "foo@bar.com", "foobar" );
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
Application app = em.getApplication();
AuthPrincipalInfo userPrincipal =
@@ -328,11 +326,7 @@ public class TokenServiceIT {
@Test
public void appExpiration() throws Exception {
-
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo2", "foobar2", "foobar", "foo2@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
@@ -409,11 +403,7 @@ public class TokenServiceIT {
@Test
public void appExpirationInfinite() throws Exception {
-
- OrganizationOwnerInfo orgInfo = setup.getMgmtSvc().createOwnerAndOrganization( "appExpirationInfinite",
- "appExpirationInfinite", "foobar", "appExpirationInfinite@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
index 71152c9..e4e576f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
@@ -26,6 +26,8 @@ import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.services.simple.SimpleService;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -40,7 +42,7 @@ public class ServiceFactoryIT extends AbstractServiceIT {
public void testPackagePrefixes() throws Exception {
logger.info( "test package prefixes" );
- UUID applicationId = setup.getEmf().createApplication( "org", "app" );
+ UUID applicationId = setup.getEmf().createApplication(uniqueOrg(), uniqueApp() );
ServiceManager sm = setup.getSmf().getServiceManager( applicationId );
Service service = sm.getService( "simple" );
assertEquals( "/simple", service.getServiceType() );
[15/50] [abbrv] incubator-usergrid git commit: add observable to
refresh
Posted by sn...@apache.org.
add observable to refresh
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/8d344268
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/8d344268
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/8d344268
Branch: refs/heads/two-dot-o-events
Commit: 8d344268ba435253497a7c92db895152c193a20a
Parents: 21630f4
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 17:32:03 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 17:32:03 2014 -0700
----------------------------------------------------------------------
.../persistence/index/impl/EsEntityIndexBatchImpl.java | 6 +-----
.../usergrid/persistence/index/impl/EsEntityIndexImpl.java | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d344268/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 0d0e52b..cd5be7f 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -191,7 +191,6 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
if(indexes == null ||indexes.length == 0){
indexes = new String[]{indexIdentifier.getIndex(null)};
}
- final AtomicInteger errorCount = new AtomicInteger();
//get all indexes then flush everyone
Observable.from(indexes).subscribeOn(Schedulers.io())
.map(new Func1<String, Object>() {
@@ -201,15 +200,12 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
bulkRequest.add(client.prepareDelete(index, entityType, indexId).setRefresh(refresh));
}catch (Exception e){
log.error("failed to deindex",e);
- errorCount.incrementAndGet();
+ throw e;
}
return index;
}
}).toBlocking().last();
- if(errorCount.get()>0){
- log.error("Failed to flush some indexes");
- }
log.debug( "Deindexed Entity with index id " + indexId );
maybeFlush();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d344268/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 4bca8c2..3f895b5 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -464,7 +464,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();
return index;
}
- });
+ }).toBlocking().last();
logger.debug( "Refreshed index: " + alias);
[30/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/two-dot-o' into USERGRID-252
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/43ed8464
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/43ed8464
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/43ed8464
Branch: refs/heads/two-dot-o-events
Commit: 43ed8464f81316619f3985a43fb61d2a0aa1c78a
Parents: 5d4ce72 04679c8
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 17:31:33 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 17:31:33 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManagerFactory.java | 4 +-
.../persistence/index/AliasedEntityIndex.java | 48 ++++++++
.../usergrid/persistence/index/EntityIndex.java | 5 -
.../usergrid/persistence/index/IndexFig.java | 3 +
.../index/impl/EsEntityIndexBatchImpl.java | 38 +++++--
.../index/impl/EsEntityIndexImpl.java | 44 ++++---
.../persistence/index/impl/EsIndexCache.java | 114 +++++++++++++++++++
.../persistence/index/impl/EntityIndexTest.java | 61 +++++++---
8 files changed, 273 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
[21/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/574fe644
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/574fe644
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/574fe644
Branch: refs/heads/no-source-in-es
Commit: 574fe6449a96a7f8a8531cdb0c2f81ad7a2643e9
Parents: 1d2697f
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 11:16:16 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 11:16:16 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/IndexFig.java | 3 +++
.../persistence/index/impl/EsIndexCache.java | 23 ++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/574fe644/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index ea0a4f3..d78ed72 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -110,4 +110,7 @@ public interface IndexFig extends GuicyFig {
@Default( "20" )
@Key( ELASTICSEARCH_FAIL_REFRESH )
int getFailRefreshCount();
+
+ @Default("2")
+ int getIndexCacheMaxWorkers();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/574fe644/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
index f418590..c607222 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -24,9 +24,13 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListenableFutureTask;
+import com.google.common.util.concurrent.ListeningScheduledExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.IndexFig;
import org.apache.usergrid.persistence.index.IndexIdentifier;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.client.AdminClient;
@@ -36,7 +40,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
+import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
@@ -46,21 +52,30 @@ import java.util.concurrent.TimeUnit;
public class EsIndexCache {
private static final Logger logger = LoggerFactory.getLogger(EsEntityIndexImpl.class);
+ private final ListeningScheduledExecutorService refreshExecutors;
private LoadingCache<String, String[]> aliasIndexCache;
@Inject
- public EsIndexCache(final EsProvider provider) {
+ public EsIndexCache(final EsProvider provider, final IndexFig indexFig) {
+ this.refreshExecutors = MoreExecutors
+ .listeningDecorator(Executors.newScheduledThreadPool(indexFig.getIndexCacheMaxWorkers()));
aliasIndexCache = CacheBuilder.newBuilder().maximumSize(1000)
.refreshAfterWrite(5,TimeUnit.MINUTES)
.build(new CacheLoader<String, String[]>() {
@Override
- public ListenableFuture<String[]> reload(String key, String[] oldValue) throws Exception {
- return super.reload(key, oldValue);
+ public ListenableFuture<String[]> reload(final String key, String[] oldValue) throws Exception {
+ ListenableFutureTask<String[]> task = ListenableFutureTask.create( new Callable<String[]>() {
+ public String[] call() {
+ return load( key );
+ }
+ } );
+ refreshExecutors.execute(task);
+ return task;
}
@Override
- public String[] load(String aliasName) {
+ public String[] load(final String aliasName) {
final AdminClient adminClient = provider.getClient().admin();
//remove write alias, can only have one
ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
[02/50] [abbrv] incubator-usergrid git commit: add comment
Posted by sn...@apache.org.
add comment
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/8cdfaf95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/8cdfaf95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/8cdfaf95
Branch: refs/heads/two-dot-o-events
Commit: 8cdfaf9547da2a69a34b9b548167201c6a1a3068
Parents: 983b20b
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 10:14:55 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 10:14:55 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8cdfaf95/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 51fe63b..f2cbc6b 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -187,6 +187,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
log.debug( "De-indexing type {} with documentId '{}'" , entityType, indexId);
String[] indexes = entityIndex.getIndexes(EntityIndex.AliasType.Read);
+ //get the default index if no alias exists yet
if(indexes == null ||indexes.length == 0){
indexes = new String[]{indexIdentifier.getIndex(null)};
}
[32/50] [abbrv] incubator-usergrid git commit: Finished first pass in
core
Posted by sn...@apache.org.
Finished first pass in core
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bc93f693
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bc93f693
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bc93f693
Branch: refs/heads/no-source-in-es
Commit: bc93f693a7a85c89dc59304fba825209e385ebfc
Parents: 43ed846
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 11:40:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 11:40:45 2014 -0700
----------------------------------------------------------------------
stack/core/pom.xml | 15 +---
.../org/apache/usergrid/AbstractCoreIT.java | 12 ++-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ------------
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 --------------------
.../usergrid/ConcurrentCoreTestSuite.java | 46 -----------
.../java/org/apache/usergrid/CoreITSuite.java | 58 --------------
.../java/org/apache/usergrid/CoreTestSuite.java | 45 -----------
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ------------
.../usergrid/batch/SchedulerTestSuite.java | 34 --------
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +++--
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 ++---
.../cassandra/EntityManagerFactoryImplIT.java | 21 +++--
.../query/AbstractIteratingQueryIT.java | 15 +++-
.../system/UsergridSystemMonitorIT.java | 14 +++-
15 files changed, 76 insertions(+), 413 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 61ce099..e5cdae5 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -183,19 +183,10 @@
<argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
<includes>
- <include>**/*ConcurrentCoreITSuite.java</include>
- <include>**/SchedulerTestSuite.java</include>
- <include>**/SchedulerRuntime*IT.java</include>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
</includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/CoreITSuite.java</exclude>
- <exclude>**/CoreTestSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerITSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerTestSuite.java</exclude>
- <exclude>**/*Test.java</exclude>
- </excludes>
+
</configuration>
<version>2.15</version>
</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
index f58e426..da80714 100644
--- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
@@ -21,6 +21,9 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.JsonUtils;
@@ -29,7 +32,14 @@ public abstract class AbstractCoreIT {
private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class );
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl( CoreITSuite.cassandraResource, CoreITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
deleted file mode 100644
index d981ee9..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
+++ /dev/null
@@ -1,51 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- // HectorLockManagerIT.class,
- UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class, EntityConnectionsIT.class,
- EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class, MessagesIT.class,
- PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class ConcurrentCoreITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
deleted file mode 100644
index 1312950..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
+++ /dev/null
@@ -1,83 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.persistence.query.AllInCollectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionNoTypeIT;
-import org.apache.usergrid.persistence.query.MultiOrderByCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualConnectionIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- AllInCollectionIT.class, AllInConnectionIT.class, AllInConnectionNoTypeIT.class, MultiOrderByCollectionIT.class,
- MultiOrderByComplexUnionCollectionIT.class, MultiOrderByComplexUnionConnectionIT.class,
- SingleOrderByBoundRangeScanAscCollectionIT.class, SingleOrderByBoundRangeScanAscConnectionIT.class,
- SingleOrderByBoundRangeScanDescCollectionIT.class, SingleOrderByBoundRangeScanDescConnectionIT.class,
- SingleOrderByComplexIntersectionCollectionIT.class, SingleOrderByComplexIntersectionConnectionIT.class,
- SingleOrderByComplexUnionCollectionIT.class, SingleOrderByComplexUnionConnectionIT.class,
- SingleOrderByLessThanLimitCollectionIT.class, SingleOrderByLessThanLimitConnectionIT.class,
- SingleOrderByMaxLimitCollectionIT.class, SingleOrderByMaxLimitConnectionIT.class,
- SingleOrderByNoIntersectionCollectionIT.class, SingleOrderByNoIntersectionConnectionIT.class,
- SingleOrderByNotCollectionIT.class, SingleOrderByNotConnectionIT.class,
- SingleOrderBySameRangeScanGreaterCollectionIT.class, SingleOrderBySameRangeScanGreaterConnectionIT.class,
- SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.class, SingleOrderBySameRangeScanLessCollectionIT.class,
- SingleOrderBySameRangeScanLessConnectionIT.class, SingleOrderBySameRangeScanLessThanEqualCollectionIT.class,
- SingleOrderBySameRangeScanLessThanEqualConnectionIT.class
-})
-@Concurrent(threads = 1)
-public class ConcurrentCoreIteratorITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
deleted file mode 100644
index 56c7871..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
+++ /dev/null
@@ -1,46 +0,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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class ConcurrentCoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
deleted file mode 100644
index ff06a80..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
+++ /dev/null
@@ -1,58 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.cassandra.HectorLockManagerIT;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- HectorLockManagerIT.class, UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class,
- EntityConnectionsIT.class, EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class,
- MessagesIT.class, PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class CoreITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
deleted file mode 100644
index 314b4e5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
+++ /dev/null
@@ -1,45 +0,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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class CoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
deleted file mode 100644
index f8c9f87..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
+++ /dev/null
@@ -1,50 +0,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.batch;
-
-
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.job.SchedulerRuntime1IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime2IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime3IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime4IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime5IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime6IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime7IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime8IT;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- SchedulerRuntime1IT.class, SchedulerRuntime2IT.class, SchedulerRuntime3IT.class,
- SchedulerRuntime4IT.class, SchedulerRuntime5IT.class, SchedulerRuntime6IT.class,
- SchedulerRuntime7IT.class, SchedulerRuntime8IT.class
- })
-@Concurrent()
-@Ignore("TODO: Todd fix. Does not reliably pass on our build server.")
-// TODO - this suite actually runs correctly now so we can
-// remove this ignore if Todd is OK with it.
-public class SchedulerITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
deleted file mode 100644
index 7e62dd5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
+++ /dev/null
@@ -1,34 +0,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.batch;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.AppArgsTest;
-import org.apache.usergrid.batch.BulkJobExecutionUnitTest;
-import org.apache.usergrid.batch.UsergridJobFactoryTest;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class,
- })
-@Concurrent()
-public class SchedulerTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
index f939d0d..1d87b73 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -17,20 +17,20 @@
package org.apache.usergrid.batch.job;
-import com.google.common.util.concurrent.Service.State;
import java.util.Properties;
-import org.apache.usergrid.batch.SchedulerITSuite;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+
import org.apache.usergrid.batch.service.JobSchedulerService;
import org.apache.usergrid.batch.service.SchedulerService;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.SchemaManager;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Ignore;
+import com.google.common.util.concurrent.Service.State;
/**
@@ -44,8 +44,10 @@ public class AbstractSchedulerRuntimeIT {
protected static final String RUNLOOP_PROP = "usergrid.scheduler.job.interval";
protected static final String FAIL_PROP = "usergrid.scheduler.job.maxfail";
+
@ClassRule
- public static CassandraResource cassandraResource = SchedulerITSuite.cassandraResource;
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
index e360244..8a596a5 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
@@ -22,15 +22,15 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.count.SimpleBatcher;
import org.apache.usergrid.persistence.entities.Event;
@@ -61,7 +61,7 @@ public class CounterIT extends AbstractCoreIT {
@Before
public void getSubmitter() {
//set the batcher to block the submit so we wait for results when testing
- SimpleBatcher batcher = CoreITSuite.cassandraResource.getBean( SimpleBatcher.class );
+ SimpleBatcher batcher = cassandraResource.getBean( SimpleBatcher.class );
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index e839fa1..dc6593b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -21,13 +21,14 @@ import java.nio.ByteBuffer;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
-import me.prettyprint.hector.api.Keyspace;
-import static me.prettyprint.hector.api.factory.HFactory.createMutator;
-import me.prettyprint.hector.api.mutation.Mutator;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.cassandra.CassandraService;
import org.apache.usergrid.persistence.cassandra.IndexUpdate;
@@ -37,12 +38,14 @@ import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
+import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.mutation.Mutator;
+
+import static me.prettyprint.hector.api.factory.HFactory.createMutator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Concurrent()
@@ -445,7 +448,7 @@ public class IndexIT extends AbstractCoreIT {
RelationManagerImpl impl = (RelationManagerImpl)rm;
- CassandraService cass = CoreITSuite.cassandraResource.getBean( CassandraService.class );
+ CassandraService cass = cassandraResource.getBean( CassandraService.class );
ByteBufferSerializer buf = ByteBufferSerializer.get();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
index 4cc0dbd..4edd121 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
@@ -22,16 +22,19 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.ClassRule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
@@ -41,6 +44,7 @@ import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.cassandra.util.TraceTag;
import org.apache.usergrid.persistence.cassandra.util.TraceTagManager;
import org.apache.usergrid.persistence.cassandra.util.TraceTagReporter;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -57,8 +61,15 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
private static final Logger logger = LoggerFactory.getLogger( EntityManagerFactoryImplIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
public EntityManagerFactoryImplIT() {
- emf = CoreITSuite.cassandraResource.getBean( EntityManagerFactory.class );
+ emf = cassandraResource.getBean( EntityManagerFactory.class );
}
@@ -89,9 +100,9 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
@Before
public void initTracing() {
- traceTagManager = CoreITSuite.cassandraResource.getBean(
+ traceTagManager = cassandraResource.getBean(
"traceTagManager", TraceTagManager.class );
- traceTagReporter = CoreITSuite.cassandraResource.getBean(
+ traceTagReporter = cassandraResource.getBean(
"traceTagReporter", TraceTagReporter.class );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
index d8f31ff..ff47846 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
@@ -30,11 +30,12 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.ConcurrentCoreIteratorITSuite;
import org.apache.usergrid.CoreApplication;
import org.apache.usergrid.CoreITSetup;
import org.apache.usergrid.CoreITSetupImpl;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.persistence.Entity;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.persistence.Results;
@@ -48,10 +49,16 @@ public abstract class AbstractIteratingQueryIT {
public static final long WRITE_DELAY = 0; // milliseconds to delay between writes in loop
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl(
- ConcurrentCoreIteratorITSuite.cassandraResource,
- ConcurrentCoreIteratorITSuite.elasticSearchResource );
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
index 7456106..a9f9e18 100644
--- a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
@@ -20,13 +20,15 @@ package org.apache.usergrid.system;
import java.util.Date;
import org.junit.Before;
+import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.usergrid.CoreITSuite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.utils.MapUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.utils.MapUtils;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,12 +36,16 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent
public class UsergridSystemMonitorIT {
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
private UsergridSystemMonitor usergridSystemMonitor;
@Before
public void setupLocal() {
- usergridSystemMonitor = CoreITSuite.cassandraResource.getBean( UsergridSystemMonitor.class );
+ usergridSystemMonitor = cassandraResource.getBean( UsergridSystemMonitor.class );
}
[49/50] [abbrv] incubator-usergrid git commit: Merge branch
'two-dot-o' into two-dot-o-events
Posted by sn...@apache.org.
Merge branch 'two-dot-o' into two-dot-o-events
Conflicts:
stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.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/a8cc5870
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a8cc5870
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a8cc5870
Branch: refs/heads/two-dot-o-events
Commit: a8cc5870da6326e78b54ba358e06ed367953846c
Parents: a290e0d 31bb3f1
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Dec 11 13:59:36 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Dec 11 13:59:36 2014 -0500
----------------------------------------------------------------------
.../main/dist/init_instance/init_rest_server.sh | 18 +-
stack/core/pom.xml | 15 +-
.../corepersistence/CpEntityManagerFactory.java | 4 +-
.../org/apache/usergrid/AbstractCoreIT.java | 12 +-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ----
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 ------
.../usergrid/ConcurrentCoreTestSuite.java | 46 ----
.../java/org/apache/usergrid/CoreITSuite.java | 58 ----
.../java/org/apache/usergrid/CoreTestSuite.java | 45 ----
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ----
.../usergrid/batch/SchedulerTestSuite.java | 34 ---
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +-
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 +-
.../cassandra/EntityManagerFactoryImplIT.java | 21 +-
.../query/AbstractIteratingQueryIT.java | 15 +-
.../system/UsergridSystemMonitorIT.java | 14 +-
.../persistence/index/AliasedEntityIndex.java | 48 ++++
.../usergrid/persistence/index/EntityIndex.java | 5 -
.../usergrid/persistence/index/IndexFig.java | 3 +
.../index/impl/EsEntityIndexBatchImpl.java | 43 ++-
.../index/impl/EsEntityIndexImpl.java | 46 ++--
.../persistence/index/impl/EsIndexCache.java | 114 ++++++++
.../persistence/index/impl/EntityIndexTest.java | 61 ++++-
.../persistence/queue/DefaultQueueManager.java | 68 +++++
stack/loadtests/runtests.sh | 120 +++++++++
.../apache/usergrid/helpers/Extractors.scala | 84 ++++++
.../org/apache/usergrid/helpers/Setup.scala | 30 +--
.../usergrid/scenarios/UserScenarios.scala | 177 +++++++++---
.../org/apache/usergrid/settings/Headers.scala | 6 +-
.../simulations/DeleteUsersSimulation.scala | 56 ++++
.../simulations/GetUserPagesSimulation.scala | 51 ++++
.../simulations/GetUsersSimulation.scala | 51 ++++
.../simulations/PutUsersSimulation.scala | 56 ++++
stack/services/pom.xml | 268 ++++---------------
.../cassandra/ManagementServiceImpl.java | 2 -
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/NewOrgAppAdminRule.java | 159 +++++++++++
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 124 ++++++---
.../usergrid/management/OrganizationIT.java | 36 ++-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 46 ++--
.../management/cassandra/ExportServiceIT.java | 63 +++--
.../cassandra/ManagementServiceIT.java | 94 ++++---
.../security/providers/FacebookProviderIT.java | 21 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 55 ++--
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceFactoryIT.java | 4 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
.../usergrid/services/TestQueueManager.java | 65 -----
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
.../java/org/apache/usergrid/TestHelper.java | 75 ++++++
56 files changed, 1632 insertions(+), 1128 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8cc5870/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8cc5870/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8cc5870/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a8cc5870/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 1ae2d6a,67e1680..b743d83
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@@ -26,30 -23,9 +26,31 @@@ import java.util.ArrayList
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.usergrid.persistence.index.*;
-import org.apache.usergrid.persistence.index.utils.StringUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.util.Health;
+import org.apache.usergrid.persistence.core.util.ValidationUtils;
- import org.apache.usergrid.persistence.index.EntityIndex;
++import org.apache.usergrid.persistence.index.AliasedEntityIndex;
++import org.apache.usergrid.persistence.index.AliasedEntityIndex.AliasType;
+import org.apache.usergrid.persistence.index.EntityIndexBatch;
+import org.apache.usergrid.persistence.index.IndexFig;
+import org.apache.usergrid.persistence.index.IndexIdentifier;
+import org.apache.usergrid.persistence.index.IndexScope;
+import org.apache.usergrid.persistence.index.SearchTypes;
+import org.apache.usergrid.persistence.index.exceptions.IndexException;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.ENTITYID_ID_FIELDNAME;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.ENTITY_VERSION_FIELDNAME;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.SPLITTER;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.STRING_PREFIX;
+import org.apache.usergrid.persistence.index.query.CandidateResult;
+import org.apache.usergrid.persistence.index.query.CandidateResults;
+import org.apache.usergrid.persistence.index.query.Query;
+import org.apache.usergrid.persistence.model.entity.Id;
+import org.apache.usergrid.persistence.model.entity.SimpleId;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+import org.elasticsearch.action.ShardOperationFailedException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
@@@ -86,6 -54,29 +84,8 @@@ import org.elasticsearch.search.sort.So
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.util.Health;
-import org.apache.usergrid.persistence.core.util.ValidationUtils;
-import org.apache.usergrid.persistence.index.exceptions.IndexException;
-import org.apache.usergrid.persistence.index.query.CandidateResult;
-import org.apache.usergrid.persistence.index.query.CandidateResults;
-import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
+ import rx.Observable;
+ import rx.functions.Func1;
-import rx.schedulers.Schedulers;
-
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.SPLITTER;
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.STRING_PREFIX;
/**
[13/50] [abbrv] incubator-usergrid git commit: merge
Posted by sn...@apache.org.
merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/21630f49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/21630f49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/21630f49
Branch: refs/heads/two-dot-o-events
Commit: 21630f498e7f59cd760e0fd2cd69c1f38de25f45
Parents: 8cdfaf9 a63b856
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 17:23:52 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 17:23:52 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManager.java | 230 ++++++++++---------
.../corepersistence/CpEntityManagerFactory.java | 6 +-
.../corepersistence/util/CpEntityMapUtils.java | 32 ++-
.../batch/job/SchedulerRuntimeIntervalIT.java | 49 ++--
.../migration/EntityDataMigrationIT.java | 139 +++++------
.../migration/EntityTypeMappingMigrationIT.java | 89 +++----
.../apache/usergrid/persistence/CounterIT.java | 89 ++++---
.../usergrid/persistence/CountingMutatorIT.java | 4 +-
.../persistence/EntityDictionaryIT.java | 11 +-
.../usergrid/persistence/EntityManagerIT.java | 47 ++--
.../persistence/GeoQueryBooleanTest.java | 7 +-
.../apache/usergrid/persistence/IndexIT.java | 14 +-
.../usergrid/persistence/PathQueryIT.java | 10 +-
.../PerformanceEntityRebuildIndexTest.java | 6 +-
.../usergrid/persistence/PermissionsIT.java | 5 +-
.../cassandra/EntityManagerFactoryImplIT.java | 9 +-
.../query/AbstractIteratingQueryIT.java | 3 +-
stack/core/src/test/resources/log4j.properties | 5 +-
.../data/DataMigrationManagerImpl.java | 29 ++-
.../persistence/index/AliasedEntityIndex.java | 55 +++++
.../usergrid/persistence/index/EntityIndex.java | 26 ---
.../persistence/index/IndexIdentifier.java | 4 +
.../index/impl/EsEntityIndexBatchImpl.java | 6 +-
.../index/impl/EsEntityIndexImpl.java | 88 ++++---
.../persistence/index/impl/EntityIndexTest.java | 15 +-
.../persistence/queue/DefaultQueueManager.java | 68 ++++++
.../usergrid/services/TestQueueManager.java | 65 ------
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
30 files changed, 647 insertions(+), 507 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/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 f6b0df8,f6b0df8..56eb258
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@@ -64,6 -64,6 +64,7 @@@ import org.apache.usergrid.persistence.
import org.apache.usergrid.persistence.graph.GraphManagerFactory;
import org.apache.usergrid.persistence.graph.SearchByEdgeType;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
++import org.apache.usergrid.persistence.index.AliasedEntityIndex;
import org.apache.usergrid.persistence.index.EntityIndex;
import org.apache.usergrid.persistence.index.EntityIndexFactory;
import org.apache.usergrid.persistence.index.query.Query;
@@@ -702,7 -702,7 +703,10 @@@ public class CpEntityManagerFactory imp
@Override
public void addIndex(final UUID applicationId,final String indexSuffix,final int shards,final int replicas){
-- getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope( applicationId )).addIndex(indexSuffix,shards,replicas);
++ EntityIndex entityIndex = getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(applicationId));
++ if(entityIndex instanceof AliasedEntityIndex) {
++ ((AliasedEntityIndex)entityIndex).addIndex(indexSuffix, shards, replicas);
++ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
index 0000000,0000000..15a0d45
new file mode 100644
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
@@@ -1,0 -1,0 +1,55 @@@
++/*
++ *
++ * * 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.persistence.index;
++
++/**
++ * EntityIndex with aliases for multiple indexes
++ */
++public interface AliasedEntityIndex extends EntityIndex{
++
++ /**
++ * Get the indexes for an alias
++ * @param aliasType name of alias
++ * @return list of index names
++ */
++ public String[] getIndexes(final AliasType aliasType);
++
++ /**
++ * Add alias to index, will remove old index from write alias
++ * @param indexSuffix must be different than current index
++ */
++ public void addAlias(final String indexSuffix);
++
++ /**
++ * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
++ * @param indexSuffix index name
++ * @param shards
++ * @param replicas
++ */
++ public void addIndex(final String indexSuffix, final int shards, final int replicas);
++
++ /**
++ * type of alias
++ */
++ public enum AliasType {
++ Read, Write
++ }
++}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index f38a390,4a653b3..549f87e
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@@ -38,31 -38,24 +38,12 @@@ public interface EntityIndex
*/
public void initializeIndex();
-- /**
-- * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
-- * @param indexSuffix index name
-- * @param shards
-- * @param replicas
-- */
-- public void addIndex(final String indexSuffix, final int shards, final int replicas);
-
- /**
- * Get the indexes for an alias
- * @param aliasName name of alias
- * @return list of index names
- */
- public String[] getIndexes(final AliasType aliasType);
/**
* Create the index batch.
*/
public EntityIndexBatch createBatch();
-- /**
-- * Add alias to index, will remove old index from write alias
-- * @param indexSuffix must be different than current index
-- */
-- public void addAlias(final String indexSuffix);
/**
* Execute query in Usergrid syntax.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index f2cbc6b,a3ca8a5..0d0e52b
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@@ -94,11 -92,9 +94,11 @@@ public class EsEntityIndexBatchImpl imp
private final FailureMonitor failureMonitor;
- private final EntityIndex entityIndex;
++ private final AliasedEntityIndex entityIndex;
+
public EsEntityIndexBatchImpl( final ApplicationScope applicationScope, final Client client,
- final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor, final EntityIndex entityIndex ) {
- final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor ) {
++ final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor, final AliasedEntityIndex entityIndex ) {
this.applicationScope = applicationScope;
this.client = client;
@@@ -186,30 -181,9 +186,30 @@@
log.debug( "De-indexing type {} with documentId '{}'" , entityType, indexId);
- String[] indexes = entityIndex.getIndexes(EntityIndex.AliasType.Read);
-
- bulkRequest.add( client.prepareDelete(alias.getWriteAlias(), entityType, indexId ).setRefresh( refresh ) );
-
++ String[] indexes = entityIndex.getIndexes(AliasedEntityIndex.AliasType.Read);
+ //get the default index if no alias exists yet
+ if(indexes == null ||indexes.length == 0){
+ indexes = new String[]{indexIdentifier.getIndex(null)};
+ }
+ final AtomicInteger errorCount = new AtomicInteger();
+ //get all indexes then flush everyone
+ Observable.from(indexes).subscribeOn(Schedulers.io())
+ .map(new Func1<String, Object>() {
+ @Override
+ public Object call(String index) {
+ try {
+ bulkRequest.add(client.prepareDelete(index, entityType, indexId).setRefresh(refresh));
+ }catch (Exception e){
+ log.error("failed to deindex",e);
+ errorCount.incrementAndGet();
+ }
+ return index;
+ }
+ }).toBlocking().last();
+
+ if(errorCount.get()>0){
+ log.error("Failed to flush some indexes");
+ }
log.debug( "Deindexed Entity with index id " + indexId );
maybeFlush();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 5824c38,eb050d6..4bca8c2
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@@ -73,6 -72,6 +72,9 @@@ import org.apache.usergrid.persistence.
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
++import rx.Observable;
++import rx.functions.Func1;
++import rx.schedulers.Schedulers;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
@@@ -83,7 -82,7 +85,7 @@@ import static org.apache.usergrid.persi
/**
* Implements index using ElasticSearch Java API.
*/
--public class EsEntityIndexImpl implements EntityIndex {
++public class EsEntityIndexImpl implements AliasedEntityIndex {
private static final Logger logger = LoggerFactory.getLogger( EsEntityIndexImpl.class );
@@@ -178,18 -184,27 +187,24 @@@
Boolean isAck;
String indexName = indexIdentifier.getIndex(indexSuffix);
final AdminClient adminClient = esProvider.getClient().admin();
+
- //remove write alias, can only have one
- ImmutableOpenMap<String,List<AliasMetaData>> aliasMap = adminClient.indices()
- .getAliases(new GetAliasesRequest(alias.getWriteAlias())).actionGet().getAliases();
- String[] indexNames = aliasMap.keys().toArray(String.class);
+ String[] indexNames = getIndexes(alias.getWriteAlias());
for(String currentIndex : indexNames){
- isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,alias.getWriteAlias()).execute().actionGet().isAcknowledged();
- logger.info("Removed Index Name [{}] from Alias=[{}] ACK=[{}]",currentIndex, alias, isAck);
+ isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,
+ alias.getWriteAlias()).execute().actionGet().isAcknowledged();
+ logger.info("Removed Index Name [{}] from Alias=[{}] ACK=[{}]",currentIndex, alias, isAck);
}
+
//add read alias
- isAck = adminClient.indices().prepareAliases().addAlias(indexName, alias.getReadAlias()).execute().actionGet().isAcknowledged();
+ isAck = adminClient.indices().prepareAliases().addAlias(
+ indexName, alias.getReadAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new read Alias Name [{}] ACK=[{}]", alias, isAck);
+
//add write alias
- isAck = adminClient.indices().prepareAliases().addAlias(indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
+ isAck = adminClient.indices().prepareAliases().addAlias(
+ indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new write Alias Name [{}] ACK=[{}]", alias, isAck);
} catch (Exception e) {
@@@ -233,17 -231,19 +248,19 @@@
public boolean doOp() {
final String tempId = UUIDGenerator.newTimeUUID().toString();
- esProvider.getClient().prepareIndex( alias.getWriteAlias(), VERIFY_TYPE, tempId ).setSource( DEFAULT_PAYLOAD )
- .get();
+ esProvider.getClient().prepareIndex( alias.getWriteAlias(), VERIFY_TYPE, tempId )
- .setSource( DEFAULT_PAYLOAD ).get();
++ .setSource(DEFAULT_PAYLOAD).get();
- logger.info( "Successfully created new document with docId {} in index {} and type {}", tempId,
- alias, VERIFY_TYPE );
+ logger.info( "Successfully created new document with docId {} "
+ + "in index {} and type {}", tempId, alias, VERIFY_TYPE );
// delete all types, this way if we miss one it will get cleaned up
- esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() ).setTypes(VERIFY_TYPE)
- .setQuery( MATCH_ALL_QUERY_BUILDER ).get();
+ esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() )
+ .setTypes(VERIFY_TYPE)
- .setQuery( MATCH_ALL_QUERY_BUILDER ).get();
++ .setQuery(MATCH_ALL_QUERY_BUILDER).get();
- logger.info( "Successfully deleted all documents in index {} and type {}", alias, VERIFY_TYPE );
+ logger.info( "Successfully deleted all documents in index {} and type {}",
+ alias, VERIFY_TYPE );
return true;
@@@ -440,7 -440,8 +457,15 @@@
@Override
public boolean doOp() {
try {
- esProvider.getClient().admin().indices().prepareRefresh( alias.getReadAlias() ).execute().actionGet();
- esProvider.getClient().admin().indices().prepareRefresh( alias.getWriteAlias() )
- .execute().actionGet();
++ String[] indexes = getIndexes(AliasType.Read);
++ Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
++ @Override
++ public String call(String index) {
++ esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();
++ return index;
++ }
++ });
++
logger.debug( "Refreshed index: " + alias);
return true;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 47c4dbd,13d1552..fd94985
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@@ -25,7 -25,6 +25,8 @@@ import java.util.LinkedHashMap
import java.util.List;
import java.util.Map;
++import org.apache.usergrid.persistence.index.*;
+import org.apache.usergrid.persistence.index.query.CandidateResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@@ -38,11 -37,11 +39,6 @@@ import org.apache.usergrid.persistence.
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.test.UseModules;
import org.apache.usergrid.persistence.core.util.Health;
--import org.apache.usergrid.persistence.index.EntityIndex;
--import org.apache.usergrid.persistence.index.EntityIndexBatch;
--import org.apache.usergrid.persistence.index.EntityIndexFactory;
--import org.apache.usergrid.persistence.index.IndexScope;
--import org.apache.usergrid.persistence.index.SearchTypes;
import org.apache.usergrid.persistence.index.guice.TestIndexModule;
import org.apache.usergrid.persistence.index.query.CandidateResults;
import org.apache.usergrid.persistence.index.query.Query;
@@@ -115,7 -114,7 +111,7 @@@ public class EntityIndexTest extends Ba
ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
-- EntityIndex entityIndex = eif.createEntityIndex( applicationScope );
++ AliasedEntityIndex entityIndex =(AliasedEntityIndex) eif.createEntityIndex( applicationScope );
entityIndex.initializeIndex();
final String entityType = "thing";
@@@ -140,41 -139,6 +136,42 @@@
testQuery(indexScope, searchTypes, entityIndex, "name = 'Lowe Kelley'", 1 );
}
+ @Test
+ public void testDeleteByQueryWithAlias() throws IOException {
+ Id appId = new SimpleId( "application" );
+
+ ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
+
- EntityIndex entityIndex = eif.createEntityIndex(applicationScope);
++ AliasedEntityIndex entityIndex =(AliasedEntityIndex) eif.createEntityIndex( applicationScope );
++
+ entityIndex.initializeIndex();
+
+ final String entityType = "thing";
+ IndexScope indexScope = new IndexScopeImpl( appId, "things" );
+ final SearchTypes searchTypes = SearchTypes.fromTypes( entityType );
+
+ insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json",1,0);
+
+ entityIndex.refresh();
+
- entityIndex.addIndex("v2", 1,0);
++ entityIndex.addIndex("v2", 1, 0);
+
- insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json",1,0);
++ insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json", 1, 0);
+
+ entityIndex.refresh();
+ CandidateResults crs = testQuery(indexScope, searchTypes, entityIndex, "name = 'Bowers Oneil'", 2);
+
+ EntityIndexBatch entityIndexBatch = entityIndex.createBatch();
+ entityIndexBatch.deindex(indexScope, crs.get(0));
+ entityIndexBatch.deindex(indexScope, crs.get(1));
+ entityIndexBatch.executeAndRefresh();
+ entityIndex.refresh();
+
+ //Hilda Youn
+ testQuery(indexScope, searchTypes, entityIndex, "name = 'Bowers Oneil'", 0);
+
+ }
+
private void insertJsonBlob(EntityIndex entityIndex, String entityType, IndexScope indexScope, String filePath,final int max,final int startIndex) throws IOException {
InputStream is = this.getClass().getResourceAsStream( filePath );
ObjectMapper mapper = new ObjectMapper();
[47/50] [abbrv] incubator-usergrid git commit: Fixes TokenServiceIT
and bug in ManagementService counter test
Posted by sn...@apache.org.
Fixes TokenServiceIT and bug in ManagementService counter test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/31bb3f18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/31bb3f18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/31bb3f18
Branch: refs/heads/no-source-in-es
Commit: 31bb3f18d358faa30ab451cfaf97aa78823d65fe
Parents: 2175834
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 17:03:34 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 17:03:34 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 5 ++-
.../security/tokens/TokenServiceIT.java | 40 ++++++++------------
.../usergrid/services/ServiceFactoryIT.java | 4 +-
3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index ddb2bbb..6957097 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -161,9 +161,10 @@ public class ManagementServiceIT {
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
- assertNotNull( counts.get( "admin_logins" ) );
- final long startCount = counts.get( "admin_logins" );
+ final Long existingCounts = counts.get( "admin_logins" );
+
+ final long startCount = existingCounts == null ? 0 : existingCounts;
setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 49d939c..67bc035 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.security.tokens;
import java.util.HashMap;
import java.util.Map;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
@@ -27,6 +28,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -73,15 +75,13 @@ public class TokenServiceIT {
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
- @BeforeClass
- public static void setup() throws Exception {
- log.info( "in setup" );
- adminUser =
- setup.getMgmtSvc().createAdminUser( "edanuff34", "Ed Anuff", "ed@anuff34.com", "test", false, false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "TokenServiceTestOrg", adminUser, true );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
- // TODO update to organizationName/applicationName
- setup.getMgmtSvc().createApplication( organization.getUuid(), "TokenServiceTestOrg/ed-application" ).getId();
+ @Before
+ public void setup() throws Exception {
+ log.info( "in setup" );
+ adminUser = newOrgAppAdminRule.getAdminInfo();
}
@@ -91,8 +91,8 @@ public class TokenServiceIT {
Map<String, Object> data = new HashMap<String, Object>() {
{
- put( "email", "ed@anuff34.com" );
- put( "username", "edanuff34" );
+ put( "email", adminUser.getEmail());
+ put( "username", adminUser.getUsername());
}
};
@@ -106,8 +106,8 @@ public class TokenServiceIT {
long last_access = tokenInfo.getAccessed();
assertEquals( "email_confirm", tokenInfo.getType() );
- assertEquals( "ed@anuff34.com", tokenInfo.getState().get( "email" ) );
- assertEquals( "edanuff34", tokenInfo.getState().get( "username" ) );
+ assertEquals( adminUser.getEmail(), tokenInfo.getState().get( "email" ) );
+ assertEquals( adminUser.getUsername(), tokenInfo.getState().get( "username" ) );
tokenInfo = setup.getTokenSvc().getTokenInfo( tokenStr );
@@ -311,9 +311,7 @@ public class TokenServiceIT {
@Test
public void appDefaultExpiration() throws Exception {
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo", "foobar", "foobar", "foo@bar.com", "foobar" );
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
Application app = em.getApplication();
AuthPrincipalInfo userPrincipal =
@@ -328,11 +326,7 @@ public class TokenServiceIT {
@Test
public void appExpiration() throws Exception {
-
- OrganizationOwnerInfo orgInfo =
- setup.getMgmtSvc().createOwnerAndOrganization( "foo2", "foobar2", "foobar", "foo2@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
@@ -409,11 +403,7 @@ public class TokenServiceIT {
@Test
public void appExpirationInfinite() throws Exception {
-
- OrganizationOwnerInfo orgInfo = setup.getMgmtSvc().createOwnerAndOrganization( "appExpirationInfinite",
- "appExpirationInfinite", "foobar", "appExpirationInfinite@bar.com", "foobar" );
-
- ApplicationInfo appInfo = setup.getMgmtSvc().createApplication( orgInfo.getOrganization().getUuid(), "bar" );
+ ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo();
EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/31bb3f18/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
index 71152c9..e4e576f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceFactoryIT.java
@@ -26,6 +26,8 @@ import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.services.simple.SimpleService;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -40,7 +42,7 @@ public class ServiceFactoryIT extends AbstractServiceIT {
public void testPackagePrefixes() throws Exception {
logger.info( "test package prefixes" );
- UUID applicationId = setup.getEmf().createApplication( "org", "app" );
+ UUID applicationId = setup.getEmf().createApplication(uniqueOrg(), uniqueApp() );
ServiceManager sm = setup.getSmf().getServiceManager( applicationId );
Service service = sm.getService( "simple" );
assertEquals( "/simple", service.getServiceType() );
[06/50] [abbrv] incubator-usergrid git commit: fix apns
Posted by sn...@apache.org.
fix apns
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/62249154
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/62249154
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/62249154
Branch: refs/heads/two-dot-o-events
Commit: 622491547fe0ea42a7c7bbd63611c804023caa7f
Parents: 461c192
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 12:34:14 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 12:34:14 2014 -0700
----------------------------------------------------------------------
.../services/notifications/apns/NotificationsServiceIT.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62249154/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 3f42777..3b9206e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -191,8 +191,8 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
entity = results.getEntitiesMap().get(notification.getUuid());
assertNotNull(entity);
- checkReceipts(notification, 1);
- checkStatistics(notification, 1, 0);
+ checkReceipts(notification, 2);
+ checkStatistics(notification, 2, 0);
}
@Test
@@ -579,7 +579,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
app.getEntityManager().refreshIndex();
- checkReceipts(notification, 1);
+ checkReceipts(notification, 2);
}
@Ignore("todo: how can I mock this?")
[03/50] [abbrv] incubator-usergrid git commit: remove queue manager
Posted by sn...@apache.org.
remove queue manager
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/461c1928
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/461c1928
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/461c1928
Branch: refs/heads/no-source-in-es
Commit: 461c1928beae05c78646ac727f20e0afe7d6f3fb
Parents: c4973e9
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 11:03:48 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 11:03:48 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 68 ++++++++++++++++++++
.../usergrid/services/TestQueueManager.java | 65 -------------------
.../apns/NotificationsServiceIT.java | 4 +-
.../gcm/NotificationsServiceIT.java | 4 +-
4 files changed, 72 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
new file mode 100644
index 0000000..354aa7b
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
@@ -0,0 +1,68 @@
+/*
+ *
+ * * 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.persistence.queue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * Default queue manager implementation, uses in memory linked queue
+ */
+public class DefaultQueueManager implements QueueManager {
+ public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
+ @Override
+ public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
+ List<QueueMessage> returnQueue = new ArrayList<>();
+ for(int i=0;i<limit;i++){
+ if(!queue.isEmpty()){
+ returnQueue.add( queue.remove());
+ }else{
+ break;
+ }
+ }
+ return returnQueue;
+ }
+
+ @Override
+ public void commitMessage(QueueMessage queueMessage) {
+ }
+
+ @Override
+ public void commitMessages(List<QueueMessage> queueMessages) {
+ }
+
+ @Override
+ public synchronized void sendMessages(List bodies) throws IOException {
+ for(Object body : bodies){
+ String uuid = UUID.randomUUID().toString();
+ queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
+ }
+ }
+
+ @Override
+ public synchronized void sendMessage(Object body) throws IOException {
+ String uuid = UUID.randomUUID().toString();
+ queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java b/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
deleted file mode 100644
index 37fef40..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
+++ /dev/null
@@ -1,65 +0,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.services;
-
-import org.apache.usergrid.persistence.queue.QueueManager;
-import org.apache.usergrid.persistence.queue.QueueMessage;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-
-public class TestQueueManager implements QueueManager {
- public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
- @Override
- public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
- List<QueueMessage> returnQueue = new ArrayList<>();
- for(int i=0;i<limit;i++){
- if(!queue.isEmpty()){
- returnQueue.add( queue.remove());
- }else{
- break;
- }
- }
- return returnQueue;
- }
-
- @Override
- public void commitMessage(QueueMessage queueMessage) {
- }
-
- @Override
- public void commitMessages(List<QueueMessage> queueMessages) {
- }
-
- @Override
- public synchronized void sendMessages(List bodies) throws IOException {
- for(Object body : bodies){
- String uuid = UUID.randomUUID().toString();
- queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
- }
- }
-
- @Override
- public synchronized void sendMessage(Object body) throws IOException {
- String uuid = UUID.randomUUID().toString();
- queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 0a5375f..3f42777 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -21,7 +21,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.usergrid.persistence.*;
import org.apache.usergrid.persistence.entities.*;
import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.services.TestQueueManager;
+import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
import org.slf4j.Logger;
@@ -121,7 +121,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
ns = getNotificationService();
- TestQueueManager qm = new TestQueueManager();
+ DefaultQueueManager qm = new DefaultQueueManager();
ns.TEST_QUEUE_MANAGER = qm;
app.getEntityManager().refreshIndex();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 5228464..4b41d13 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -18,7 +18,7 @@ package org.apache.usergrid.services.notifications.gcm;
import org.apache.usergrid.persistence.*;
import org.apache.usergrid.persistence.entities.*;
-import org.apache.usergrid.services.TestQueueManager;
+import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
import org.slf4j.Logger;
@@ -93,7 +93,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
device2 = app.getEntityManager().get(e.getUuid(), Device.class);
ns = getNotificationService();
- TestQueueManager qm = new TestQueueManager();
+ DefaultQueueManager qm = new DefaultQueueManager();
ns.TEST_QUEUE_MANAGER = qm;
listener = new QueueListener(ns.getServiceManagerFactory(), ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
[12/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/usergrid-269' into two-dot-o
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/usergrid-269' into two-dot-o
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a63b856e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a63b856e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a63b856e
Branch: refs/heads/no-source-in-es
Commit: a63b856e90e33e4b93f35bfcaeb02552a7acc4a0
Parents: e29a99e 4bf4d71
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 8 15:17:25 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 8 15:17:25 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 68 ++++++++++++++++++++
.../usergrid/services/TestQueueManager.java | 65 -------------------
.../AbstractServiceNotificationIT.java | 16 +----
.../apns/NotificationsServiceIT.java | 12 ++--
.../gcm/NotificationsServiceIT.java | 15 +++--
5 files changed, 84 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
[09/50] [abbrv] incubator-usergrid git commit: fixed abstract class
name
Posted by sn...@apache.org.
fixed abstract class name
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4bf4d715
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4bf4d715
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4bf4d715
Branch: refs/heads/two-dot-o-events
Commit: 4bf4d715fc11877d672541e0aa04714f7f0c2a9d
Parents: e9cecff
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 15:15:00 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 15:15:00 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 4 ++--
.../AbstractServiceNotificationIT.java | 16 +---------------
.../notifications/apns/NotificationsServiceIT.java | 2 --
.../notifications/gcm/NotificationsServiceIT.java | 9 +++++++--
4 files changed, 10 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
index 354aa7b..d9fddd3 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
@@ -24,13 +24,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ArrayBlockingQueue;
/**
* Default queue manager implementation, uses in memory linked queue
*/
public class DefaultQueueManager implements QueueManager {
- public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
+ public ArrayBlockingQueue<QueueMessage> queue = new ArrayBlockingQueue<>(10000);
@Override
public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
List<QueueMessage> returnQueue = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
index 1fd6f3e..55bb91f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
@@ -39,28 +39,14 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-public class AbstractServiceNotificationIT extends AbstractServiceIT {
+public abstract class AbstractServiceNotificationIT extends AbstractServiceIT {
private NotificationsService ns;
- @Rule
- public TestName name = new TestName();
-
- @BeforeClass
- public static void beforeClass() {
- }
-
- @Before
- public void before() throws Exception {
-
- }
-
protected NotificationsService getNotificationService(){
ns = (NotificationsService) app.getSm().getService("notifications");
return ns;
}
-
-
protected Notification scheduleNotificationAndWait(Notification notification)
throws Exception {
long timeout = System.currentTimeMillis() + 60000;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 3b9206e..5fda74b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -68,11 +68,9 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
}
- @Override
@Before
public void before() throws Exception {
- super.before();
// create apns notifier //
app.clear();
app.put("name", notifierName);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index ce0dca7..8d6fb70 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -21,6 +21,7 @@ import org.apache.usergrid.persistence.entities.*;
import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
+import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +35,7 @@ import static org.apache.usergrid.services.notifications.ApplicationQueueManager
public class NotificationsServiceIT extends AbstractServiceNotificationIT {
+
private static final Logger logger = LoggerFactory
.getLogger(NotificationsServiceIT.class);
@@ -54,15 +56,18 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
private NotificationsService ns;
private QueueListener listener;
+
+
+
+
@BeforeClass
public static void setup(){
+
}
- @Override
@Before
public void before() throws Exception {
- super.before();
// create gcm notifier //
[19/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/1d2697fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/1d2697fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/1d2697fc
Branch: refs/heads/no-source-in-es
Commit: 1d2697fc967680aa092b42705ffdc688e3579dae
Parents: b545c0e
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 09:50:45 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 09:50:45 2014 -0700
----------------------------------------------------------------------
.../persistence/index/impl/EsIndexCache.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d2697fc/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
index 710cc60..f418590 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -40,7 +40,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
/**
- * Classy class class.
+ * Cache for Es index operations
*/
@Singleton
public class EsIndexCache {
@@ -66,11 +66,15 @@ public class EsIndexCache {
ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
return aliasMap.keys().toArray(String.class);
}
- })
-
- ;
+ }) ;
}
+ /**
+ * Get indexes for an alias
+ * @param alias
+ * @param aliasType
+ * @return
+ */
public String[] getIndexes(IndexIdentifier.IndexAlias alias, AliasedEntityIndex.AliasType aliasType) {
String[] indexes;
try {
@@ -82,6 +86,10 @@ public class EsIndexCache {
return indexes;
}
+ /**
+ * clean up cache
+ * @param alias
+ */
public void invalidate(IndexIdentifier.IndexAlias alias){
aliasIndexCache.invalidate(alias.getWriteAlias());
aliasIndexCache.invalidate(alias.getReadAlias());
[34/50] [abbrv] incubator-usergrid git commit: Updated maven config
Posted by sn...@apache.org.
Updated maven config
Remove suite classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5baf6cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5baf6cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5baf6cd8
Branch: refs/heads/no-source-in-es
Commit: 5baf6cd87174d3303cc5b9a935dc19bc009f7de0
Parents: bc93f69
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 12:04:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 12:04:48 2014 -0700
----------------------------------------------------------------------
stack/services/pom.xml | 268 ++++---------------
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 15 +-
.../usergrid/management/OrganizationIT.java | 13 +-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 12 +-
.../management/cassandra/ExportServiceIT.java | 10 +-
.../cassandra/ManagementServiceIT.java | 11 +-
.../security/providers/FacebookProviderIT.java | 14 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 15 +-
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
14 files changed, 150 insertions(+), 383 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index 0537613..dd94eb7 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -46,199 +46,7 @@
</plugins>
</reporting>
- <profiles>
- <profile>
- <id>unit</id>
- <activation>
- <property>
- <name>unit</name>
- <value>true</value>
- </property>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <!-- TODO: make this into a small configuration but based on settings.xml -->
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
-
- <includes>
- <include>**/ServiceTestSuite.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*ITSuite.java</exclude>
- <!-- TODO - add these suites too -->
- <!-- <exclude>**/*Test.java</exclude> -->
- <exclude>**/ConcurrentService*Suite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
-
- <parallel>${services.it.parallel}</parallel>
- <threadCount>${services.it.threadCount}</threadCount>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/*IT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*Concurrent*Suite.java</exclude>
- <exclude>**/ExportServiceIT.java</exclude>
- <exclude>**/ActivitiesServiceIT.java</exclude>
- <exclude>**/ApplicationCreatorIT.java</exclude>
- <exclude>**/ApplicationsServiceIT.java</exclude>
- <exclude>**/CollectionServiceIT.java</exclude>
- <exclude>**/ConnectionsServiceIT.java</exclude>
- <exclude>**/ManagementServiceIT.java</exclude>
- <exclude>**/EmailFlowIT.java</exclude>
- <exclude>**/FacebookProviderIT.java</exclude>
- <exclude>**/GroupServiceIT.java</exclude>
- <exclude>**/OrganizationIT.java</exclude>
- <exclude>**/PingIdentityProviderIT.java</exclude>
- <exclude>**/RoleIT.java</exclude>
- <exclude>**/RolesServiceIT.java</exclude>
- <exclude>**/ServiceRequestIT.java</exclude>
- <exclude>**/ServiceFactoryIT.java</exclude>
- <exclude>**/ServiceInvocationIT.java</exclude>
- <exclude>**/UsersServiceIT.class</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>unit-concurrent</id>
- <activation>
- <property>
- <name>unit-concurrent</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <accessKey>${aws.s3.key}</accessKey>
- <secretKey>${aws.s3.secret}</secretKey>
- <bucketName>${aws.s3.bucket}</bucketName>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceTestSuite.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- <exclude>**/ConcurrentServiceITSuite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
-
- <profile>
- <id>integ-concurrent</id>
- <activation>
- <property>
- <name>integ-concurrent</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceITSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
<!-- PROFILES -->
@@ -270,38 +78,52 @@
<directory>src/main/python</directory>
</testResource>
</testResources>
+
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
-
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
-
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <!-- <exclude>**/*Test.java</exclude> -->
- <exclude>**/*Concurrent*Suite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <storage-config>${basedir}/src/test/conf</storage-config>
+ <target.directory>${project.build.directory}</target.directory>
+ </systemPropertyVariables>
+ <parallel>classes</parallel>
+ <forkCount>${services.it.forkCount}</forkCount>
+ <reuseForks>${services.it.reuseForks}</reuseForks>
+ <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
+ <includes>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+
+ <!-- exclude our serial tests -->
+ <excludes>
+ <exclude>**/*Scheduler*IT.java</exclude>
+ <exclude>**/*Notification*IT.java</exclude>
+ </excludes>
+ </configuration>
+
+ <!-- Serial execution -->
+ <executions>
+ <execution>
+ <id>single-thread-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*Scheduler*IT.java</include>
+ <include>**/*Notification*IT.java</include>
+ </includes>
+ <threadCount>1</threadCount>
+ </configuration>
+ </execution>
+ </executions>
+
+ <version>2.15</version>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
deleted file mode 100644
index 2db2c48..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
+++ /dev/null
@@ -1,60 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.security.tokens.TokenServiceIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ManagementServiceIT.class, ExportServiceIT.class ,EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RolesServiceIT.class, RoleIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, TokenServiceIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ConcurrentServiceITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
deleted file mode 100644
index 5edc4579..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
+++ /dev/null
@@ -1,64 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ExportServiceIT.class,
- ManagementServiceIT.class, EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RoleIT.class, RolesServiceIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ServiceITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 1d5ff7b..719fd86 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -48,14 +48,9 @@ import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
-import org.apache.usergrid.ServiceITSuite;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -95,13 +90,17 @@ public class EmailFlowIT {
private static final String ORGANIZATION_NAME = "email-test-org-1";
public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
- static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public TestName name = new TestName();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 02db523..92bb448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -25,13 +25,15 @@ import java.util.UUID;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import static org.junit.Assert.assertEquals;
@@ -47,7 +49,14 @@ public class OrganizationIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
index 9c1c0b7..b88ab24 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
@@ -31,11 +31,12 @@ import org.apache.shiro.subject.Subject;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
import org.apache.usergrid.security.shiro.utils.SubjectUtils;
@@ -46,11 +47,18 @@ import static org.junit.Assert.assertFalse;
public class RoleIT {
private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index b1a7d19..6b3bb0b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -19,18 +19,20 @@ package org.apache.usergrid.management.cassandra;
import java.util.Set;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -42,13 +44,17 @@ import static org.junit.Assert.assertTrue;
public class ApplicationCreatorIT {
private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
- private CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index f0c89d6..a5b499b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.batch.JobExecution;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
@@ -61,6 +60,7 @@ import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.JobData;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
@@ -82,7 +82,11 @@ public class ExportServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -93,7 +97,7 @@ public class ExportServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 6eb2865..4288d99 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
@@ -43,6 +42,7 @@ import org.apache.usergrid.persistence.CredentialsInfo;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalType;
import org.apache.usergrid.security.crypto.command.Md5HashCommand;
import org.apache.usergrid.security.crypto.command.Sha1HashCommand;
@@ -52,7 +52,6 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -67,7 +66,11 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -78,7 +81,7 @@ public class ManagementServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index 3ca4df5..c78e348 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static org.junit.Assert.assertEquals;
@@ -47,16 +49,22 @@ public class FacebookProviderIT {
private static SignInProviderFactory providerFactory;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
public static void setup() throws Exception {
- providerFactory = ServiceITSuite.cassandraResource.getBean( SignInProviderFactory.class );
+ providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
.createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
false );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
index ed03fb2..9fd9821 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static junit.framework.Assert.assertNotNull;
@@ -47,11 +49,17 @@ public class PingIdentityProviderIT {
private static OrganizationInfo organization;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 4e2a80c..49d939c 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -26,9 +26,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
@@ -37,10 +38,10 @@ import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.Application;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import org.apache.usergrid.security.AuthPrincipalType;
-import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl
- ;
+import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl;
import org.apache.usergrid.security.tokens.exceptions.ExpiredTokenException;
import org.apache.usergrid.security.tokens.exceptions.InvalidTokenException;
import org.apache.usergrid.utils.UUIDUtils;
@@ -63,7 +64,13 @@ public class TokenServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
index 30806ff..50262e9 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
@@ -17,13 +17,16 @@
package org.apache.usergrid.services;
+import org.junit.ClassRule;
import org.junit.Rule;
+
import org.apache.usergrid.ServiceApplication;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
@Concurrent()
@@ -31,8 +34,14 @@ public abstract class AbstractServiceIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ServiceApplication app = new ServiceApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
index 4ec0d43..5ff7c61 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
@@ -23,16 +23,18 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.usergrid.services.ServiceParameter.filter;
import static org.apache.usergrid.services.ServiceParameter.parameters;
@@ -43,11 +45,17 @@ public class ServiceRequestIT {
private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
[29/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/two-dot-o' into USERGRID-252
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/43ed8464
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/43ed8464
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/43ed8464
Branch: refs/heads/no-source-in-es
Commit: 43ed8464f81316619f3985a43fb61d2a0aa1c78a
Parents: 5d4ce72 04679c8
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 17:31:33 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 17:31:33 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManagerFactory.java | 4 +-
.../persistence/index/AliasedEntityIndex.java | 48 ++++++++
.../usergrid/persistence/index/EntityIndex.java | 5 -
.../usergrid/persistence/index/IndexFig.java | 3 +
.../index/impl/EsEntityIndexBatchImpl.java | 38 +++++--
.../index/impl/EsEntityIndexImpl.java | 44 ++++---
.../persistence/index/impl/EsIndexCache.java | 114 +++++++++++++++++++
.../persistence/index/impl/EntityIndexTest.java | 61 +++++++---
8 files changed, 273 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
[07/50] [abbrv] incubator-usergrid git commit: fix gcm
Posted by sn...@apache.org.
fix gcm
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e9cecff1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e9cecff1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e9cecff1
Branch: refs/heads/two-dot-o-events
Commit: e9cecff1d0df14691c021fb682a9f84bdb3382ed
Parents: 6224915
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 12:36:24 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 12:36:24 2014 -0700
----------------------------------------------------------------------
.../services/notifications/gcm/NotificationsServiceIT.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e9cecff1/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 4b41d13..ce0dca7 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -163,7 +163,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
// perform push //
notification = scheduleNotificationAndWait(notification);
- checkReceipts(notification, 1);
+ checkReceipts(notification, 2);
}
@Test
[31/50] [abbrv] incubator-usergrid git commit: Finished first pass in
core
Posted by sn...@apache.org.
Finished first pass in core
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bc93f693
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bc93f693
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bc93f693
Branch: refs/heads/two-dot-o-events
Commit: bc93f693a7a85c89dc59304fba825209e385ebfc
Parents: 43ed846
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 11:40:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 11:40:45 2014 -0700
----------------------------------------------------------------------
stack/core/pom.xml | 15 +---
.../org/apache/usergrid/AbstractCoreIT.java | 12 ++-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ------------
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 --------------------
.../usergrid/ConcurrentCoreTestSuite.java | 46 -----------
.../java/org/apache/usergrid/CoreITSuite.java | 58 --------------
.../java/org/apache/usergrid/CoreTestSuite.java | 45 -----------
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ------------
.../usergrid/batch/SchedulerTestSuite.java | 34 --------
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +++--
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 ++---
.../cassandra/EntityManagerFactoryImplIT.java | 21 +++--
.../query/AbstractIteratingQueryIT.java | 15 +++-
.../system/UsergridSystemMonitorIT.java | 14 +++-
15 files changed, 76 insertions(+), 413 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 61ce099..e5cdae5 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -183,19 +183,10 @@
<argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
<includes>
- <include>**/*ConcurrentCoreITSuite.java</include>
- <include>**/SchedulerTestSuite.java</include>
- <include>**/SchedulerRuntime*IT.java</include>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
</includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/CoreITSuite.java</exclude>
- <exclude>**/CoreTestSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerITSuite.java</exclude>
- <exclude>**/ConcurrentSchedulerTestSuite.java</exclude>
- <exclude>**/*Test.java</exclude>
- </excludes>
+
</configuration>
<version>2.15</version>
</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
index f58e426..da80714 100644
--- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
@@ -21,6 +21,9 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.JsonUtils;
@@ -29,7 +32,14 @@ public abstract class AbstractCoreIT {
private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class );
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl( CoreITSuite.cassandraResource, CoreITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
deleted file mode 100644
index d981ee9..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreITSuite.java
+++ /dev/null
@@ -1,51 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- // HectorLockManagerIT.class,
- UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class, EntityConnectionsIT.class,
- EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class, MessagesIT.class,
- PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class ConcurrentCoreITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
deleted file mode 100644
index 1312950..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreIteratorITSuite.java
+++ /dev/null
@@ -1,83 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.persistence.query.AllInCollectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionIT;
-import org.apache.usergrid.persistence.query.AllInConnectionNoTypeIT;
-import org.apache.usergrid.persistence.query.MultiOrderByCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.MultiOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanAscConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByBoundRangeScanDescConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByComplexUnionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByLessThanLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByMaxLimitConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNoIntersectionConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderByNotConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanGreaterThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessConnectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualCollectionIT;
-import org.apache.usergrid.persistence.query.SingleOrderBySameRangeScanLessThanEqualConnectionIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- AllInCollectionIT.class, AllInConnectionIT.class, AllInConnectionNoTypeIT.class, MultiOrderByCollectionIT.class,
- MultiOrderByComplexUnionCollectionIT.class, MultiOrderByComplexUnionConnectionIT.class,
- SingleOrderByBoundRangeScanAscCollectionIT.class, SingleOrderByBoundRangeScanAscConnectionIT.class,
- SingleOrderByBoundRangeScanDescCollectionIT.class, SingleOrderByBoundRangeScanDescConnectionIT.class,
- SingleOrderByComplexIntersectionCollectionIT.class, SingleOrderByComplexIntersectionConnectionIT.class,
- SingleOrderByComplexUnionCollectionIT.class, SingleOrderByComplexUnionConnectionIT.class,
- SingleOrderByLessThanLimitCollectionIT.class, SingleOrderByLessThanLimitConnectionIT.class,
- SingleOrderByMaxLimitCollectionIT.class, SingleOrderByMaxLimitConnectionIT.class,
- SingleOrderByNoIntersectionCollectionIT.class, SingleOrderByNoIntersectionConnectionIT.class,
- SingleOrderByNotCollectionIT.class, SingleOrderByNotConnectionIT.class,
- SingleOrderBySameRangeScanGreaterCollectionIT.class, SingleOrderBySameRangeScanGreaterConnectionIT.class,
- SingleOrderBySameRangeScanGreaterThanEqualCollectionIT.class, SingleOrderBySameRangeScanLessCollectionIT.class,
- SingleOrderBySameRangeScanLessConnectionIT.class, SingleOrderBySameRangeScanLessThanEqualCollectionIT.class,
- SingleOrderBySameRangeScanLessThanEqualConnectionIT.class
-})
-@Concurrent(threads = 1)
-public class ConcurrentCoreIteratorITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
deleted file mode 100644
index 56c7871..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/ConcurrentCoreTestSuite.java
+++ /dev/null
@@ -1,46 +0,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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class ConcurrentCoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
deleted file mode 100644
index ff06a80..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSuite.java
+++ /dev/null
@@ -1,58 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.cassandra.HectorLockManagerIT;
-import org.apache.usergrid.mq.MessagesIT;
-import org.apache.usergrid.persistence.CollectionIT;
-import org.apache.usergrid.persistence.CounterIT;
-import org.apache.usergrid.persistence.EntityConnectionsIT;
-import org.apache.usergrid.persistence.EntityDictionaryIT;
-import org.apache.usergrid.persistence.EntityManagerIT;
-import org.apache.usergrid.persistence.GeoIT;
-import org.apache.usergrid.persistence.IndexIT;
-import org.apache.usergrid.persistence.PathQueryIT;
-import org.apache.usergrid.persistence.PermissionsIT;
-import org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImplIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.system.UsergridSystemMonitorIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- HectorLockManagerIT.class, UsergridSystemMonitorIT.class, CollectionIT.class, CounterIT.class,
- EntityConnectionsIT.class, EntityDictionaryIT.class, EntityManagerIT.class, GeoIT.class, IndexIT.class,
- MessagesIT.class, PermissionsIT.class, PathQueryIT.class, EntityManagerFactoryImplIT.class
-})
-@Concurrent()
-public class CoreITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
deleted file mode 100644
index 314b4e5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/CoreTestSuite.java
+++ /dev/null
@@ -1,45 +0,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;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.locking.zookeeper.ZookeeperLockManagerTest;
-import org.apache.usergrid.mq.QueuePathsTest;
-import org.apache.usergrid.persistence.EntityTest;
-import org.apache.usergrid.persistence.QueryTest;
-import org.apache.usergrid.persistence.QueryUtilsTest;
-import org.apache.usergrid.persistence.SchemaTest;
-import org.apache.usergrid.persistence.UtilsTest;
-import org.apache.usergrid.persistence.cassandra.QueryProcessorTest;
-import org.apache.usergrid.persistence.cassandra.SimpleIndexShardLocatorImplTest;
-import org.apache.usergrid.persistence.query.ir.result.IntersectionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.SubtractionIteratorTest;
-import org.apache.usergrid.persistence.query.ir.result.UnionIteratorTest;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ZookeeperLockManagerTest.class, QueuePathsTest.class, QueryProcessorTest.class,
- SimpleIndexShardLocatorImplTest.class, EntityTest.class, QueryTest.class, QueryUtilsTest.class,
- SchemaTest.class, UtilsTest.class, IntersectionIteratorTest.class, SubtractionIteratorTest.class,
- UnionIteratorTest.class
-})
-@Concurrent()
-public class CoreTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
deleted file mode 100644
index f8c9f87..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerITSuite.java
+++ /dev/null
@@ -1,50 +0,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.batch;
-
-
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.job.SchedulerRuntime1IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime2IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime3IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime4IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime5IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime6IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime7IT;
-import org.apache.usergrid.batch.job.SchedulerRuntime8IT;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- SchedulerRuntime1IT.class, SchedulerRuntime2IT.class, SchedulerRuntime3IT.class,
- SchedulerRuntime4IT.class, SchedulerRuntime5IT.class, SchedulerRuntime6IT.class,
- SchedulerRuntime7IT.class, SchedulerRuntime8IT.class
- })
-@Concurrent()
-@Ignore("TODO: Todd fix. Does not reliably pass on our build server.")
-// TODO - this suite actually runs correctly now so we can
-// remove this ignore if Todd is OK with it.
-public class SchedulerITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
deleted file mode 100644
index 7e62dd5..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/SchedulerTestSuite.java
+++ /dev/null
@@ -1,34 +0,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.batch;
-
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.batch.AppArgsTest;
-import org.apache.usergrid.batch.BulkJobExecutionUnitTest;
-import org.apache.usergrid.batch.UsergridJobFactoryTest;
-import org.apache.usergrid.cassandra.Concurrent;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class,
- })
-@Concurrent()
-public class SchedulerTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
index f939d0d..1d87b73 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -17,20 +17,20 @@
package org.apache.usergrid.batch.job;
-import com.google.common.util.concurrent.Service.State;
import java.util.Properties;
-import org.apache.usergrid.batch.SchedulerITSuite;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+
import org.apache.usergrid.batch.service.JobSchedulerService;
import org.apache.usergrid.batch.service.SchedulerService;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.SchemaManager;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Ignore;
+import com.google.common.util.concurrent.Service.State;
/**
@@ -44,8 +44,10 @@ public class AbstractSchedulerRuntimeIT {
protected static final String RUNLOOP_PROP = "usergrid.scheduler.job.interval";
protected static final String FAIL_PROP = "usergrid.scheduler.job.maxfail";
+
@ClassRule
- public static CassandraResource cassandraResource = SchedulerITSuite.cassandraResource;
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
index e360244..8a596a5 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java
@@ -22,15 +22,15 @@ import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.count.SimpleBatcher;
import org.apache.usergrid.persistence.entities.Event;
@@ -61,7 +61,7 @@ public class CounterIT extends AbstractCoreIT {
@Before
public void getSubmitter() {
//set the batcher to block the submit so we wait for results when testing
- SimpleBatcher batcher = CoreITSuite.cassandraResource.getBean( SimpleBatcher.class );
+ SimpleBatcher batcher = cassandraResource.getBean( SimpleBatcher.class );
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
index e839fa1..dc6593b 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/IndexIT.java
@@ -21,13 +21,14 @@ import java.nio.ByteBuffer;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
-import me.prettyprint.hector.api.Keyspace;
-import static me.prettyprint.hector.api.factory.HFactory.createMutator;
-import me.prettyprint.hector.api.mutation.Mutator;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.cassandra.CassandraService;
import org.apache.usergrid.persistence.cassandra.IndexUpdate;
@@ -37,12 +38,14 @@ import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
+import me.prettyprint.cassandra.serializers.ByteBufferSerializer;
+import me.prettyprint.hector.api.Keyspace;
+import me.prettyprint.hector.api.mutation.Mutator;
+
+import static me.prettyprint.hector.api.factory.HFactory.createMutator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Concurrent()
@@ -445,7 +448,7 @@ public class IndexIT extends AbstractCoreIT {
RelationManagerImpl impl = (RelationManagerImpl)rm;
- CassandraService cass = CoreITSuite.cassandraResource.getBean( CassandraService.class );
+ CassandraService cass = cassandraResource.getBean( CassandraService.class );
ByteBufferSerializer buf = ByteBufferSerializer.get();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
index 4cc0dbd..4edd121 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java
@@ -22,16 +22,19 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.apache.commons.lang3.RandomStringUtils;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.ClassRule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.commons.lang3.RandomStringUtils;
+
import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.CoreITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
@@ -41,6 +44,7 @@ import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.cassandra.util.TraceTag;
import org.apache.usergrid.persistence.cassandra.util.TraceTagManager;
import org.apache.usergrid.persistence.cassandra.util.TraceTagReporter;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -57,8 +61,15 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
private static final Logger logger = LoggerFactory.getLogger( EntityManagerFactoryImplIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
public EntityManagerFactoryImplIT() {
- emf = CoreITSuite.cassandraResource.getBean( EntityManagerFactory.class );
+ emf = cassandraResource.getBean( EntityManagerFactory.class );
}
@@ -89,9 +100,9 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
@Before
public void initTracing() {
- traceTagManager = CoreITSuite.cassandraResource.getBean(
+ traceTagManager = cassandraResource.getBean(
"traceTagManager", TraceTagManager.class );
- traceTagReporter = CoreITSuite.cassandraResource.getBean(
+ traceTagReporter = cassandraResource.getBean(
"traceTagReporter", TraceTagReporter.class );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
index d8f31ff..ff47846 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/AbstractIteratingQueryIT.java
@@ -30,11 +30,12 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.ConcurrentCoreIteratorITSuite;
import org.apache.usergrid.CoreApplication;
import org.apache.usergrid.CoreITSetup;
import org.apache.usergrid.CoreITSetupImpl;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.persistence.Entity;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.persistence.Results;
@@ -48,10 +49,16 @@ public abstract class AbstractIteratingQueryIT {
public static final long WRITE_DELAY = 0; // milliseconds to delay between writes in loop
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@ClassRule
- public static CoreITSetup setup = new CoreITSetupImpl(
- ConcurrentCoreIteratorITSuite.cassandraResource,
- ConcurrentCoreIteratorITSuite.elasticSearchResource );
+ public static CoreITSetup setup = new CoreITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public CoreApplication app = new CoreApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bc93f693/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
index 7456106..a9f9e18 100644
--- a/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/system/UsergridSystemMonitorIT.java
@@ -20,13 +20,15 @@ package org.apache.usergrid.system;
import java.util.Date;
import org.junit.Before;
+import org.junit.ClassRule;
import org.junit.Test;
-import org.apache.usergrid.CoreITSuite;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.utils.MapUtils;
import org.apache.commons.lang.StringUtils;
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.utils.MapUtils;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,12 +36,16 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent
public class UsergridSystemMonitorIT {
+
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
private UsergridSystemMonitor usergridSystemMonitor;
@Before
public void setupLocal() {
- usergridSystemMonitor = CoreITSuite.cassandraResource.getBean( UsergridSystemMonitor.class );
+ usergridSystemMonitor = cassandraResource.getBean( UsergridSystemMonitor.class );
}
[33/50] [abbrv] incubator-usergrid git commit: Updated maven config
Posted by sn...@apache.org.
Updated maven config
Remove suite classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5baf6cd8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5baf6cd8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5baf6cd8
Branch: refs/heads/two-dot-o-events
Commit: 5baf6cd87174d3303cc5b9a935dc19bc009f7de0
Parents: bc93f69
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 12:04:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 12:04:48 2014 -0700
----------------------------------------------------------------------
stack/services/pom.xml | 268 ++++---------------
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 15 +-
.../usergrid/management/OrganizationIT.java | 13 +-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 12 +-
.../management/cassandra/ExportServiceIT.java | 10 +-
.../cassandra/ManagementServiceIT.java | 11 +-
.../security/providers/FacebookProviderIT.java | 14 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 15 +-
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
14 files changed, 150 insertions(+), 383 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/pom.xml
----------------------------------------------------------------------
diff --git a/stack/services/pom.xml b/stack/services/pom.xml
index 0537613..dd94eb7 100644
--- a/stack/services/pom.xml
+++ b/stack/services/pom.xml
@@ -46,199 +46,7 @@
</plugins>
</reporting>
- <profiles>
- <profile>
- <id>unit</id>
- <activation>
- <property>
- <name>unit</name>
- <value>true</value>
- </property>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <!-- TODO: make this into a small configuration but based on settings.xml -->
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
-
- <includes>
- <include>**/ServiceTestSuite.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*ITSuite.java</exclude>
- <!-- TODO - add these suites too -->
- <!-- <exclude>**/*Test.java</exclude> -->
- <exclude>**/ConcurrentService*Suite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
-
- <parallel>${services.it.parallel}</parallel>
- <threadCount>${services.it.threadCount}</threadCount>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/*IT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <exclude>**/*Concurrent*Suite.java</exclude>
- <exclude>**/ExportServiceIT.java</exclude>
- <exclude>**/ActivitiesServiceIT.java</exclude>
- <exclude>**/ApplicationCreatorIT.java</exclude>
- <exclude>**/ApplicationsServiceIT.java</exclude>
- <exclude>**/CollectionServiceIT.java</exclude>
- <exclude>**/ConnectionsServiceIT.java</exclude>
- <exclude>**/ManagementServiceIT.java</exclude>
- <exclude>**/EmailFlowIT.java</exclude>
- <exclude>**/FacebookProviderIT.java</exclude>
- <exclude>**/GroupServiceIT.java</exclude>
- <exclude>**/OrganizationIT.java</exclude>
- <exclude>**/PingIdentityProviderIT.java</exclude>
- <exclude>**/RoleIT.java</exclude>
- <exclude>**/RolesServiceIT.java</exclude>
- <exclude>**/ServiceRequestIT.java</exclude>
- <exclude>**/ServiceFactoryIT.java</exclude>
- <exclude>**/ServiceInvocationIT.java</exclude>
- <exclude>**/UsersServiceIT.class</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>unit-concurrent</id>
- <activation>
- <property>
- <name>unit-concurrent</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <accessKey>${aws.s3.key}</accessKey>
- <secretKey>${aws.s3.secret}</secretKey>
- <bucketName>${aws.s3.bucket}</bucketName>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceTestSuite.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- <exclude>**/ConcurrentServiceITSuite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
-
- <profile>
- <id>integ-concurrent</id>
- <activation>
- <property>
- <name>integ-concurrent</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar -->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ConcurrentServiceITSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- </includes>
- <excludes>
- <exclude>**/*IT.java</exclude>
- <exclude>**/*Test.java</exclude>
- <exclude>**/ServiceITSuite.java</exclude>
- <exclude>**/ServiceTestSuite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
<!-- PROFILES -->
@@ -270,38 +78,52 @@
<directory>src/main/python</directory>
</testResource>
</testResources>
+
<plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
-
- <parallel>${services.it.parallel}</parallel>
- <forkCount>${services.it.forkCount}</forkCount>
- <reuseForks>${services.it.reuseForks}</reuseForks>
-
- <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 ${ug.argline}</argLine>
- <argLine>
- <!-- -javaagent:${settings.localRepository}/org/powermock/powermock-module-javaagent/1.5.1/powermock-module-javaagent-1.5.1.jar-->
- -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
- </argLine>
-
- <includes>
- <include>**/ServiceITSuite.java</include>
- <include>**/ServiceTestSuite.java</include>
- <include>**/TokenServiceIT.java</include>
- <include>**/*Test.java</include>
- </includes>
- <excludes>
- <!-- <exclude>**/*Test.java</exclude> -->
- <exclude>**/*Concurrent*Suite.java</exclude>
- </excludes>
- </configuration>
- </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <storage-config>${basedir}/src/test/conf</storage-config>
+ <target.directory>${project.build.directory}</target.directory>
+ </systemPropertyVariables>
+ <parallel>classes</parallel>
+ <forkCount>${services.it.forkCount}</forkCount>
+ <reuseForks>${services.it.reuseForks}</reuseForks>
+ <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
+ <includes>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+
+ <!-- exclude our serial tests -->
+ <excludes>
+ <exclude>**/*Scheduler*IT.java</exclude>
+ <exclude>**/*Notification*IT.java</exclude>
+ </excludes>
+ </configuration>
+
+ <!-- Serial execution -->
+ <executions>
+ <execution>
+ <id>single-thread-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*Scheduler*IT.java</include>
+ <include>**/*Notification*IT.java</include>
+ </includes>
+ <threadCount>1</threadCount>
+ </configuration>
+ </execution>
+ </executions>
+
+ <version>2.15</version>
+ </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
deleted file mode 100644
index 2db2c48..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ConcurrentServiceITSuite.java
+++ /dev/null
@@ -1,60 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.cassandra.ConcurrentSuite;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.security.tokens.TokenServiceIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ManagementServiceIT.class, ExportServiceIT.class ,EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RolesServiceIT.class, RoleIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, TokenServiceIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ConcurrentServiceITSuite {
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java b/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
deleted file mode 100644
index 5edc4579..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/ServiceITSuite.java
+++ /dev/null
@@ -1,64 +0,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;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.apache.usergrid.cassandra.CassandraResource;
-import org.apache.usergrid.cassandra.Concurrent;
-import org.apache.usergrid.management.EmailFlowIT;
-import org.apache.usergrid.management.OrganizationIT;
-import org.apache.usergrid.management.RoleIT;
-import org.apache.usergrid.management.cassandra.ApplicationCreatorIT;
-import org.apache.usergrid.management.cassandra.ExportServiceIT;
-import org.apache.usergrid.management.cassandra.ManagementServiceIT;
-import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import org.apache.usergrid.security.providers.FacebookProviderIT;
-import org.apache.usergrid.security.providers.PingIdentityProviderIT;
-import org.apache.usergrid.services.ActivitiesServiceIT;
-import org.apache.usergrid.services.ApplicationsServiceIT;
-import org.apache.usergrid.services.CollectionServiceIT;
-import org.apache.usergrid.services.ConnectionsServiceIT;
-import org.apache.usergrid.services.GroupServiceIT;
-import org.apache.usergrid.services.RolesServiceIT;
-import org.apache.usergrid.services.ServiceFactoryIT;
-import org.apache.usergrid.services.ServiceInvocationIT;
-import org.apache.usergrid.services.ServiceRequestIT;
-import org.apache.usergrid.services.UsersServiceIT;
-
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses(
- {
- ActivitiesServiceIT.class, ApplicationCreatorIT.class, ApplicationsServiceIT.class,
- CollectionServiceIT.class, ConnectionsServiceIT.class, ExportServiceIT.class,
- ManagementServiceIT.class, EmailFlowIT.class,
- FacebookProviderIT.class, GroupServiceIT.class, OrganizationIT.class, PingIdentityProviderIT.class,
- RoleIT.class, RolesServiceIT.class, ServiceRequestIT.class, ServiceFactoryIT.class,
- ServiceInvocationIT.class, UsersServiceIT.class
- })
-@Concurrent()
-public class ServiceITSuite {
-
- @ClassRule
- public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
-
- @ClassRule
- public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 1d5ff7b..719fd86 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -48,14 +48,9 @@ import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
-import org.apache.usergrid.ServiceITSuite;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -95,13 +90,17 @@ public class EmailFlowIT {
private static final String ORGANIZATION_NAME = "email-test-org-1";
public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
- static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public TestName name = new TestName();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 02db523..92bb448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -25,13 +25,15 @@ import java.util.UUID;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.cassandra.ManagementServiceImpl;
import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import static org.junit.Assert.assertEquals;
@@ -47,7 +49,14 @@ public class OrganizationIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
index 9c1c0b7..b88ab24 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/RoleIT.java
@@ -31,11 +31,12 @@ import org.apache.shiro.subject.Subject;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
import org.apache.usergrid.security.shiro.utils.SubjectUtils;
@@ -46,11 +47,18 @@ import static org.junit.Assert.assertFalse;
public class RoleIT {
private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index b1a7d19..6b3bb0b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -19,18 +19,20 @@ package org.apache.usergrid.management.cassandra;
import java.util.Set;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -42,13 +44,17 @@ import static org.junit.Assert.assertTrue;
public class ApplicationCreatorIT {
private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
- private CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index f0c89d6..a5b499b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.batch.JobExecution;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
@@ -61,6 +60,7 @@ import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.SimpleEntityRef;
import org.apache.usergrid.persistence.entities.JobData;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
@@ -82,7 +82,11 @@ public class ExportServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -93,7 +97,7 @@ public class ExportServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 6eb2865..4288d99 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
@@ -43,6 +42,7 @@ import org.apache.usergrid.persistence.CredentialsInfo;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalType;
import org.apache.usergrid.security.crypto.command.Md5HashCommand;
import org.apache.usergrid.security.crypto.command.Sha1HashCommand;
@@ -52,7 +52,6 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -67,7 +66,11 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
- private static CassandraResource cassandraResource = ServiceITSuite.cassandraResource;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
// app-level data generated only once
private static UserInfo adminUser;
@@ -78,7 +81,7 @@ public class ManagementServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index 3ca4df5..c78e348 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static org.junit.Assert.assertEquals;
@@ -47,16 +49,22 @@ public class FacebookProviderIT {
private static SignInProviderFactory providerFactory;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
public static void setup() throws Exception {
- providerFactory = ServiceITSuite.cassandraResource.getBean( SignInProviderFactory.class );
+ providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
.createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
false );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
index ed03fb2..9fd9821 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/PingIdentityProviderIT.java
@@ -25,15 +25,17 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.entities.Application;
import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
import static junit.framework.Assert.assertNotNull;
@@ -47,11 +49,17 @@ public class PingIdentityProviderIT {
private static OrganizationInfo organization;
private static UUID applicationId;
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
index 4e2a80c..49d939c 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/tokens/TokenServiceIT.java
@@ -26,9 +26,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.management.ApplicationInfo;
@@ -37,10 +38,10 @@ import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.entities.Application;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
import org.apache.usergrid.security.AuthPrincipalType;
-import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl
- ;
+import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl;
import org.apache.usergrid.security.tokens.exceptions.ExpiredTokenException;
import org.apache.usergrid.security.tokens.exceptions.InvalidTokenException;
import org.apache.usergrid.utils.UUIDUtils;
@@ -63,7 +64,13 @@ public class TokenServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+ @ClassRule
+ public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@BeforeClass
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
index 30806ff..50262e9 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/AbstractServiceIT.java
@@ -17,13 +17,16 @@
package org.apache.usergrid.services;
+import org.junit.ClassRule;
import org.junit.Rule;
+
import org.apache.usergrid.ServiceApplication;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
@Concurrent()
@@ -31,8 +34,14 @@ public abstract class AbstractServiceIT {
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ServiceApplication app = new ServiceApplication( setup );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5baf6cd8/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
index 4ec0d43..5ff7c61 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/ServiceRequestIT.java
@@ -23,16 +23,18 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
-import org.apache.usergrid.ServiceITSuite;
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.ClearShiroSubject;
import org.apache.usergrid.cassandra.Concurrent;
-import static org.apache.usergrid.management.EmailFlowIT.setup;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.usergrid.services.ServiceParameter.filter;
import static org.apache.usergrid.services.ServiceParameter.parameters;
@@ -43,11 +45,17 @@ public class ServiceRequestIT {
private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
+ @ClassRule
+ public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
+ @ClassRule
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@Rule
- public ServiceITSetup setup = new ServiceITSetupImpl( ServiceITSuite.cassandraResource, ServiceITSuite.elasticSearchResource );
+ public ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Test
[43/50] [abbrv] incubator-usergrid git commit: Fixes OrganizationIT.
Suffers from same org->admin bug
Posted by sn...@apache.org.
Fixes OrganizationIT. Suffers from same org->admin bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/942b000a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/942b000a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/942b000a
Branch: refs/heads/no-source-in-es
Commit: 942b000aca6eb0a4b65a66f49670cba426c7f608
Parents: bb05616
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:43:41 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:43:41 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceImpl.java | 2 --
.../usergrid/management/OrganizationIT.java | 23 ++++++++++++++------
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git 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
index 34925b0..edea8fa 100644
--- 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
@@ -1179,7 +1179,6 @@ public class ManagementServiceImpl implements ManagementService {
EntityManager em = emf.getEntityManager( smf.getManagementAppId() );
User user = em.get( userId, User.class );
- em.refreshIndex();
CredentialsInfo newCredentials =
encryptionService.defaultEncryptedCredentials( newPassword, user.getUuid(), smf.getManagementAppId() );
@@ -1228,7 +1227,6 @@ public class ManagementServiceImpl implements ManagementService {
.plainTextCredentials( mongoPassword( ( String ) user.getProperty( "username" ), newPassword ),
user.getUuid(), smf.getManagementAppId() ) );
- em.refreshIndex();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 92bb448..47718f0 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -26,6 +26,7 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -36,6 +37,9 @@ import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -58,14 +62,17 @@ public class OrganizationIT {
@ClassRule
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
+
@Test
public void testCreateOrganization() throws Exception {
UserInfo user =
- setup.getMgmtSvc().createAdminUser( "edanuff2", "Ed Anuff", "ed@anuff.com2", "test", false, false );
+ setup.getMgmtSvc().createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), "test", false, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationIT", user, false );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, false );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
@@ -108,7 +115,7 @@ public class OrganizationIT {
assertEquals( user.getUuid(), principal.getUuid() );
UserInfo new_user = setup.getMgmtSvc()
- .createAdminUser( "test-user-133", "Test User", "test-user-133@mockserver.com",
+ .createAdminUser(uniqueUsername(), "Test User", uniqueEmail(),
"testpassword", true, true );
assertNotNull( new_user );
@@ -121,11 +128,13 @@ public class OrganizationIT {
String[] passwords = new String[] { "password1", "password2", "password3", "password4", "password5" };
+
+
UserInfo user = setup.getMgmtSvc()
- .createAdminUser( "edanuff3", "Ed Anuff", "ed2@anuff.com2", passwords[0], true, false );
+ .createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), passwords[0], true, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationTest2", user, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, true );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -151,7 +160,7 @@ public class OrganizationIT {
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
try {
- setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[2] );
+ setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[3] );
fail( "password change should fail" );
}
catch ( RecentlyUsedPasswordException e ) {
@@ -207,7 +216,7 @@ public class OrganizationIT {
}
// test history size w/ user belonging to 2 orgs
- OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization( "OrganizationTest3", user, false );
+ OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization(uniqueOrg(), user, false );
assertNotNull( organization2 );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
[08/50] [abbrv] incubator-usergrid git commit: fix gcm
Posted by sn...@apache.org.
fix gcm
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/e9cecff1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/e9cecff1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/e9cecff1
Branch: refs/heads/no-source-in-es
Commit: e9cecff1d0df14691c021fb682a9f84bdb3382ed
Parents: 6224915
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 12:36:24 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 12:36:24 2014 -0700
----------------------------------------------------------------------
.../services/notifications/gcm/NotificationsServiceIT.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e9cecff1/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 4b41d13..ce0dca7 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -163,7 +163,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
// perform push //
notification = scheduleNotificationAndWait(notification);
- checkReceipts(notification, 1);
+ checkReceipts(notification, 2);
}
@Test
[38/50] [abbrv] incubator-usergrid git commit: Fixes
ManagementServiceIT
Posted by sn...@apache.org.
Fixes ManagementServiceIT
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/7ffe1ac7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/7ffe1ac7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/7ffe1ac7
Branch: refs/heads/no-source-in-es
Commit: 7ffe1ac7a5a91bd6c603124953a33519e729c683
Parents: cfff0cc
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:13:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:13:45 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 79 +++++++++++++-------
1 file changed, 52 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7ffe1ac7/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 4288d99..14a34b4 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
@@ -30,6 +31,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -52,6 +54,7 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -66,33 +69,43 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
+
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
+
+
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private UUID applicationId;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "edanuff", "Ed Anuff", "ed@anuff.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "ed-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "ed-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
+
+ setup.getEmf().refreshIndex();
}
+
@Test
public void testGetTokenForPrincipalAdmin() throws Exception {
String token = ( ( ManagementServiceImpl ) setup.getMgmtSvc() )
@@ -140,15 +153,27 @@ public class ManagementServiceIT {
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
- setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
-
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
assertNotNull( counts.get( "admin_logins" ) );
- assertEquals( 1, counts.get( "admin_logins" ).intValue() );
+
+ final long startCount = counts.get( "admin_logins" );
+
+
+ setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
+
+
+ counts = em.getApplicationCounters();
+ LOG.info( JsonUtils.mapToJsonString( counts ) );
+ LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
+ assertNotNull( counts.get( "admin_logins" ) );
+
+ final long newCount = counts.get( "admin_logins" );
+
+ assertEquals( 1l, newCount - startCount );
}
@@ -461,11 +486,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", UUID.randomUUID() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -490,7 +515,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType";
+ String username = "testAdminPasswordChangeShaType"+newUUIDString();
String password = "test";
@@ -547,7 +572,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType";
+ String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
String password = "test";
@@ -610,10 +635,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "autneticateUser";
- String appName = "authenticateUser";
+ String orgName = "autneticateUser"+newUUIDString();
+ String appName = "authenticateUser"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -654,10 +679,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeShaType";
- String appName = "testAppUserPasswordChangeShaType";
+ String orgName = "testAppUserPasswordChangeShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -713,10 +738,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType";
- String appName = "testAppUserPasswordChangeMd5ShaType";
+ String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
[18/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b545c0e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b545c0e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b545c0e4
Branch: refs/heads/two-dot-o-events
Commit: b545c0e4715d458f7e6b5c1cfa0e96a1f86068b2
Parents: 8d34426
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 09:38:45 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 09:38:45 2014 -0700
----------------------------------------------------------------------
.../index/impl/EsEntityIndexImpl.java | 30 ++-----
.../persistence/index/impl/EsIndexCache.java | 91 ++++++++++++++++++++
2 files changed, 99 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b545c0e4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 3f895b5..a6e9337 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -30,7 +30,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
-import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
@@ -38,8 +37,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
import org.elasticsearch.client.AdminClient;
-import org.elasticsearch.cluster.metadata.AliasMetaData;
-import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -120,11 +117,11 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
private static final MatchAllQueryBuilder MATCH_ALL_QUERY_BUILDER = QueryBuilders.matchAllQuery();
+ private EsIndexCache aliasCache;
- @Inject
- public EsEntityIndexImpl( @Assisted final ApplicationScope appScope, final IndexFig config,
- final EsProvider provider ) {
+ @Inject
+ public EsEntityIndexImpl( @Assisted final ApplicationScope appScope, final IndexFig config, final EsProvider provider, final EsIndexCache indexCache) {
ValidationUtils.validateApplicationScope( appScope );
this.applicationScope = appScope;
this.esProvider = provider;
@@ -133,6 +130,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
this.indexIdentifier = IndexingUtils.createIndexIdentifier(config, appScope);
this.alias = indexIdentifier.getAlias();
this.failureMonitor = new FailureMonitorImpl( config, provider );
+ this.aliasCache = indexCache;
}
@Override
@@ -188,7 +186,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
String indexName = indexIdentifier.getIndex(indexSuffix);
final AdminClient adminClient = esProvider.getClient().admin();
- String[] indexNames = getIndexes(alias.getWriteAlias());
+ String[] indexNames = getIndexes(AliasType.Write);
for(String currentIndex : indexNames){
isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,
@@ -206,7 +204,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
isAck = adminClient.indices().prepareAliases().addAlias(
indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new write Alias Name [{}] ACK=[{}]", alias, isAck);
-
+ aliasCache.invalidate(alias);
} catch (Exception e) {
logger.warn("Failed to create alias ", e);
}
@@ -214,21 +212,9 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
@Override
public String[] getIndexes(final AliasType aliasType) {
- final String aliasName = aliasType == AliasType.Read ? alias.getReadAlias() : alias.getWriteAlias();
- return getIndexes(aliasName);
+ return aliasCache.getIndexes(alias,aliasType);
}
- /**
- * get indexes for alias
- * @param aliasName
- * @return
- */
- private String[] getIndexes(final String aliasName){
- final AdminClient adminClient = esProvider.getClient().admin();
- //remove write alias, can only have one
- ImmutableOpenMap<String,List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
- return aliasMap.keys().toArray(String.class);
- }
/**
* Tests writing a document to a new index to ensure it's working correctly. See this post:
@@ -457,7 +443,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
@Override
public boolean doOp() {
try {
- String[] indexes = getIndexes(AliasType.Read);
+ String[] indexes = getIndexes(AliasType.Read);
Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
@Override
public String call(String index) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b545c0e4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
new file mode 100644
index 0000000..710cc60
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * * 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.persistence.index.impl;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.IndexIdentifier;
+import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
+import org.elasticsearch.client.AdminClient;
+import org.elasticsearch.cluster.metadata.AliasMetaData;
+import org.elasticsearch.common.collect.ImmutableOpenMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Classy class class.
+ */
+@Singleton
+public class EsIndexCache {
+
+ private static final Logger logger = LoggerFactory.getLogger(EsEntityIndexImpl.class);
+
+ private LoadingCache<String, String[]> aliasIndexCache;
+
+ @Inject
+ public EsIndexCache(final EsProvider provider) {
+ aliasIndexCache = CacheBuilder.newBuilder().maximumSize(1000)
+ .refreshAfterWrite(5,TimeUnit.MINUTES)
+ .build(new CacheLoader<String, String[]>() {
+ @Override
+ public ListenableFuture<String[]> reload(String key, String[] oldValue) throws Exception {
+ return super.reload(key, oldValue);
+ }
+
+ @Override
+ public String[] load(String aliasName) {
+ final AdminClient adminClient = provider.getClient().admin();
+ //remove write alias, can only have one
+ ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
+ return aliasMap.keys().toArray(String.class);
+ }
+ })
+
+ ;
+ }
+
+ public String[] getIndexes(IndexIdentifier.IndexAlias alias, AliasedEntityIndex.AliasType aliasType) {
+ String[] indexes;
+ try {
+ indexes = aliasIndexCache.get(aliasType == AliasedEntityIndex.AliasType.Read ? alias.getReadAlias() : alias.getWriteAlias());
+ } catch (ExecutionException ee) {
+ logger.error("Failed to retreive indexes", ee);
+ throw new RuntimeException(ee);
+ }
+ return indexes;
+ }
+
+ public void invalidate(IndexIdentifier.IndexAlias alias){
+ aliasIndexCache.invalidate(alias.getWriteAlias());
+ aliasIndexCache.invalidate(alias.getReadAlias());
+
+ }
+
+}
[26/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/two-dot-o' into USERGRID-252
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5d4ce726
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5d4ce726
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5d4ce726
Branch: refs/heads/two-dot-o-events
Commit: 5d4ce726117ddb8ba67e3df86180751d201a3561
Parents: 692eff8 a63b856
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 16:08:50 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 16:08:50 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManager.java | 230 ++++++++++---------
.../corepersistence/util/CpEntityMapUtils.java | 32 ++-
.../batch/job/SchedulerRuntimeIntervalIT.java | 49 ++--
.../migration/EntityDataMigrationIT.java | 139 +++++------
.../migration/EntityTypeMappingMigrationIT.java | 89 +++----
.../apache/usergrid/persistence/CounterIT.java | 89 ++++---
.../usergrid/persistence/CountingMutatorIT.java | 4 +-
.../persistence/EntityDictionaryIT.java | 11 +-
.../usergrid/persistence/EntityManagerIT.java | 47 ++--
.../persistence/GeoQueryBooleanTest.java | 7 +-
.../apache/usergrid/persistence/IndexIT.java | 14 +-
.../usergrid/persistence/PathQueryIT.java | 10 +-
.../PerformanceEntityRebuildIndexTest.java | 6 +-
.../usergrid/persistence/PermissionsIT.java | 5 +-
.../cassandra/EntityManagerFactoryImplIT.java | 9 +-
.../query/AbstractIteratingQueryIT.java | 3 +-
stack/core/src/test/resources/log4j.properties | 5 +-
.../data/DataMigrationManagerImpl.java | 29 ++-
.../persistence/index/IndexIdentifier.java | 4 +
.../index/impl/EsEntityIndexImpl.java | 80 ++++---
.../persistence/queue/DefaultQueueManager.java | 68 ++++++
.../usergrid/services/TestQueueManager.java | 65 ------
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
25 files changed, 570 insertions(+), 468 deletions(-)
----------------------------------------------------------------------
[04/50] [abbrv] incubator-usergrid git commit: remove queue manager
Posted by sn...@apache.org.
remove queue manager
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/461c1928
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/461c1928
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/461c1928
Branch: refs/heads/two-dot-o-events
Commit: 461c1928beae05c78646ac727f20e0afe7d6f3fb
Parents: c4973e9
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 11:03:48 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 11:03:48 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 68 ++++++++++++++++++++
.../usergrid/services/TestQueueManager.java | 65 -------------------
.../apns/NotificationsServiceIT.java | 4 +-
.../gcm/NotificationsServiceIT.java | 4 +-
4 files changed, 72 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
new file mode 100644
index 0000000..354aa7b
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
@@ -0,0 +1,68 @@
+/*
+ *
+ * * 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.persistence.queue;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * Default queue manager implementation, uses in memory linked queue
+ */
+public class DefaultQueueManager implements QueueManager {
+ public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
+ @Override
+ public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
+ List<QueueMessage> returnQueue = new ArrayList<>();
+ for(int i=0;i<limit;i++){
+ if(!queue.isEmpty()){
+ returnQueue.add( queue.remove());
+ }else{
+ break;
+ }
+ }
+ return returnQueue;
+ }
+
+ @Override
+ public void commitMessage(QueueMessage queueMessage) {
+ }
+
+ @Override
+ public void commitMessages(List<QueueMessage> queueMessages) {
+ }
+
+ @Override
+ public synchronized void sendMessages(List bodies) throws IOException {
+ for(Object body : bodies){
+ String uuid = UUID.randomUUID().toString();
+ queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
+ }
+ }
+
+ @Override
+ public synchronized void sendMessage(Object body) throws IOException {
+ String uuid = UUID.randomUUID().toString();
+ queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java b/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
deleted file mode 100644
index 37fef40..0000000
--- a/stack/services/src/test/java/org/apache/usergrid/services/TestQueueManager.java
+++ /dev/null
@@ -1,65 +0,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.services;
-
-import org.apache.usergrid.persistence.queue.QueueManager;
-import org.apache.usergrid.persistence.queue.QueueMessage;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-
-public class TestQueueManager implements QueueManager {
- public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
- @Override
- public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
- List<QueueMessage> returnQueue = new ArrayList<>();
- for(int i=0;i<limit;i++){
- if(!queue.isEmpty()){
- returnQueue.add( queue.remove());
- }else{
- break;
- }
- }
- return returnQueue;
- }
-
- @Override
- public void commitMessage(QueueMessage queueMessage) {
- }
-
- @Override
- public void commitMessages(List<QueueMessage> queueMessages) {
- }
-
- @Override
- public synchronized void sendMessages(List bodies) throws IOException {
- for(Object body : bodies){
- String uuid = UUID.randomUUID().toString();
- queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
- }
- }
-
- @Override
- public synchronized void sendMessage(Object body) throws IOException {
- String uuid = UUID.randomUUID().toString();
- queue.add(new QueueMessage(uuid,"handle_"+uuid,body));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 0a5375f..3f42777 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -21,7 +21,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.usergrid.persistence.*;
import org.apache.usergrid.persistence.entities.*;
import org.apache.usergrid.persistence.index.query.Query;
-import org.apache.usergrid.services.TestQueueManager;
+import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
import org.slf4j.Logger;
@@ -121,7 +121,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
ns = getNotificationService();
- TestQueueManager qm = new TestQueueManager();
+ DefaultQueueManager qm = new DefaultQueueManager();
ns.TEST_QUEUE_MANAGER = qm;
app.getEntityManager().refreshIndex();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/461c1928/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 5228464..4b41d13 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -18,7 +18,7 @@ package org.apache.usergrid.services.notifications.gcm;
import org.apache.usergrid.persistence.*;
import org.apache.usergrid.persistence.entities.*;
-import org.apache.usergrid.services.TestQueueManager;
+import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
import org.slf4j.Logger;
@@ -93,7 +93,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
device2 = app.getEntityManager().get(e.getUuid(), Device.class);
ns = getNotificationService();
- TestQueueManager qm = new TestQueueManager();
+ DefaultQueueManager qm = new DefaultQueueManager();
ns.TEST_QUEUE_MANAGER = qm;
listener = new QueueListener(ns.getServiceManagerFactory(), ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
[16/50] [abbrv] incubator-usergrid git commit: add observable to
refresh
Posted by sn...@apache.org.
add observable to refresh
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/8d344268
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/8d344268
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/8d344268
Branch: refs/heads/no-source-in-es
Commit: 8d344268ba435253497a7c92db895152c193a20a
Parents: 21630f4
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 17:32:03 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 17:32:03 2014 -0700
----------------------------------------------------------------------
.../persistence/index/impl/EsEntityIndexBatchImpl.java | 6 +-----
.../usergrid/persistence/index/impl/EsEntityIndexImpl.java | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d344268/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index 0d0e52b..cd5be7f 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -191,7 +191,6 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
if(indexes == null ||indexes.length == 0){
indexes = new String[]{indexIdentifier.getIndex(null)};
}
- final AtomicInteger errorCount = new AtomicInteger();
//get all indexes then flush everyone
Observable.from(indexes).subscribeOn(Schedulers.io())
.map(new Func1<String, Object>() {
@@ -201,15 +200,12 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
bulkRequest.add(client.prepareDelete(index, entityType, indexId).setRefresh(refresh));
}catch (Exception e){
log.error("failed to deindex",e);
- errorCount.incrementAndGet();
+ throw e;
}
return index;
}
}).toBlocking().last();
- if(errorCount.get()>0){
- log.error("Failed to flush some indexes");
- }
log.debug( "Deindexed Entity with index id " + indexId );
maybeFlush();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8d344268/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 4bca8c2..3f895b5 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -464,7 +464,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();
return index;
}
- });
+ }).toBlocking().last();
logger.debug( "Refreshed index: " + alias);
[17/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b545c0e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b545c0e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b545c0e4
Branch: refs/heads/no-source-in-es
Commit: b545c0e4715d458f7e6b5c1cfa0e96a1f86068b2
Parents: 8d34426
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 09:38:45 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 09:38:45 2014 -0700
----------------------------------------------------------------------
.../index/impl/EsEntityIndexImpl.java | 30 ++-----
.../persistence/index/impl/EsIndexCache.java | 91 ++++++++++++++++++++
2 files changed, 99 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b545c0e4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 3f895b5..a6e9337 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -30,7 +30,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
-import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse;
@@ -38,8 +37,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
import org.elasticsearch.client.AdminClient;
-import org.elasticsearch.cluster.metadata.AliasMetaData;
-import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -120,11 +117,11 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
private static final MatchAllQueryBuilder MATCH_ALL_QUERY_BUILDER = QueryBuilders.matchAllQuery();
+ private EsIndexCache aliasCache;
- @Inject
- public EsEntityIndexImpl( @Assisted final ApplicationScope appScope, final IndexFig config,
- final EsProvider provider ) {
+ @Inject
+ public EsEntityIndexImpl( @Assisted final ApplicationScope appScope, final IndexFig config, final EsProvider provider, final EsIndexCache indexCache) {
ValidationUtils.validateApplicationScope( appScope );
this.applicationScope = appScope;
this.esProvider = provider;
@@ -133,6 +130,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
this.indexIdentifier = IndexingUtils.createIndexIdentifier(config, appScope);
this.alias = indexIdentifier.getAlias();
this.failureMonitor = new FailureMonitorImpl( config, provider );
+ this.aliasCache = indexCache;
}
@Override
@@ -188,7 +186,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
String indexName = indexIdentifier.getIndex(indexSuffix);
final AdminClient adminClient = esProvider.getClient().admin();
- String[] indexNames = getIndexes(alias.getWriteAlias());
+ String[] indexNames = getIndexes(AliasType.Write);
for(String currentIndex : indexNames){
isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,
@@ -206,7 +204,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
isAck = adminClient.indices().prepareAliases().addAlias(
indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new write Alias Name [{}] ACK=[{}]", alias, isAck);
-
+ aliasCache.invalidate(alias);
} catch (Exception e) {
logger.warn("Failed to create alias ", e);
}
@@ -214,21 +212,9 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
@Override
public String[] getIndexes(final AliasType aliasType) {
- final String aliasName = aliasType == AliasType.Read ? alias.getReadAlias() : alias.getWriteAlias();
- return getIndexes(aliasName);
+ return aliasCache.getIndexes(alias,aliasType);
}
- /**
- * get indexes for alias
- * @param aliasName
- * @return
- */
- private String[] getIndexes(final String aliasName){
- final AdminClient adminClient = esProvider.getClient().admin();
- //remove write alias, can only have one
- ImmutableOpenMap<String,List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
- return aliasMap.keys().toArray(String.class);
- }
/**
* Tests writing a document to a new index to ensure it's working correctly. See this post:
@@ -457,7 +443,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
@Override
public boolean doOp() {
try {
- String[] indexes = getIndexes(AliasType.Read);
+ String[] indexes = getIndexes(AliasType.Read);
Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
@Override
public String call(String index) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b545c0e4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
new file mode 100644
index 0000000..710cc60
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * * 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.persistence.index.impl;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.IndexIdentifier;
+import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
+import org.elasticsearch.client.AdminClient;
+import org.elasticsearch.cluster.metadata.AliasMetaData;
+import org.elasticsearch.common.collect.ImmutableOpenMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Classy class class.
+ */
+@Singleton
+public class EsIndexCache {
+
+ private static final Logger logger = LoggerFactory.getLogger(EsEntityIndexImpl.class);
+
+ private LoadingCache<String, String[]> aliasIndexCache;
+
+ @Inject
+ public EsIndexCache(final EsProvider provider) {
+ aliasIndexCache = CacheBuilder.newBuilder().maximumSize(1000)
+ .refreshAfterWrite(5,TimeUnit.MINUTES)
+ .build(new CacheLoader<String, String[]>() {
+ @Override
+ public ListenableFuture<String[]> reload(String key, String[] oldValue) throws Exception {
+ return super.reload(key, oldValue);
+ }
+
+ @Override
+ public String[] load(String aliasName) {
+ final AdminClient adminClient = provider.getClient().admin();
+ //remove write alias, can only have one
+ ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
+ return aliasMap.keys().toArray(String.class);
+ }
+ })
+
+ ;
+ }
+
+ public String[] getIndexes(IndexIdentifier.IndexAlias alias, AliasedEntityIndex.AliasType aliasType) {
+ String[] indexes;
+ try {
+ indexes = aliasIndexCache.get(aliasType == AliasedEntityIndex.AliasType.Read ? alias.getReadAlias() : alias.getWriteAlias());
+ } catch (ExecutionException ee) {
+ logger.error("Failed to retreive indexes", ee);
+ throw new RuntimeException(ee);
+ }
+ return indexes;
+ }
+
+ public void invalidate(IndexIdentifier.IndexAlias alias){
+ aliasIndexCache.invalidate(alias.getWriteAlias());
+ aliasIndexCache.invalidate(alias.getReadAlias());
+
+ }
+
+}
[39/50] [abbrv] incubator-usergrid git commit: Fixes Creator test to
use unique strings
Posted by sn...@apache.org.
Fixes Creator test to use unique strings
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f0a9870c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f0a9870c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f0a9870c
Branch: refs/heads/no-source-in-es
Commit: f0a9870c85728fbda611376ec7475d0f2fc8e44b
Parents: 7ffe1ac
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 14:54:55 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 14:54:55 2014 -0700
----------------------------------------------------------------------
.../cassandra/ApplicationCreatorIT.java | 31 +++++++++++++-------
1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f0a9870c/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index 6b3bb0b..a3eaa08 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -34,6 +34,7 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -42,8 +43,6 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent()
public class ApplicationCreatorIT {
- private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
-
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
@@ -59,14 +58,18 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc()
- .createOwnerAndOrganization( "appcreatortest", "nate-appcreatortest",
- "Nate", "nate+appcreatortest@apigee.com", "password", true,
- false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String expecteAppname = "sandbox";
+ final String expectedName = orgName + "/" + expecteAppname;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortest/sandbox", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
Set<String> rolePerms = setup.getEmf().getEntityManager( appInfo.getId() ).getRolePermissions( "guest" );
assertNotNull( rolePerms );
@@ -76,13 +79,19 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( "appcreatortestcustom",
- "nate-appcreatortestcustom", "Nate", "nate+appcreatortestcustom@apigee.com", "password", true, false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String sampleAppName = "messagee" ;
+ final String expectedName = orgName + "/" + sampleAppName;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
- customCreator.setSampleAppName( "messagee" );
+ customCreator.setSampleAppName(sampleAppName);
ApplicationInfo appInfo = customCreator.createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortestcustom/messagee", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
}
}
[46/50] [abbrv] incubator-usergrid git commit: Fixes FB test
Posted by sn...@apache.org.
Fixes FB test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/21758341
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/21758341
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/21758341
Branch: refs/heads/two-dot-o-events
Commit: 217583418a590ad5e99144dc2ee5c66438731655
Parents: 942b000
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:46:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:46:48 2014 -0700
----------------------------------------------------------------------
.../usergrid/security/providers/FacebookProviderIT.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21758341/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index c78e348..90309bd 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -38,6 +38,9 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -66,9 +69,9 @@ public class FacebookProviderIT {
public static void setup() throws Exception {
providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
+ .createAdminUser( uniqueUsername(), "Facebook User", "user"+newUUIDString()+"@facebook.com", "test", false,
false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "fb-organization", adminUser, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), adminUser, true );
applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "fb-application" ).getId();
}
[25/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/two-dot-o' into USERGRID-252
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/two-dot-o' into USERGRID-252
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/5d4ce726
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/5d4ce726
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/5d4ce726
Branch: refs/heads/no-source-in-es
Commit: 5d4ce726117ddb8ba67e3df86180751d201a3561
Parents: 692eff8 a63b856
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 16:08:50 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 16:08:50 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManager.java | 230 ++++++++++---------
.../corepersistence/util/CpEntityMapUtils.java | 32 ++-
.../batch/job/SchedulerRuntimeIntervalIT.java | 49 ++--
.../migration/EntityDataMigrationIT.java | 139 +++++------
.../migration/EntityTypeMappingMigrationIT.java | 89 +++----
.../apache/usergrid/persistence/CounterIT.java | 89 ++++---
.../usergrid/persistence/CountingMutatorIT.java | 4 +-
.../persistence/EntityDictionaryIT.java | 11 +-
.../usergrid/persistence/EntityManagerIT.java | 47 ++--
.../persistence/GeoQueryBooleanTest.java | 7 +-
.../apache/usergrid/persistence/IndexIT.java | 14 +-
.../usergrid/persistence/PathQueryIT.java | 10 +-
.../PerformanceEntityRebuildIndexTest.java | 6 +-
.../usergrid/persistence/PermissionsIT.java | 5 +-
.../cassandra/EntityManagerFactoryImplIT.java | 9 +-
.../query/AbstractIteratingQueryIT.java | 3 +-
stack/core/src/test/resources/log4j.properties | 5 +-
.../data/DataMigrationManagerImpl.java | 29 ++-
.../persistence/index/IndexIdentifier.java | 4 +
.../index/impl/EsEntityIndexImpl.java | 80 ++++---
.../persistence/queue/DefaultQueueManager.java | 68 ++++++
.../usergrid/services/TestQueueManager.java | 65 ------
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
25 files changed, 570 insertions(+), 468 deletions(-)
----------------------------------------------------------------------
[27/50] [abbrv] incubator-usergrid git commit: Removed
subscribeOnCalls
Posted by sn...@apache.org.
Removed subscribeOnCalls
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/04679c82
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/04679c82
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/04679c82
Branch: refs/heads/no-source-in-es
Commit: 04679c82a5a5cac1427c9775d40f3f3d76f30bff
Parents: 18197e3
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 17:17:12 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 17:17:12 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java | 2 +-
.../apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/04679c82/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index cd5be7f..99a08da 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -192,7 +192,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
indexes = new String[]{indexIdentifier.getIndex(null)};
}
//get all indexes then flush everyone
- Observable.from(indexes).subscribeOn(Schedulers.io())
+ Observable.from(indexes)
.map(new Func1<String, Object>() {
@Override
public Object call(String index) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/04679c82/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index a6e9337..67e1680 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -444,7 +444,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
public boolean doOp() {
try {
String[] indexes = getIndexes(AliasType.Read);
- Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
+ Observable.from(indexes).map(new Func1<String, String>() {
@Override
public String call(String index) {
esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();
[44/50] [abbrv] incubator-usergrid git commit: Fixes OrganizationIT.
Suffers from same org->admin bug
Posted by sn...@apache.org.
Fixes OrganizationIT. Suffers from same org->admin bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/942b000a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/942b000a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/942b000a
Branch: refs/heads/two-dot-o-events
Commit: 942b000aca6eb0a4b65a66f49670cba426c7f608
Parents: bb05616
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:43:41 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:43:41 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceImpl.java | 2 --
.../usergrid/management/OrganizationIT.java | 23 ++++++++++++++------
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git 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
index 34925b0..edea8fa 100644
--- 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
@@ -1179,7 +1179,6 @@ public class ManagementServiceImpl implements ManagementService {
EntityManager em = emf.getEntityManager( smf.getManagementAppId() );
User user = em.get( userId, User.class );
- em.refreshIndex();
CredentialsInfo newCredentials =
encryptionService.defaultEncryptedCredentials( newPassword, user.getUuid(), smf.getManagementAppId() );
@@ -1228,7 +1227,6 @@ public class ManagementServiceImpl implements ManagementService {
.plainTextCredentials( mongoPassword( ( String ) user.getProperty( "username" ), newPassword ),
user.getUuid(), smf.getManagementAppId() ) );
- em.refreshIndex();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/942b000a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
index 92bb448..47718f0 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/OrganizationIT.java
@@ -26,6 +26,7 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -36,6 +37,9 @@ import org.apache.usergrid.management.exceptions.RecentlyUsedPasswordException;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.security.AuthPrincipalInfo;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -58,14 +62,17 @@ public class OrganizationIT {
@ClassRule
public static ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule newOrgAppAdminRule = new NewOrgAppAdminRule( setup );
+
@Test
public void testCreateOrganization() throws Exception {
UserInfo user =
- setup.getMgmtSvc().createAdminUser( "edanuff2", "Ed Anuff", "ed@anuff.com2", "test", false, false );
+ setup.getMgmtSvc().createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), "test", false, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationIT", user, false );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, false );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
@@ -108,7 +115,7 @@ public class OrganizationIT {
assertEquals( user.getUuid(), principal.getUuid() );
UserInfo new_user = setup.getMgmtSvc()
- .createAdminUser( "test-user-133", "Test User", "test-user-133@mockserver.com",
+ .createAdminUser(uniqueUsername(), "Test User", uniqueEmail(),
"testpassword", true, true );
assertNotNull( new_user );
@@ -121,11 +128,13 @@ public class OrganizationIT {
String[] passwords = new String[] { "password1", "password2", "password3", "password4", "password5" };
+
+
UserInfo user = setup.getMgmtSvc()
- .createAdminUser( "edanuff3", "Ed Anuff", "ed2@anuff.com2", passwords[0], true, false );
+ .createAdminUser( uniqueUsername(), "Ed Anuff", uniqueEmail(), passwords[0], true, false );
assertNotNull( user );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "OrganizationTest2", user, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), user, true );
assertNotNull( organization );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -151,7 +160,7 @@ public class OrganizationIT {
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
try {
- setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[2] );
+ setup.getMgmtSvc().setAdminUserPassword( user.getUuid(), passwords[3] );
fail( "password change should fail" );
}
catch ( RecentlyUsedPasswordException e ) {
@@ -207,7 +216,7 @@ public class OrganizationIT {
}
// test history size w/ user belonging to 2 orgs
- OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization( "OrganizationTest3", user, false );
+ OrganizationInfo organization2 = setup.getMgmtSvc().createOrganization(uniqueOrg(), user, false );
assertNotNull( organization2 );
setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() ).refreshIndex();
[41/50] [abbrv] incubator-usergrid git commit: Fixes EmailFlowIT and
creates utilities for testing.
Posted by sn...@apache.org.
Fixes EmailFlowIT and creates utilities for testing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bb05616a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bb05616a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bb05616a
Branch: refs/heads/two-dot-o-events
Commit: bb05616aafd3023b096dd929a120d02e782f3124
Parents: f0a9870
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:14:28 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:20:52 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 3 +-
.../apache/usergrid/management/EmailFlowIT.java | 109 +++++++++++++------
.../cassandra/ApplicationCreatorIT.java | 23 ++--
.../management/cassandra/ExportServiceIT.java | 17 ++-
.../cassandra/ManagementServiceIT.java | 27 +++--
.../java/org/apache/usergrid/TestHelper.java | 75 +++++++++++++
.../org/apache/usergrid/UUIDTestHelper.java | 38 -------
7 files changed, 189 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
index 71a4740..ab7857e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -32,9 +32,8 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
/**
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 719fd86..f831448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -51,6 +51,11 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -87,8 +92,6 @@ import static org.junit.Assert.assertTrue;
*/
public class EmailFlowIT {
private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
- private static final String ORGANIZATION_NAME = "email-test-org-1";
- public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
@@ -114,12 +117,17 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-1@mockserver.com" );
setup.set( PROPERTIES_NOTIFY_ADMIN_OF_ACTIVATION, "true" );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo org_owner =
- createOwnerAndOrganization( ORGANIZATION_NAME, "test-user-1", "Test User", "test-user-1@mockserver.com",
- "testpassword", false, false );
+ createOwnerAndOrganization( orgName, userName, "Test User", email, "testpassword", false, false );
+
+
assertNotNull( org_owner );
- List<Message> inbox = Mailbox.get( "test-user-1@mockserver.com" );
+ List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
@@ -127,7 +135,7 @@ public class EmailFlowIT {
client.processMail();
Message confirmation = inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-1@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: " + email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -151,16 +159,23 @@ public class EmailFlowIT {
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-2@mockserver.com" );
- OrganizationOwnerInfo org_owner = createOwnerAndOrganization( ORGANIZATION_NAME_2, "test-user-2", "Test User",
- "test-user-2@mockserver.com", "testpassword", false, false );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
+ OrganizationOwnerInfo org_owner =
+ createOwnerAndOrganization( orgName, userName, "Test User", email,
+ "testpassword", false, false );
+
assertNotNull( org_owner );
- List<Message> user_inbox = Mailbox.get( "test-user-2@mockserver.com" );
+
+ List<Message> user_inbox = Mailbox.get( email );
assertFalse( user_inbox.isEmpty() );
Message confirmation = user_inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-2@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: "+email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -181,7 +196,7 @@ public class EmailFlowIT {
assertFalse( sysadmin_inbox.isEmpty() );
Message activation = sysadmin_inbox.get( 0 );
- assertEquals( "Request For Admin User Account Activation test-user-2@mockserver.com", activation.getSubject() );
+ assertEquals( "Request For Admin User Account Activation "+email, activation.getSubject() );
token = getTokenFromMessage( activation );
LOG.info( token );
@@ -204,10 +219,14 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS, "false" );
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "false" );
+
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo ooi = setup.getMgmtSvc()
- .createOwnerAndOrganization( "org-skipallemailtest", "user-skipallemailtest",
- "name-skipallemailtest", "nate+skipallemailtest@apigee.com",
- "password" );
+ .createOwnerAndOrganization(orgName, userName, "Test User", email,
+ "testpassword");
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
User user = em.get( ooi.getOwner().getUuid(), User.class );
@@ -234,23 +253,36 @@ public class EmailFlowIT {
}
+ /**
+ * Tests that when a user is added to an app and activation on that app is required, the org admin is emailed
+ * @throws Exception
+ *
+ * TODO, I'm not convinced this worked correctly. IT can't find users collection in the orgs. Therefore,
+ * I think this is a legitimate bug that was just found from fixing the tests to be unique admins orgs and emails
+ */
@Test
public void testAppUserActivationResetpwdMail() throws Exception {
- String orgName = this.getClass().getName() + "1";
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-4@mockserver.com";
- String passwd = "testpassword";
- OrganizationOwnerInfo orgOwner;
- orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+ OrganizationOwnerInfo orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
assertNotNull( orgOwner );
ApplicationInfo app = setup.getMgmtSvc().createApplication( orgOwner.getOrganization().getUuid(), appName );
+
+ //turn on app admin approval for app users
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserMailUrl", "testAppUserMailUrl@test.com", false );
- String subject = "Request For User Account Activation testAppUserMailUrl@test.com";
+ final String appUserUsername = uniqueUsername();
+ final String appUserEmail = uniqueEmail();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, false );
+
+ String subject = "Request For User Account Activation " + email;
String activation_url = String.format( setup.get( PROPERTIES_USER_ACTIVATION_URL ), orgName, appName,
user.getUuid().toString() );
@@ -261,7 +293,7 @@ public class EmailFlowIT {
List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "usergrid.com", "test", "somepassword" );
+ MockImapClient client = new MockImapClient( "usergrid.com", userName, "somepassword" );
client.processMail();
// subject ok
@@ -287,9 +319,9 @@ public class EmailFlowIT {
// reset_pwd
setup.getMgmtSvc().startAppUserPasswordResetFlow( app.getId(), user );
- inbox = Mailbox.get( "testAppUserMailUrl@test.com" );
+ inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- client = new MockImapClient( "test.com", "testAppUserMailUrl", "somepassword" );
+ client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
@@ -315,11 +347,13 @@ public class EmailFlowIT {
/** Tests to make sure a normal user must be activated by the admin after confirmation. */
@Test
public void testAppUserConfirmationMail() throws Exception {
- String orgName = this.getClass().getName();
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-45@mockserver.com";
- String passwd = "testpassword";
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+
OrganizationOwnerInfo orgOwner;
orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
@@ -331,18 +365,23 @@ public class EmailFlowIT {
assertNotNull( app );
enableEmailConfirmation( app.getId() );
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserConfMail", "testAppUserConfMail@test.com", true );
- String subject = "User Account Confirmation: testAppUserConfMail@test.com";
+
+ final String appUserEmail = uniqueEmail();
+ final String appUserUsername = uniqueUsername();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, true );
+
+ String subject = "User Account Confirmation: "+appUserEmail;
String urlProp = setup.get( PROPERTIES_USER_CONFIRMATION_URL );
String confirmation_url = String.format( urlProp, orgName, appName, user.getUuid().toString() );
// request confirmation
setup.getMgmtSvc().startAppUserActivationFlow( app.getId(), user );
- List<Message> inbox = Mailbox.get( "testAppUserConfMail@test.com" );
+ List<Message> inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "test.com", "testAppUserConfMail", "somepassword" );
+ MockImapClient client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index a3eaa08..0fbeb7d 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -22,8 +22,6 @@ import java.util.Set;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
@@ -34,7 +32,10 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -59,13 +60,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String expecteAppname = "sandbox";
final String expectedName = orgName + "/" + expecteAppname;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
@@ -80,13 +81,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String sampleAppName = "messagee" ;
final String expectedName = orgName + "/" + sampleAppName;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
customCreator.setSampleAppName(sampleAppName);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index 2c64836..53de224 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -66,7 +66,9 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -345,9 +347,11 @@ public class ExportServiceIT {
@Test
public void testExportOneAppOnCollectionEndpoint() throws Exception {
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+
+
File f = null;
- String orgName = "george-organization"+newUUIDString();
- String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -616,11 +620,14 @@ public class ExportServiceIT {
HashMap<String, Object> payload = payloadBuilder();
//creates 100s of organizations with some entities in each one to make sure we don't actually apply it
+ final String uniqueOrg = uniqueOrg();
+ final String uniqueApp = uniqueApp();
+
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
+ orgMade = setup.getMgmtSvc().createOrganization(uniqueOrg + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), uniqueApp + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 14a34b4..ddb2bbb 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.UUID;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -54,7 +53,11 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -486,11 +489,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine",uniqueEmail(), password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -515,7 +518,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -572,7 +575,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -635,10 +638,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "autneticateUser"+newUUIDString();
- String appName = "authenticateUser"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -738,10 +741,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
- String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
new file mode 100644
index 0000000..cf476e2
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class TestHelper {
+
+ /**
+ * Generate a unique name for an organization
+ * @return
+ */
+ public static String uniqueOrg(){
+ return "org" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique name for an application
+ * @return
+ */
+ public static String uniqueApp(){
+ return "app" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique username
+ * @return
+ */
+ public static String uniqueUsername(){
+ return "user" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique email
+ * @return
+ */
+ public static String uniqueEmail(){
+ return "user" + newUUIDString() + "@apache.org";
+ }
+
+
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
deleted file mode 100644
index dffe826..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
+++ /dev/null
@@ -1,38 +0,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;
-
-
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-
-/**
- * Simple class to manipulate UUIDs into strings for unique strings when testing
- */
-public class UUIDTestHelper {
-
- /**
- * Generate a new UUID, and remove all the '-' characters from the resulting string.
- * @return
- */
- public static String newUUIDString() {
- return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
- }
-}
[35/50] [abbrv] incubator-usergrid git commit: Finished rule for use
in tests and completed ExportServiceIT migration to the rule
Posted by sn...@apache.org.
Finished rule for use in tests and completed ExportServiceIT migration to the rule
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/cfff0cce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/cfff0cce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/cfff0cce
Branch: refs/heads/no-source-in-es
Commit: cfff0cce4faeeeee8dfbe3add8e622809db0c7bd
Parents: 5baf6cd
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:05:37 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:06:10 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 160 +++++++++++++++++++
.../management/cassandra/ExportServiceIT.java | 48 +++---
.../org/apache/usergrid/UUIDTestHelper.java | 38 +++++
3 files changed, 228 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
new file mode 100644
index 0000000..71a4740
--- /dev/null
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -0,0 +1,160 @@
+/*
+ * 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;
+
+
+import java.util.UUID;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.management.ApplicationInfo;
+import org.apache.usergrid.management.OrganizationInfo;
+import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.management.UserInfo;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+
+
+/**
+ * Creates a new org and admin for every method in the class. Also creates an application
+ */
+public class NewOrgAppAdminRule implements TestRule {
+
+ private final static Logger LOG = LoggerFactory.getLogger( CoreApplication.class );
+
+ public static final String ADMIN_NAME = "Test Admin";
+ public static final String ADMIN_PASSWORD = "password";
+
+ private final ServiceITSetup setup;
+
+ private OrganizationOwnerInfo organizationOwnerInfo;
+ private ApplicationInfo applicationInfo;
+
+
+ public NewOrgAppAdminRule( final ServiceITSetup setup ) {
+ this.setup = setup;
+ }
+
+
+ @Override
+ public Statement apply( final Statement base, final Description description ) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ before( description );
+
+ try {
+ base.evaluate();
+ }
+ finally {
+ after( description );
+ }
+ }
+ };
+ }
+
+
+ protected void after( Description description ) {
+ LOG.info( "Test {}: finish with application", description.getDisplayName() );
+ }
+
+
+ /**
+ * Get the org and admin user info
+ * @return
+ */
+ public OrganizationOwnerInfo getOrganizationOwnerInfo() {
+ return organizationOwnerInfo;
+ }
+
+
+ /**
+ * Get the applicationInfo
+ * @return
+ */
+ public ApplicationInfo getApplicationInfo() {
+ return applicationInfo;
+ }
+
+
+ /**
+ * Get the organization info
+ * @return
+ */
+ public OrganizationInfo getOrganizationInfo(){
+ return getOrganizationOwnerInfo().getOrganization();
+ }
+
+
+ /**
+ * Get the admin info
+ * @return
+ */
+ public UserInfo getAdminInfo(){
+ return getOrganizationOwnerInfo().getOwner();
+ }
+
+
+ /**
+ * Create the org admin and application
+ */
+ protected void before( Description description ) throws Exception {
+ final String className = description.getClassName();
+ final String methodName = description.getMethodName();
+ final String uuidString = newUUIDString();
+
+ final String orgName = className + uuidString;
+ final String appName = methodName;
+ final String adminUsername = uuidString;
+ final String email = uuidString + "@apache.org";
+
+ organizationOwnerInfo = createOwnerAndOrganization( orgName, adminUsername, email, ADMIN_NAME, ADMIN_PASSWORD );
+ applicationInfo = createApplication( organizationOwnerInfo.getOrganization().getUuid(), appName );
+ }
+
+
+ /**
+ * Create the org and the admin that owns it
+ */
+ public OrganizationOwnerInfo createOwnerAndOrganization( final String orgName, final String adminUsername,
+ final String adminEmail, final String adminName,
+ final String adminPassword ) throws Exception {
+ return setup.getMgmtSvc()
+ .createOwnerAndOrganization( orgName, adminUsername, adminName, adminEmail, adminPassword, false,
+ false );
+ }
+
+
+ /**
+ * Create the new application
+ */
+ public ApplicationInfo createApplication( final UUID organizationId, final String applicationName )
+ throws Exception {
+ return setup.getMgmtSvc().createApplication( organizationId, applicationName );
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index a5b499b..2c64836 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -35,7 +35,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.netty.config.NettyPayloadModule;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -43,6 +43,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.batch.JobExecution;
@@ -65,6 +66,7 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -88,24 +90,33 @@ public class ExportServiceIT {
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
- @BeforeClass
- public static void setup() throws Exception {
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private OrganizationInfo organization;
+ private UUID applicationId;
+
+
+
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "grey", "George Reyes", "george@reyes.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "george-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "george-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ organization = orgAppAdminRule.getOrganizationInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
setup.getEmf().refreshIndex();
}
@@ -288,8 +299,9 @@ public class ExportServiceIT {
catch ( Exception e ) {
//consumed because this checks to see if the file exists. If it doesn't then don't do anything and carry on.
}
- setup.getMgmtSvc()
- .createOwnerAndOrganization( "noExport", "junkUserName", "junkRealName", "ugExport@usergrid.com",
+
+ //create another org to ensure we don't export it
+ orgAppAdminRule.createOwnerAndOrganization( "noExport"+newUUIDString(), "junkUserName"+newUUIDString(), "junkRealName"+newUUIDString(), newUUIDString()+"ugExport@usergrid.com",
"123456789" );
S3Export s3Export = new MockS3ExportImpl("exportOneOrg.json");
@@ -334,8 +346,8 @@ public class ExportServiceIT {
public void testExportOneAppOnCollectionEndpoint() throws Exception {
File f = null;
- String orgName = "george-organization";
- String appName = "testAppCollectionTestNotExported";
+ String orgName = "george-organization"+newUUIDString();
+ String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -607,8 +619,8 @@ public class ExportServiceIT {
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss" + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" + i );
+ orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
new file mode 100644
index 0000000..dffe826
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class UUIDTestHelper {
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
[36/50] [abbrv] incubator-usergrid git commit: Finished rule for use
in tests and completed ExportServiceIT migration to the rule
Posted by sn...@apache.org.
Finished rule for use in tests and completed ExportServiceIT migration to the rule
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/cfff0cce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/cfff0cce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/cfff0cce
Branch: refs/heads/two-dot-o-events
Commit: cfff0cce4faeeeee8dfbe3add8e622809db0c7bd
Parents: 5baf6cd
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:05:37 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:06:10 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 160 +++++++++++++++++++
.../management/cassandra/ExportServiceIT.java | 48 +++---
.../org/apache/usergrid/UUIDTestHelper.java | 38 +++++
3 files changed, 228 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
new file mode 100644
index 0000000..71a4740
--- /dev/null
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -0,0 +1,160 @@
+/*
+ * 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;
+
+
+import java.util.UUID;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.management.ApplicationInfo;
+import org.apache.usergrid.management.OrganizationInfo;
+import org.apache.usergrid.management.OrganizationOwnerInfo;
+import org.apache.usergrid.management.UserInfo;
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+
+
+/**
+ * Creates a new org and admin for every method in the class. Also creates an application
+ */
+public class NewOrgAppAdminRule implements TestRule {
+
+ private final static Logger LOG = LoggerFactory.getLogger( CoreApplication.class );
+
+ public static final String ADMIN_NAME = "Test Admin";
+ public static final String ADMIN_PASSWORD = "password";
+
+ private final ServiceITSetup setup;
+
+ private OrganizationOwnerInfo organizationOwnerInfo;
+ private ApplicationInfo applicationInfo;
+
+
+ public NewOrgAppAdminRule( final ServiceITSetup setup ) {
+ this.setup = setup;
+ }
+
+
+ @Override
+ public Statement apply( final Statement base, final Description description ) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ before( description );
+
+ try {
+ base.evaluate();
+ }
+ finally {
+ after( description );
+ }
+ }
+ };
+ }
+
+
+ protected void after( Description description ) {
+ LOG.info( "Test {}: finish with application", description.getDisplayName() );
+ }
+
+
+ /**
+ * Get the org and admin user info
+ * @return
+ */
+ public OrganizationOwnerInfo getOrganizationOwnerInfo() {
+ return organizationOwnerInfo;
+ }
+
+
+ /**
+ * Get the applicationInfo
+ * @return
+ */
+ public ApplicationInfo getApplicationInfo() {
+ return applicationInfo;
+ }
+
+
+ /**
+ * Get the organization info
+ * @return
+ */
+ public OrganizationInfo getOrganizationInfo(){
+ return getOrganizationOwnerInfo().getOrganization();
+ }
+
+
+ /**
+ * Get the admin info
+ * @return
+ */
+ public UserInfo getAdminInfo(){
+ return getOrganizationOwnerInfo().getOwner();
+ }
+
+
+ /**
+ * Create the org admin and application
+ */
+ protected void before( Description description ) throws Exception {
+ final String className = description.getClassName();
+ final String methodName = description.getMethodName();
+ final String uuidString = newUUIDString();
+
+ final String orgName = className + uuidString;
+ final String appName = methodName;
+ final String adminUsername = uuidString;
+ final String email = uuidString + "@apache.org";
+
+ organizationOwnerInfo = createOwnerAndOrganization( orgName, adminUsername, email, ADMIN_NAME, ADMIN_PASSWORD );
+ applicationInfo = createApplication( organizationOwnerInfo.getOrganization().getUuid(), appName );
+ }
+
+
+ /**
+ * Create the org and the admin that owns it
+ */
+ public OrganizationOwnerInfo createOwnerAndOrganization( final String orgName, final String adminUsername,
+ final String adminEmail, final String adminName,
+ final String adminPassword ) throws Exception {
+ return setup.getMgmtSvc()
+ .createOwnerAndOrganization( orgName, adminUsername, adminName, adminEmail, adminPassword, false,
+ false );
+ }
+
+
+ /**
+ * Create the new application
+ */
+ public ApplicationInfo createApplication( final UUID organizationId, final String applicationName )
+ throws Exception {
+ return setup.getMgmtSvc().createApplication( organizationId, applicationName );
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index a5b499b..2c64836 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -35,7 +35,7 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.netty.config.NettyPayloadModule;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
-import org.junit.BeforeClass;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -43,6 +43,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.batch.JobExecution;
@@ -65,6 +66,7 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -88,24 +90,33 @@ public class ExportServiceIT {
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
- @BeforeClass
- public static void setup() throws Exception {
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private OrganizationInfo organization;
+ private UUID applicationId;
+
+
+
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "grey", "George Reyes", "george@reyes.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "george-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "george-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ organization = orgAppAdminRule.getOrganizationInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
setup.getEmf().refreshIndex();
}
@@ -288,8 +299,9 @@ public class ExportServiceIT {
catch ( Exception e ) {
//consumed because this checks to see if the file exists. If it doesn't then don't do anything and carry on.
}
- setup.getMgmtSvc()
- .createOwnerAndOrganization( "noExport", "junkUserName", "junkRealName", "ugExport@usergrid.com",
+
+ //create another org to ensure we don't export it
+ orgAppAdminRule.createOwnerAndOrganization( "noExport"+newUUIDString(), "junkUserName"+newUUIDString(), "junkRealName"+newUUIDString(), newUUIDString()+"ugExport@usergrid.com",
"123456789" );
S3Export s3Export = new MockS3ExportImpl("exportOneOrg.json");
@@ -334,8 +346,8 @@ public class ExportServiceIT {
public void testExportOneAppOnCollectionEndpoint() throws Exception {
File f = null;
- String orgName = "george-organization";
- String appName = "testAppCollectionTestNotExported";
+ String orgName = "george-organization"+newUUIDString();
+ String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -607,8 +619,8 @@ public class ExportServiceIT {
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss" + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" + i );
+ orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/cfff0cce/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
new file mode 100644
index 0000000..dffe826
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class UUIDTestHelper {
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
[22/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/574fe644
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/574fe644
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/574fe644
Branch: refs/heads/two-dot-o-events
Commit: 574fe6449a96a7f8a8531cdb0c2f81ad7a2643e9
Parents: 1d2697f
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 11:16:16 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 11:16:16 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/IndexFig.java | 3 +++
.../persistence/index/impl/EsIndexCache.java | 23 ++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/574fe644/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index ea0a4f3..d78ed72 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@ -110,4 +110,7 @@ public interface IndexFig extends GuicyFig {
@Default( "20" )
@Key( ELASTICSEARCH_FAIL_REFRESH )
int getFailRefreshCount();
+
+ @Default("2")
+ int getIndexCacheMaxWorkers();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/574fe644/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
index f418590..c607222 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -24,9 +24,13 @@ import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListenableFutureTask;
+import com.google.common.util.concurrent.ListeningScheduledExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.apache.usergrid.persistence.index.AliasedEntityIndex;
+import org.apache.usergrid.persistence.index.IndexFig;
import org.apache.usergrid.persistence.index.IndexIdentifier;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.client.AdminClient;
@@ -36,7 +40,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
+import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
@@ -46,21 +52,30 @@ import java.util.concurrent.TimeUnit;
public class EsIndexCache {
private static final Logger logger = LoggerFactory.getLogger(EsEntityIndexImpl.class);
+ private final ListeningScheduledExecutorService refreshExecutors;
private LoadingCache<String, String[]> aliasIndexCache;
@Inject
- public EsIndexCache(final EsProvider provider) {
+ public EsIndexCache(final EsProvider provider, final IndexFig indexFig) {
+ this.refreshExecutors = MoreExecutors
+ .listeningDecorator(Executors.newScheduledThreadPool(indexFig.getIndexCacheMaxWorkers()));
aliasIndexCache = CacheBuilder.newBuilder().maximumSize(1000)
.refreshAfterWrite(5,TimeUnit.MINUTES)
.build(new CacheLoader<String, String[]>() {
@Override
- public ListenableFuture<String[]> reload(String key, String[] oldValue) throws Exception {
- return super.reload(key, oldValue);
+ public ListenableFuture<String[]> reload(final String key, String[] oldValue) throws Exception {
+ ListenableFutureTask<String[]> task = ListenableFutureTask.create( new Callable<String[]>() {
+ public String[] call() {
+ return load( key );
+ }
+ } );
+ refreshExecutors.execute(task);
+ return task;
}
@Override
- public String[] load(String aliasName) {
+ public String[] load(final String aliasName) {
final AdminClient adminClient = provider.getClient().admin();
//remove write alias, can only have one
ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
[45/50] [abbrv] incubator-usergrid git commit: Fixes FB test
Posted by sn...@apache.org.
Fixes FB test
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/21758341
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/21758341
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/21758341
Branch: refs/heads/no-source-in-es
Commit: 217583418a590ad5e99144dc2ee5c66438731655
Parents: 942b000
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:46:48 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:46:48 2014 -0700
----------------------------------------------------------------------
.../usergrid/security/providers/FacebookProviderIT.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21758341/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
index c78e348..90309bd 100644
--- a/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/security/providers/FacebookProviderIT.java
@@ -38,6 +38,9 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import org.apache.usergrid.utils.MapUtils;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -66,9 +69,9 @@ public class FacebookProviderIT {
public static void setup() throws Exception {
providerFactory = cassandraResource.getBean( SignInProviderFactory.class );
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( "fbuser", "Facebook User", "user@facebook.com", "test", false,
+ .createAdminUser( uniqueUsername(), "Facebook User", "user"+newUUIDString()+"@facebook.com", "test", false,
false );
- OrganizationInfo organization = setup.getMgmtSvc().createOrganization( "fb-organization", adminUser, true );
+ OrganizationInfo organization = setup.getMgmtSvc().createOrganization( uniqueOrg(), adminUser, true );
applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "fb-application" ).getId();
}
[40/50] [abbrv] incubator-usergrid git commit: Fixes Creator test to
use unique strings
Posted by sn...@apache.org.
Fixes Creator test to use unique strings
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f0a9870c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f0a9870c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f0a9870c
Branch: refs/heads/two-dot-o-events
Commit: f0a9870c85728fbda611376ec7475d0f2fc8e44b
Parents: 7ffe1ac
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 14:54:55 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 14:54:55 2014 -0700
----------------------------------------------------------------------
.../cassandra/ApplicationCreatorIT.java | 31 +++++++++++++-------
1 file changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f0a9870c/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index 6b3bb0b..a3eaa08 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -34,6 +34,7 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -42,8 +43,6 @@ import static org.junit.Assert.assertTrue;
/** @author zznate */
@Concurrent()
public class ApplicationCreatorIT {
- private static final Logger LOG = LoggerFactory.getLogger( ApplicationCreatorIT.class );
-
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
@@ -59,14 +58,18 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc()
- .createOwnerAndOrganization( "appcreatortest", "nate-appcreatortest",
- "Nate", "nate+appcreatortest@apigee.com", "password", true,
- false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String expecteAppname = "sandbox";
+ final String expectedName = orgName + "/" + expecteAppname;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortest/sandbox", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
Set<String> rolePerms = setup.getEmf().getEntityManager( appInfo.getId() ).getRolePermissions( "guest" );
assertNotNull( rolePerms );
@@ -76,13 +79,19 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( "appcreatortestcustom",
- "nate-appcreatortestcustom", "Nate", "nate+appcreatortestcustom@apigee.com", "password", true, false );
+
+ final String orgName = "appcreatortest" + newUUIDString();
+ final String appName = "nate-appcreatortest" + newUUIDString();
+ final String sampleAppName = "messagee" ;
+ final String expectedName = orgName + "/" + sampleAppName;
+
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
+ "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
- customCreator.setSampleAppName( "messagee" );
+ customCreator.setSampleAppName(sampleAppName);
ApplicationInfo appInfo = customCreator.createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
- assertEquals( "appcreatortestcustom/messagee", appInfo.getName() );
+ assertEquals( expectedName, appInfo.getName() );
}
}
[10/50] [abbrv] incubator-usergrid git commit: fixed abstract class
name
Posted by sn...@apache.org.
fixed abstract class name
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4bf4d715
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4bf4d715
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4bf4d715
Branch: refs/heads/no-source-in-es
Commit: 4bf4d715fc11877d672541e0aa04714f7f0c2a9d
Parents: e9cecff
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 15:15:00 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 15:15:00 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 4 ++--
.../AbstractServiceNotificationIT.java | 16 +---------------
.../notifications/apns/NotificationsServiceIT.java | 2 --
.../notifications/gcm/NotificationsServiceIT.java | 9 +++++++--
4 files changed, 10 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
index 354aa7b..d9fddd3 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
@@ -24,13 +24,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ArrayBlockingQueue;
/**
* Default queue manager implementation, uses in memory linked queue
*/
public class DefaultQueueManager implements QueueManager {
- public ConcurrentLinkedQueue<QueueMessage> queue = new ConcurrentLinkedQueue<>();
+ public ArrayBlockingQueue<QueueMessage> queue = new ArrayBlockingQueue<>(10000);
@Override
public synchronized List<QueueMessage> getMessages(int limit, int transactionTimeout, int waitTime, Class klass) {
List<QueueMessage> returnQueue = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
index 1fd6f3e..55bb91f 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/AbstractServiceNotificationIT.java
@@ -39,28 +39,14 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-public class AbstractServiceNotificationIT extends AbstractServiceIT {
+public abstract class AbstractServiceNotificationIT extends AbstractServiceIT {
private NotificationsService ns;
- @Rule
- public TestName name = new TestName();
-
- @BeforeClass
- public static void beforeClass() {
- }
-
- @Before
- public void before() throws Exception {
-
- }
-
protected NotificationsService getNotificationService(){
ns = (NotificationsService) app.getSm().getService("notifications");
return ns;
}
-
-
protected Notification scheduleNotificationAndWait(Notification notification)
throws Exception {
long timeout = System.currentTimeMillis() + 60000;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 3b9206e..5fda74b 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -68,11 +68,9 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
}
- @Override
@Before
public void before() throws Exception {
- super.before();
// create apns notifier //
app.clear();
app.put("name", notifierName);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4bf4d715/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index ce0dca7..8d6fb70 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -21,6 +21,7 @@ import org.apache.usergrid.persistence.entities.*;
import org.apache.usergrid.persistence.queue.DefaultQueueManager;
import org.apache.usergrid.services.notifications.*;
import org.junit.*;
+import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +35,7 @@ import static org.apache.usergrid.services.notifications.ApplicationQueueManager
public class NotificationsServiceIT extends AbstractServiceNotificationIT {
+
private static final Logger logger = LoggerFactory
.getLogger(NotificationsServiceIT.class);
@@ -54,15 +56,18 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
private NotificationsService ns;
private QueueListener listener;
+
+
+
+
@BeforeClass
public static void setup(){
+
}
- @Override
@Before
public void before() throws Exception {
- super.before();
// create gcm notifier //
[20/50] [abbrv] incubator-usergrid git commit: add caching to indexes
Posted by sn...@apache.org.
add caching to indexes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/1d2697fc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/1d2697fc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/1d2697fc
Branch: refs/heads/two-dot-o-events
Commit: 1d2697fc967680aa092b42705ffdc688e3579dae
Parents: b545c0e
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 09:50:45 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 09:50:45 2014 -0700
----------------------------------------------------------------------
.../persistence/index/impl/EsIndexCache.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1d2697fc/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
index 710cc60..f418590 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexCache.java
@@ -40,7 +40,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
/**
- * Classy class class.
+ * Cache for Es index operations
*/
@Singleton
public class EsIndexCache {
@@ -66,11 +66,15 @@ public class EsIndexCache {
ImmutableOpenMap<String, List<AliasMetaData>> aliasMap = adminClient.indices().getAliases(new GetAliasesRequest(aliasName)).actionGet().getAliases();
return aliasMap.keys().toArray(String.class);
}
- })
-
- ;
+ }) ;
}
+ /**
+ * Get indexes for an alias
+ * @param alias
+ * @param aliasType
+ * @return
+ */
public String[] getIndexes(IndexIdentifier.IndexAlias alias, AliasedEntityIndex.AliasType aliasType) {
String[] indexes;
try {
@@ -82,6 +86,10 @@ public class EsIndexCache {
return indexes;
}
+ /**
+ * clean up cache
+ * @param alias
+ */
public void invalidate(IndexIdentifier.IndexAlias alias){
aliasIndexCache.invalidate(alias.getWriteAlias());
aliasIndexCache.invalidate(alias.getReadAlias());
[50/50] [abbrv] incubator-usergrid git commit: Merge branch
'two-dot-o' into no-source-in-es
Posted by sn...@apache.org.
Merge branch 'two-dot-o' into no-source-in-es
Conflicts:
stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.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/9044001c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/9044001c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/9044001c
Branch: refs/heads/no-source-in-es
Commit: 9044001c9434a4e16b3a5594ab9d51d82b075e28
Parents: b3c4c41 31bb3f1
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Dec 12 09:28:44 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Dec 12 09:28:44 2014 -0500
----------------------------------------------------------------------
.../main/dist/init_instance/init_rest_server.sh | 18 +-
stack/core/pom.xml | 15 +-
.../corepersistence/CpEntityManagerFactory.java | 4 +-
.../org/apache/usergrid/AbstractCoreIT.java | 12 +-
.../apache/usergrid/ConcurrentCoreITSuite.java | 51 ----
.../usergrid/ConcurrentCoreIteratorITSuite.java | 83 ------
.../usergrid/ConcurrentCoreTestSuite.java | 46 ----
.../java/org/apache/usergrid/CoreITSuite.java | 58 ----
.../java/org/apache/usergrid/CoreTestSuite.java | 45 ----
.../apache/usergrid/batch/SchedulerITSuite.java | 50 ----
.../usergrid/batch/SchedulerTestSuite.java | 34 ---
.../batch/job/AbstractSchedulerRuntimeIT.java | 18 +-
.../apache/usergrid/persistence/CounterIT.java | 6 +-
.../apache/usergrid/persistence/IndexIT.java | 21 +-
.../cassandra/EntityManagerFactoryImplIT.java | 21 +-
.../query/AbstractIteratingQueryIT.java | 15 +-
.../system/UsergridSystemMonitorIT.java | 14 +-
.../persistence/index/AliasedEntityIndex.java | 48 ++++
.../usergrid/persistence/index/EntityIndex.java | 5 -
.../usergrid/persistence/index/IndexFig.java | 2 +
.../index/impl/EsEntityIndexBatchImpl.java | 38 ++-
.../index/impl/EsEntityIndexImpl.java | 44 +--
.../persistence/index/impl/EsIndexCache.java | 114 ++++++++
.../persistence/index/impl/EntityIndexTest.java | 61 ++++-
.../persistence/queue/DefaultQueueManager.java | 68 +++++
stack/loadtests/runtests.sh | 120 +++++++++
.../apache/usergrid/helpers/Extractors.scala | 84 ++++++
.../org/apache/usergrid/helpers/Setup.scala | 30 +--
.../usergrid/scenarios/UserScenarios.scala | 177 +++++++++---
.../org/apache/usergrid/settings/Headers.scala | 6 +-
.../simulations/DeleteUsersSimulation.scala | 56 ++++
.../simulations/GetUserPagesSimulation.scala | 51 ++++
.../simulations/GetUsersSimulation.scala | 51 ++++
.../simulations/PutUsersSimulation.scala | 56 ++++
stack/services/pom.xml | 268 ++++---------------
.../cassandra/ManagementServiceImpl.java | 2 -
.../usergrid/ConcurrentServiceITSuite.java | 60 -----
.../org/apache/usergrid/NewOrgAppAdminRule.java | 159 +++++++++++
.../org/apache/usergrid/ServiceITSuite.java | 64 -----
.../apache/usergrid/management/EmailFlowIT.java | 124 ++++++---
.../usergrid/management/OrganizationIT.java | 36 ++-
.../org/apache/usergrid/management/RoleIT.java | 12 +-
.../cassandra/ApplicationCreatorIT.java | 46 ++--
.../management/cassandra/ExportServiceIT.java | 63 +++--
.../cassandra/ManagementServiceIT.java | 94 ++++---
.../security/providers/FacebookProviderIT.java | 21 +-
.../providers/PingIdentityProviderIT.java | 12 +-
.../security/tokens/TokenServiceIT.java | 55 ++--
.../usergrid/services/AbstractServiceIT.java | 13 +-
.../usergrid/services/ServiceFactoryIT.java | 4 +-
.../usergrid/services/ServiceRequestIT.java | 14 +-
.../usergrid/services/TestQueueManager.java | 65 -----
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
.../java/org/apache/usergrid/TestHelper.java | 75 ++++++
56 files changed, 1627 insertions(+), 1125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9044001c/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9044001c/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
index f7b77fb,d78ed72..60d4e63
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexFig.java
@@@ -112,11 -111,6 +112,13 @@@ public interface IndexFig extends Guicy
@Key( ELASTICSEARCH_FAIL_REFRESH )
int getFailRefreshCount();
+ @Default("2")
+ int getIndexCacheMaxWorkers();
+ @Default( "false" )
+ @Key( ELASTICSEARCH_STORE_SOURCE )
+ boolean getStoreStource();
+
+ @Default( "false" )
+ @Key( ELASTICSEARCH_STORE_FIELDS )
+ boolean getStoreFields();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9044001c/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index a508137,67e1680..4b460da
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@@ -72,8 -69,11 +69,11 @@@ import org.apache.usergrid.persistence.
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
+ import rx.Observable;
+ import rx.functions.Func1;
+ import rx.schedulers.Schedulers;
-import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
+import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.SPLITTER;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.STRING_PREFIX;
@@@ -213,22 -210,12 +211,27 @@@ public class EsEntityIndexImpl implemen
}
}
+ @Override
+ public String[] getIndexes(final AliasType aliasType) {
+ return aliasCache.getIndexes(alias,aliasType);
+ }
+
+ @Override
+ public void updateMappings() {
+ try {
+ // index may not exist yet, that's fine
+ initializeIndex();
+
+ // create mappings does a PUT, that works for updating mappings
+ createMappings();
+
+ } catch (IOException e) {
+ throw new RuntimeException( "Unable to update mappings", e );
+ }
+ }
+
+
/**
* Tests writing a document to a new index to ensure it's working correctly. See this post:
* http://s.apache.org/index-missing-exception
[05/50] [abbrv] incubator-usergrid git commit: fix apns
Posted by sn...@apache.org.
fix apns
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/62249154
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/62249154
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/62249154
Branch: refs/heads/no-source-in-es
Commit: 622491547fe0ea42a7c7bbd63611c804023caa7f
Parents: 461c192
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 12:34:14 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 12:34:14 2014 -0700
----------------------------------------------------------------------
.../services/notifications/apns/NotificationsServiceIT.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/62249154/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 3f42777..3b9206e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -191,8 +191,8 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
entity = results.getEntitiesMap().get(notification.getUuid());
assertNotNull(entity);
- checkReceipts(notification, 1);
- checkStatistics(notification, 1, 0);
+ checkReceipts(notification, 2);
+ checkStatistics(notification, 2, 0);
}
@Test
@@ -579,7 +579,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
app.getEntityManager().refreshIndex();
- checkReceipts(notification, 1);
+ checkReceipts(notification, 2);
}
@Ignore("todo: how can I mock this?")
[24/50] [abbrv] incubator-usergrid git commit: move method back to
entityindex
Posted by sn...@apache.org.
move method back to entityindex
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/18197e3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/18197e3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/18197e3d
Branch: refs/heads/two-dot-o-events
Commit: 18197e3de65c29db764218534f846d825bcb4b0f
Parents: 574fe64
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 16:02:14 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 16:02:14 2014 -0700
----------------------------------------------------------------------
.../usergrid/corepersistence/CpEntityManagerFactory.java | 4 +---
.../apache/usergrid/persistence/index/AliasedEntityIndex.java | 7 -------
.../org/apache/usergrid/persistence/index/EntityIndex.java | 7 +++++++
3 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 56eb258..7016d3c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -704,9 +704,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
@Override
public void addIndex(final UUID applicationId,final String indexSuffix,final int shards,final int replicas){
EntityIndex entityIndex = getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(applicationId));
- if(entityIndex instanceof AliasedEntityIndex) {
- ((AliasedEntityIndex)entityIndex).addIndex(indexSuffix, shards, replicas);
- }
+ entityIndex.addIndex(indexSuffix, shards, replicas);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
index 15a0d45..118b7ad 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
@@ -38,13 +38,6 @@ public interface AliasedEntityIndex extends EntityIndex{
*/
public void addAlias(final String indexSuffix);
- /**
- * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
- * @param indexSuffix index name
- * @param shards
- * @param replicas
- */
- public void addIndex(final String indexSuffix, final int shards, final int replicas);
/**
* type of alias
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index 549f87e..f1da568 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -38,6 +38,13 @@ public interface EntityIndex {
*/
public void initializeIndex();
+ /**
+ * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
+ * @param indexSuffix index name
+ * @param shards
+ * @param replicas
+ */
+ public void addIndex(final String indexSuffix, final int shards, final int replicas);
/**
* Create the index batch.
[23/50] [abbrv] incubator-usergrid git commit: move method back to
entityindex
Posted by sn...@apache.org.
move method back to entityindex
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/18197e3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/18197e3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/18197e3d
Branch: refs/heads/no-source-in-es
Commit: 18197e3de65c29db764218534f846d825bcb4b0f
Parents: 574fe64
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Dec 9 16:02:14 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Dec 9 16:02:14 2014 -0700
----------------------------------------------------------------------
.../usergrid/corepersistence/CpEntityManagerFactory.java | 4 +---
.../apache/usergrid/persistence/index/AliasedEntityIndex.java | 7 -------
.../org/apache/usergrid/persistence/index/EntityIndex.java | 7 +++++++
3 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 56eb258..7016d3c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -704,9 +704,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
@Override
public void addIndex(final UUID applicationId,final String indexSuffix,final int shards,final int replicas){
EntityIndex entityIndex = getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(applicationId));
- if(entityIndex instanceof AliasedEntityIndex) {
- ((AliasedEntityIndex)entityIndex).addIndex(indexSuffix, shards, replicas);
- }
+ entityIndex.addIndex(indexSuffix, shards, replicas);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
index 15a0d45..118b7ad 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
@@ -38,13 +38,6 @@ public interface AliasedEntityIndex extends EntityIndex{
*/
public void addAlias(final String indexSuffix);
- /**
- * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
- * @param indexSuffix index name
- * @param shards
- * @param replicas
- */
- public void addIndex(final String indexSuffix, final int shards, final int replicas);
/**
* type of alias
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/18197e3d/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index 549f87e..f1da568 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -38,6 +38,13 @@ public interface EntityIndex {
*/
public void initializeIndex();
+ /**
+ * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
+ * @param indexSuffix index name
+ * @param shards
+ * @param replicas
+ */
+ public void addIndex(final String indexSuffix, final int shards, final int replicas);
/**
* Create the index batch.
[14/50] [abbrv] incubator-usergrid git commit: merge
Posted by sn...@apache.org.
merge
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/21630f49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/21630f49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/21630f49
Branch: refs/heads/no-source-in-es
Commit: 21630f498e7f59cd760e0fd2cd69c1f38de25f45
Parents: 8cdfaf9 a63b856
Author: Shawn Feldman <sf...@apache.org>
Authored: Mon Dec 8 17:23:52 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Mon Dec 8 17:23:52 2014 -0700
----------------------------------------------------------------------
.../corepersistence/CpEntityManager.java | 230 ++++++++++---------
.../corepersistence/CpEntityManagerFactory.java | 6 +-
.../corepersistence/util/CpEntityMapUtils.java | 32 ++-
.../batch/job/SchedulerRuntimeIntervalIT.java | 49 ++--
.../migration/EntityDataMigrationIT.java | 139 +++++------
.../migration/EntityTypeMappingMigrationIT.java | 89 +++----
.../apache/usergrid/persistence/CounterIT.java | 89 ++++---
.../usergrid/persistence/CountingMutatorIT.java | 4 +-
.../persistence/EntityDictionaryIT.java | 11 +-
.../usergrid/persistence/EntityManagerIT.java | 47 ++--
.../persistence/GeoQueryBooleanTest.java | 7 +-
.../apache/usergrid/persistence/IndexIT.java | 14 +-
.../usergrid/persistence/PathQueryIT.java | 10 +-
.../PerformanceEntityRebuildIndexTest.java | 6 +-
.../usergrid/persistence/PermissionsIT.java | 5 +-
.../cassandra/EntityManagerFactoryImplIT.java | 9 +-
.../query/AbstractIteratingQueryIT.java | 3 +-
stack/core/src/test/resources/log4j.properties | 5 +-
.../data/DataMigrationManagerImpl.java | 29 ++-
.../persistence/index/AliasedEntityIndex.java | 55 +++++
.../usergrid/persistence/index/EntityIndex.java | 26 ---
.../persistence/index/IndexIdentifier.java | 4 +
.../index/impl/EsEntityIndexBatchImpl.java | 6 +-
.../index/impl/EsEntityIndexImpl.java | 88 ++++---
.../persistence/index/impl/EntityIndexTest.java | 15 +-
.../persistence/queue/DefaultQueueManager.java | 68 ++++++
.../usergrid/services/TestQueueManager.java | 65 ------
.../AbstractServiceNotificationIT.java | 16 +-
.../apns/NotificationsServiceIT.java | 12 +-
.../gcm/NotificationsServiceIT.java | 15 +-
30 files changed, 647 insertions(+), 507 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/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 f6b0df8,f6b0df8..56eb258
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@@ -64,6 -64,6 +64,7 @@@ import org.apache.usergrid.persistence.
import org.apache.usergrid.persistence.graph.GraphManagerFactory;
import org.apache.usergrid.persistence.graph.SearchByEdgeType;
import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
++import org.apache.usergrid.persistence.index.AliasedEntityIndex;
import org.apache.usergrid.persistence.index.EntityIndex;
import org.apache.usergrid.persistence.index.EntityIndexFactory;
import org.apache.usergrid.persistence.index.query.Query;
@@@ -702,7 -702,7 +703,10 @@@ public class CpEntityManagerFactory imp
@Override
public void addIndex(final UUID applicationId,final String indexSuffix,final int shards,final int replicas){
-- getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope( applicationId )).addIndex(indexSuffix,shards,replicas);
++ EntityIndex entityIndex = getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(applicationId));
++ if(entityIndex instanceof AliasedEntityIndex) {
++ ((AliasedEntityIndex)entityIndex).addIndex(indexSuffix, shards, replicas);
++ }
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
index 0000000,0000000..15a0d45
new file mode 100644
--- /dev/null
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/AliasedEntityIndex.java
@@@ -1,0 -1,0 +1,55 @@@
++/*
++ *
++ * * 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.persistence.index;
++
++/**
++ * EntityIndex with aliases for multiple indexes
++ */
++public interface AliasedEntityIndex extends EntityIndex{
++
++ /**
++ * Get the indexes for an alias
++ * @param aliasType name of alias
++ * @return list of index names
++ */
++ public String[] getIndexes(final AliasType aliasType);
++
++ /**
++ * Add alias to index, will remove old index from write alias
++ * @param indexSuffix must be different than current index
++ */
++ public void addAlias(final String indexSuffix);
++
++ /**
++ * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
++ * @param indexSuffix index name
++ * @param shards
++ * @param replicas
++ */
++ public void addIndex(final String indexSuffix, final int shards, final int replicas);
++
++ /**
++ * type of alias
++ */
++ public enum AliasType {
++ Read, Write
++ }
++}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index f38a390,4a653b3..549f87e
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@@ -38,31 -38,24 +38,12 @@@ public interface EntityIndex
*/
public void initializeIndex();
-- /**
-- * Create an index and add to alias, will create alias and remove any old index from write alias if alias already exists
-- * @param indexSuffix index name
-- * @param shards
-- * @param replicas
-- */
-- public void addIndex(final String indexSuffix, final int shards, final int replicas);
-
- /**
- * Get the indexes for an alias
- * @param aliasName name of alias
- * @return list of index names
- */
- public String[] getIndexes(final AliasType aliasType);
/**
* Create the index batch.
*/
public EntityIndexBatch createBatch();
-- /**
-- * Add alias to index, will remove old index from write alias
-- * @param indexSuffix must be different than current index
-- */
-- public void addAlias(final String indexSuffix);
/**
* Execute query in Usergrid syntax.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index f2cbc6b,a3ca8a5..0d0e52b
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@@ -94,11 -92,9 +94,11 @@@ public class EsEntityIndexBatchImpl imp
private final FailureMonitor failureMonitor;
- private final EntityIndex entityIndex;
++ private final AliasedEntityIndex entityIndex;
+
public EsEntityIndexBatchImpl( final ApplicationScope applicationScope, final Client client,
- final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor, final EntityIndex entityIndex ) {
- final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor ) {
++ final IndexFig config, final int autoFlushSize, final FailureMonitor failureMonitor, final AliasedEntityIndex entityIndex ) {
this.applicationScope = applicationScope;
this.client = client;
@@@ -186,30 -181,9 +186,30 @@@
log.debug( "De-indexing type {} with documentId '{}'" , entityType, indexId);
- String[] indexes = entityIndex.getIndexes(EntityIndex.AliasType.Read);
-
- bulkRequest.add( client.prepareDelete(alias.getWriteAlias(), entityType, indexId ).setRefresh( refresh ) );
-
++ String[] indexes = entityIndex.getIndexes(AliasedEntityIndex.AliasType.Read);
+ //get the default index if no alias exists yet
+ if(indexes == null ||indexes.length == 0){
+ indexes = new String[]{indexIdentifier.getIndex(null)};
+ }
+ final AtomicInteger errorCount = new AtomicInteger();
+ //get all indexes then flush everyone
+ Observable.from(indexes).subscribeOn(Schedulers.io())
+ .map(new Func1<String, Object>() {
+ @Override
+ public Object call(String index) {
+ try {
+ bulkRequest.add(client.prepareDelete(index, entityType, indexId).setRefresh(refresh));
+ }catch (Exception e){
+ log.error("failed to deindex",e);
+ errorCount.incrementAndGet();
+ }
+ return index;
+ }
+ }).toBlocking().last();
+
+ if(errorCount.get()>0){
+ log.error("Failed to flush some indexes");
+ }
log.debug( "Deindexed Entity with index id " + indexId );
maybeFlush();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index 5824c38,eb050d6..4bca8c2
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@@ -73,6 -72,6 +72,9 @@@ import org.apache.usergrid.persistence.
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
++import rx.Observable;
++import rx.functions.Func1;
++import rx.schedulers.Schedulers;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.BOOLEAN_PREFIX;
import static org.apache.usergrid.persistence.index.impl.IndexingUtils.NUMBER_PREFIX;
@@@ -83,7 -82,7 +85,7 @@@ import static org.apache.usergrid.persi
/**
* Implements index using ElasticSearch Java API.
*/
--public class EsEntityIndexImpl implements EntityIndex {
++public class EsEntityIndexImpl implements AliasedEntityIndex {
private static final Logger logger = LoggerFactory.getLogger( EsEntityIndexImpl.class );
@@@ -178,18 -184,27 +187,24 @@@
Boolean isAck;
String indexName = indexIdentifier.getIndex(indexSuffix);
final AdminClient adminClient = esProvider.getClient().admin();
+
- //remove write alias, can only have one
- ImmutableOpenMap<String,List<AliasMetaData>> aliasMap = adminClient.indices()
- .getAliases(new GetAliasesRequest(alias.getWriteAlias())).actionGet().getAliases();
- String[] indexNames = aliasMap.keys().toArray(String.class);
+ String[] indexNames = getIndexes(alias.getWriteAlias());
for(String currentIndex : indexNames){
- isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,alias.getWriteAlias()).execute().actionGet().isAcknowledged();
- logger.info("Removed Index Name [{}] from Alias=[{}] ACK=[{}]",currentIndex, alias, isAck);
+ isAck = adminClient.indices().prepareAliases().removeAlias(currentIndex,
+ alias.getWriteAlias()).execute().actionGet().isAcknowledged();
+ logger.info("Removed Index Name [{}] from Alias=[{}] ACK=[{}]",currentIndex, alias, isAck);
}
+
//add read alias
- isAck = adminClient.indices().prepareAliases().addAlias(indexName, alias.getReadAlias()).execute().actionGet().isAcknowledged();
+ isAck = adminClient.indices().prepareAliases().addAlias(
+ indexName, alias.getReadAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new read Alias Name [{}] ACK=[{}]", alias, isAck);
+
//add write alias
- isAck = adminClient.indices().prepareAliases().addAlias(indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
+ isAck = adminClient.indices().prepareAliases().addAlias(
+ indexName, alias.getWriteAlias()).execute().actionGet().isAcknowledged();
logger.info("Created new write Alias Name [{}] ACK=[{}]", alias, isAck);
} catch (Exception e) {
@@@ -233,17 -231,19 +248,19 @@@
public boolean doOp() {
final String tempId = UUIDGenerator.newTimeUUID().toString();
- esProvider.getClient().prepareIndex( alias.getWriteAlias(), VERIFY_TYPE, tempId ).setSource( DEFAULT_PAYLOAD )
- .get();
+ esProvider.getClient().prepareIndex( alias.getWriteAlias(), VERIFY_TYPE, tempId )
- .setSource( DEFAULT_PAYLOAD ).get();
++ .setSource(DEFAULT_PAYLOAD).get();
- logger.info( "Successfully created new document with docId {} in index {} and type {}", tempId,
- alias, VERIFY_TYPE );
+ logger.info( "Successfully created new document with docId {} "
+ + "in index {} and type {}", tempId, alias, VERIFY_TYPE );
// delete all types, this way if we miss one it will get cleaned up
- esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() ).setTypes(VERIFY_TYPE)
- .setQuery( MATCH_ALL_QUERY_BUILDER ).get();
+ esProvider.getClient().prepareDeleteByQuery( alias.getWriteAlias() )
+ .setTypes(VERIFY_TYPE)
- .setQuery( MATCH_ALL_QUERY_BUILDER ).get();
++ .setQuery(MATCH_ALL_QUERY_BUILDER).get();
- logger.info( "Successfully deleted all documents in index {} and type {}", alias, VERIFY_TYPE );
+ logger.info( "Successfully deleted all documents in index {} and type {}",
+ alias, VERIFY_TYPE );
return true;
@@@ -440,7 -440,8 +457,15 @@@
@Override
public boolean doOp() {
try {
- esProvider.getClient().admin().indices().prepareRefresh( alias.getReadAlias() ).execute().actionGet();
- esProvider.getClient().admin().indices().prepareRefresh( alias.getWriteAlias() )
- .execute().actionGet();
++ String[] indexes = getIndexes(AliasType.Read);
++ Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
++ @Override
++ public String call(String index) {
++ esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();
++ return index;
++ }
++ });
++
logger.debug( "Refreshed index: " + alias);
return true;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/21630f49/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 47c4dbd,13d1552..fd94985
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@@ -25,7 -25,6 +25,8 @@@ import java.util.LinkedHashMap
import java.util.List;
import java.util.Map;
++import org.apache.usergrid.persistence.index.*;
+import org.apache.usergrid.persistence.index.query.CandidateResult;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@@ -38,11 -37,11 +39,6 @@@ import org.apache.usergrid.persistence.
import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
import org.apache.usergrid.persistence.core.test.UseModules;
import org.apache.usergrid.persistence.core.util.Health;
--import org.apache.usergrid.persistence.index.EntityIndex;
--import org.apache.usergrid.persistence.index.EntityIndexBatch;
--import org.apache.usergrid.persistence.index.EntityIndexFactory;
--import org.apache.usergrid.persistence.index.IndexScope;
--import org.apache.usergrid.persistence.index.SearchTypes;
import org.apache.usergrid.persistence.index.guice.TestIndexModule;
import org.apache.usergrid.persistence.index.query.CandidateResults;
import org.apache.usergrid.persistence.index.query.Query;
@@@ -115,7 -114,7 +111,7 @@@ public class EntityIndexTest extends Ba
ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
-- EntityIndex entityIndex = eif.createEntityIndex( applicationScope );
++ AliasedEntityIndex entityIndex =(AliasedEntityIndex) eif.createEntityIndex( applicationScope );
entityIndex.initializeIndex();
final String entityType = "thing";
@@@ -140,41 -139,6 +136,42 @@@
testQuery(indexScope, searchTypes, entityIndex, "name = 'Lowe Kelley'", 1 );
}
+ @Test
+ public void testDeleteByQueryWithAlias() throws IOException {
+ Id appId = new SimpleId( "application" );
+
+ ApplicationScope applicationScope = new ApplicationScopeImpl( appId );
+
- EntityIndex entityIndex = eif.createEntityIndex(applicationScope);
++ AliasedEntityIndex entityIndex =(AliasedEntityIndex) eif.createEntityIndex( applicationScope );
++
+ entityIndex.initializeIndex();
+
+ final String entityType = "thing";
+ IndexScope indexScope = new IndexScopeImpl( appId, "things" );
+ final SearchTypes searchTypes = SearchTypes.fromTypes( entityType );
+
+ insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json",1,0);
+
+ entityIndex.refresh();
+
- entityIndex.addIndex("v2", 1,0);
++ entityIndex.addIndex("v2", 1, 0);
+
- insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json",1,0);
++ insertJsonBlob(entityIndex, entityType, indexScope, "/sample-large.json", 1, 0);
+
+ entityIndex.refresh();
+ CandidateResults crs = testQuery(indexScope, searchTypes, entityIndex, "name = 'Bowers Oneil'", 2);
+
+ EntityIndexBatch entityIndexBatch = entityIndex.createBatch();
+ entityIndexBatch.deindex(indexScope, crs.get(0));
+ entityIndexBatch.deindex(indexScope, crs.get(1));
+ entityIndexBatch.executeAndRefresh();
+ entityIndex.refresh();
+
+ //Hilda Youn
+ testQuery(indexScope, searchTypes, entityIndex, "name = 'Bowers Oneil'", 0);
+
+ }
+
private void insertJsonBlob(EntityIndex entityIndex, String entityType, IndexScope indexScope, String filePath,final int max,final int startIndex) throws IOException {
InputStream is = this.getClass().getResourceAsStream( filePath );
ObjectMapper mapper = new ObjectMapper();
[11/50] [abbrv] incubator-usergrid git commit: Merge remote-tracking
branch 'origin/usergrid-269' into two-dot-o
Posted by sn...@apache.org.
Merge remote-tracking branch 'origin/usergrid-269' into two-dot-o
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a63b856e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a63b856e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a63b856e
Branch: refs/heads/two-dot-o-events
Commit: a63b856e90e33e4b93f35bfcaeb02552a7acc4a0
Parents: e29a99e 4bf4d71
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Dec 8 15:17:25 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Dec 8 15:17:25 2014 -0700
----------------------------------------------------------------------
.../persistence/queue/DefaultQueueManager.java | 68 ++++++++++++++++++++
.../usergrid/services/TestQueueManager.java | 65 -------------------
.../AbstractServiceNotificationIT.java | 16 +----
.../apns/NotificationsServiceIT.java | 12 ++--
.../gcm/NotificationsServiceIT.java | 15 +++--
5 files changed, 84 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
[37/50] [abbrv] incubator-usergrid git commit: Fixes
ManagementServiceIT
Posted by sn...@apache.org.
Fixes ManagementServiceIT
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/7ffe1ac7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/7ffe1ac7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/7ffe1ac7
Branch: refs/heads/two-dot-o-events
Commit: 7ffe1ac7a5a91bd6c603124953a33519e729c683
Parents: cfff0cc
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 13:13:45 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 13:13:45 2014 -0700
----------------------------------------------------------------------
.../cassandra/ManagementServiceIT.java | 79 +++++++++++++-------
1 file changed, 52 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7ffe1ac7/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 4288d99..14a34b4 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
@@ -30,6 +31,7 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.usergrid.NewOrgAppAdminRule;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
import org.apache.usergrid.cassandra.CassandraResource;
@@ -52,6 +54,7 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
+import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -66,33 +69,43 @@ import static org.junit.Assert.assertTrue;
public class ManagementServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ManagementServiceIT.class );
+
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts();
+
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
- // app-level data generated only once
- private static UserInfo adminUser;
- private static OrganizationInfo organization;
- private static UUID applicationId;
+ @ClassRule
+ public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+
@Rule
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
- @ClassRule
- public static final ServiceITSetup setup = new ServiceITSetupImpl( cassandraResource, elasticSearchResource );
+ @Rule
+ public NewOrgAppAdminRule orgAppAdminRule = new NewOrgAppAdminRule( setup );
+
+
+ // app-level data generated only once
+ private UserInfo adminUser;
+ private UUID applicationId;
- @BeforeClass
- public static void setup() throws Exception {
+ @Before
+ public void setup() throws Exception {
LOG.info( "in setup" );
- adminUser = setup.getMgmtSvc().createAdminUser( "edanuff", "Ed Anuff", "ed@anuff.com", "test", false, false );
- organization = setup.getMgmtSvc().createOrganization( "ed-organization", adminUser, true );
- applicationId = setup.getMgmtSvc().createApplication( organization.getUuid(), "ed-application" ).getId();
+
+
+ adminUser = orgAppAdminRule.getAdminInfo();
+ applicationId = orgAppAdminRule.getApplicationInfo().getId();
+
+ setup.getEmf().refreshIndex();
}
+
@Test
public void testGetTokenForPrincipalAdmin() throws Exception {
String token = ( ( ManagementServiceImpl ) setup.getMgmtSvc() )
@@ -140,15 +153,27 @@ public class ManagementServiceIT {
batcher.setBlockingSubmit( true );
batcher.setBatchSize( 1 );
- setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
-
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
Map<String, Long> counts = em.getApplicationCounters();
LOG.info( JsonUtils.mapToJsonString( counts ) );
LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
assertNotNull( counts.get( "admin_logins" ) );
- assertEquals( 1, counts.get( "admin_logins" ).intValue() );
+
+ final long startCount = counts.get( "admin_logins" );
+
+
+ setup.getMgmtSvc().countAdminUserAction( adminUser, "login" );
+
+
+ counts = em.getApplicationCounters();
+ LOG.info( JsonUtils.mapToJsonString( counts ) );
+ LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) );
+ assertNotNull( counts.get( "admin_logins" ) );
+
+ final long newCount = counts.get( "admin_logins" );
+
+ assertEquals( 1l, newCount - startCount );
}
@@ -461,11 +486,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", UUID.randomUUID() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -490,7 +515,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType";
+ String username = "testAdminPasswordChangeShaType"+newUUIDString();
String password = "test";
@@ -547,7 +572,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType";
+ String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
String password = "test";
@@ -610,10 +635,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "autneticateUser";
- String appName = "authenticateUser";
+ String orgName = "autneticateUser"+newUUIDString();
+ String appName = "authenticateUser"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -654,10 +679,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeShaType";
- String appName = "testAppUserPasswordChangeShaType";
+ String orgName = "testAppUserPasswordChangeShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -713,10 +738,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine";
+ String username = "tnine"+newUUIDString();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType";
- String appName = "testAppUserPasswordChangeMd5ShaType";
+ String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
UUID appId = setup.getEmf().createApplication( orgName, appName );
[42/50] [abbrv] incubator-usergrid git commit: Fixes EmailFlowIT and
creates utilities for testing.
Posted by sn...@apache.org.
Fixes EmailFlowIT and creates utilities for testing.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bb05616a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bb05616a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bb05616a
Branch: refs/heads/no-source-in-es
Commit: bb05616aafd3023b096dd929a120d02e782f3124
Parents: f0a9870
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 10 16:14:28 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 10 16:20:52 2014 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/NewOrgAppAdminRule.java | 3 +-
.../apache/usergrid/management/EmailFlowIT.java | 109 +++++++++++++------
.../cassandra/ApplicationCreatorIT.java | 23 ++--
.../management/cassandra/ExportServiceIT.java | 17 ++-
.../cassandra/ManagementServiceIT.java | 27 +++--
.../java/org/apache/usergrid/TestHelper.java | 75 +++++++++++++
.../org/apache/usergrid/UUIDTestHelper.java | 38 -------
7 files changed, 189 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
index 71a4740..ab7857e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
+++ b/stack/services/src/test/java/org/apache/usergrid/NewOrgAppAdminRule.java
@@ -32,9 +32,8 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.management.UserInfo;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
/**
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
index 719fd86..f831448 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/EmailFlowIT.java
@@ -51,6 +51,11 @@ import org.apache.usergrid.persistence.entities.User;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import static org.apache.commons.lang.StringUtils.isNotBlank;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_ACTIVATED;
import static org.apache.usergrid.management.AccountCreationProps.PROPERTIES_EMAIL_ADMIN_CONFIRMATION;
@@ -87,8 +92,6 @@ import static org.junit.Assert.assertTrue;
*/
public class EmailFlowIT {
private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
- private static final String ORGANIZATION_NAME = "email-test-org-1";
- public static final String ORGANIZATION_NAME_2 = "email-test-org-2";
@ClassRule
public static CassandraResource cassandraResource = CassandraResource.newWithAvailablePorts( );
@@ -114,12 +117,17 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-1@mockserver.com" );
setup.set( PROPERTIES_NOTIFY_ADMIN_OF_ACTIVATION, "true" );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo org_owner =
- createOwnerAndOrganization( ORGANIZATION_NAME, "test-user-1", "Test User", "test-user-1@mockserver.com",
- "testpassword", false, false );
+ createOwnerAndOrganization( orgName, userName, "Test User", email, "testpassword", false, false );
+
+
assertNotNull( org_owner );
- List<Message> inbox = Mailbox.get( "test-user-1@mockserver.com" );
+ List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
@@ -127,7 +135,7 @@ public class EmailFlowIT {
client.processMail();
Message confirmation = inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-1@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: " + email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -151,16 +159,23 @@ public class EmailFlowIT {
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "true" );
setup.set( PROPERTIES_SYSADMIN_EMAIL, "sysadmin-2@mockserver.com" );
- OrganizationOwnerInfo org_owner = createOwnerAndOrganization( ORGANIZATION_NAME_2, "test-user-2", "Test User",
- "test-user-2@mockserver.com", "testpassword", false, false );
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
+ OrganizationOwnerInfo org_owner =
+ createOwnerAndOrganization( orgName, userName, "Test User", email,
+ "testpassword", false, false );
+
assertNotNull( org_owner );
- List<Message> user_inbox = Mailbox.get( "test-user-2@mockserver.com" );
+
+ List<Message> user_inbox = Mailbox.get( email );
assertFalse( user_inbox.isEmpty() );
Message confirmation = user_inbox.get( 0 );
- assertEquals( "User Account Confirmation: test-user-2@mockserver.com", confirmation.getSubject() );
+ assertEquals( "User Account Confirmation: "+email, confirmation.getSubject() );
String token = getTokenFromMessage( confirmation );
LOG.info( token );
@@ -181,7 +196,7 @@ public class EmailFlowIT {
assertFalse( sysadmin_inbox.isEmpty() );
Message activation = sysadmin_inbox.get( 0 );
- assertEquals( "Request For Admin User Account Activation test-user-2@mockserver.com", activation.getSubject() );
+ assertEquals( "Request For Admin User Account Activation "+email, activation.getSubject() );
token = getTokenFromMessage( activation );
LOG.info( token );
@@ -204,10 +219,14 @@ public class EmailFlowIT {
setup.set( PROPERTIES_SYSADMIN_APPROVES_ADMIN_USERS, "false" );
setup.set( PROPERTIES_ADMIN_USERS_REQUIRE_CONFIRMATION, "false" );
+
+ final String orgName = uniqueOrg();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+
OrganizationOwnerInfo ooi = setup.getMgmtSvc()
- .createOwnerAndOrganization( "org-skipallemailtest", "user-skipallemailtest",
- "name-skipallemailtest", "nate+skipallemailtest@apigee.com",
- "password" );
+ .createOwnerAndOrganization(orgName, userName, "Test User", email,
+ "testpassword");
EntityManager em = setup.getEmf().getEntityManager( setup.getEmf().getManagementAppId() );
User user = em.get( ooi.getOwner().getUuid(), User.class );
@@ -234,23 +253,36 @@ public class EmailFlowIT {
}
+ /**
+ * Tests that when a user is added to an app and activation on that app is required, the org admin is emailed
+ * @throws Exception
+ *
+ * TODO, I'm not convinced this worked correctly. IT can't find users collection in the orgs. Therefore,
+ * I think this is a legitimate bug that was just found from fixing the tests to be unique admins orgs and emails
+ */
@Test
public void testAppUserActivationResetpwdMail() throws Exception {
- String orgName = this.getClass().getName() + "1";
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-4@mockserver.com";
- String passwd = "testpassword";
- OrganizationOwnerInfo orgOwner;
- orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+ OrganizationOwnerInfo orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
assertNotNull( orgOwner );
ApplicationInfo app = setup.getMgmtSvc().createApplication( orgOwner.getOrganization().getUuid(), appName );
+
+ //turn on app admin approval for app users
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserMailUrl", "testAppUserMailUrl@test.com", false );
- String subject = "Request For User Account Activation testAppUserMailUrl@test.com";
+ final String appUserUsername = uniqueUsername();
+ final String appUserEmail = uniqueEmail();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, false );
+
+ String subject = "Request For User Account Activation " + email;
String activation_url = String.format( setup.get( PROPERTIES_USER_ACTIVATION_URL ), orgName, appName,
user.getUuid().toString() );
@@ -261,7 +293,7 @@ public class EmailFlowIT {
List<Message> inbox = Mailbox.get( email );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "usergrid.com", "test", "somepassword" );
+ MockImapClient client = new MockImapClient( "usergrid.com", userName, "somepassword" );
client.processMail();
// subject ok
@@ -287,9 +319,9 @@ public class EmailFlowIT {
// reset_pwd
setup.getMgmtSvc().startAppUserPasswordResetFlow( app.getId(), user );
- inbox = Mailbox.get( "testAppUserMailUrl@test.com" );
+ inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- client = new MockImapClient( "test.com", "testAppUserMailUrl", "somepassword" );
+ client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
@@ -315,11 +347,13 @@ public class EmailFlowIT {
/** Tests to make sure a normal user must be activated by the admin after confirmation. */
@Test
public void testAppUserConfirmationMail() throws Exception {
- String orgName = this.getClass().getName();
- String appName = name.getMethodName();
- String userName = "Test User";
- String email = "test-user-45@mockserver.com";
- String passwd = "testpassword";
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+ final String userName = uniqueUsername();
+ final String email = uniqueEmail();
+ final String passwd = "testpassword";
+
+
OrganizationOwnerInfo orgOwner;
orgOwner = createOwnerAndOrganization( orgName, appName, userName, email, passwd, false, false );
@@ -331,18 +365,23 @@ public class EmailFlowIT {
assertNotNull( app );
enableEmailConfirmation( app.getId() );
enableAdminApproval( app.getId() );
- User user = setupAppUser( app.getId(), "testAppUserConfMail", "testAppUserConfMail@test.com", true );
- String subject = "User Account Confirmation: testAppUserConfMail@test.com";
+
+ final String appUserEmail = uniqueEmail();
+ final String appUserUsername = uniqueUsername();
+
+ User user = setupAppUser( app.getId(), appUserUsername, appUserEmail, true );
+
+ String subject = "User Account Confirmation: "+appUserEmail;
String urlProp = setup.get( PROPERTIES_USER_CONFIRMATION_URL );
String confirmation_url = String.format( urlProp, orgName, appName, user.getUuid().toString() );
// request confirmation
setup.getMgmtSvc().startAppUserActivationFlow( app.getId(), user );
- List<Message> inbox = Mailbox.get( "testAppUserConfMail@test.com" );
+ List<Message> inbox = Mailbox.get( appUserEmail );
assertFalse( inbox.isEmpty() );
- MockImapClient client = new MockImapClient( "test.com", "testAppUserConfMail", "somepassword" );
+ MockImapClient client = new MockImapClient( "test.com", appUserUsername, "somepassword" );
client.processMail();
// subject ok
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
index a3eaa08..0fbeb7d 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ApplicationCreatorIT.java
@@ -22,8 +22,6 @@ import java.util.Set;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.usergrid.ServiceITSetup;
import org.apache.usergrid.ServiceITSetupImpl;
@@ -34,7 +32,10 @@ import org.apache.usergrid.management.ApplicationInfo;
import org.apache.usergrid.management.OrganizationOwnerInfo;
import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -59,13 +60,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplication() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String expecteAppname = "sandbox";
final String expectedName = orgName + "/" + expecteAppname;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortest" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationInfo appInfo = setup.getAppCreator().createSampleFor( orgOwner.getOrganization() );
assertNotNull( appInfo );
@@ -80,13 +81,13 @@ public class ApplicationCreatorIT {
@Test
public void testCreateSampleApplicationAltName() throws Exception {
- final String orgName = "appcreatortest" + newUUIDString();
- final String appName = "nate-appcreatortest" + newUUIDString();
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
final String sampleAppName = "messagee" ;
final String expectedName = orgName + "/" + sampleAppName;
- OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, "Nate",
- "nate+appcreatortestcustom" + newUUIDString() + "@apigee.com", "password", true, false );
+ OrganizationOwnerInfo orgOwner = setup.getMgmtSvc().createOwnerAndOrganization( orgName, appName, uniqueUsername(),
+ uniqueEmail(), "password", true, false );
ApplicationCreatorImpl customCreator = new ApplicationCreatorImpl( setup.getEmf(), setup.getMgmtSvc() );
customCreator.setSampleAppName(sampleAppName);
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
index 2c64836..53de224 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ExportServiceIT.java
@@ -66,7 +66,9 @@ import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -345,9 +347,11 @@ public class ExportServiceIT {
@Test
public void testExportOneAppOnCollectionEndpoint() throws Exception {
+ final String orgName = uniqueOrg();
+ final String appName = uniqueApp();
+
+
File f = null;
- String orgName = "george-organization"+newUUIDString();
- String appName = "testAppCollectionTestNotExported"+newUUIDString();
try {
f = new File( "exportOneApp.json" );
@@ -616,11 +620,14 @@ public class ExportServiceIT {
HashMap<String, Object> payload = payloadBuilder();
//creates 100s of organizations with some entities in each one to make sure we don't actually apply it
+ final String uniqueOrg = uniqueOrg();
+ final String uniqueApp = uniqueApp();
+
OrganizationInfo orgMade = null;
ApplicationInfo appMade = null;
for ( int i = 0; i < 10; i++ ) {
- orgMade = setup.getMgmtSvc().createOrganization( "superboss"+ newUUIDString() + i, adminUser, true );
- appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), "superapp" +newUUIDString() + i );
+ orgMade = setup.getMgmtSvc().createOrganization(uniqueOrg + i, adminUser, true );
+ appMade = setup.getMgmtSvc().createApplication( orgMade.getUuid(), uniqueApp + i );
EntityManager customMaker = setup.getEmf().getEntityManager( appMade.getId() );
customMaker.createApplicationCollection( "superappCol" + i );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
index 14a34b4..ddb2bbb 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ManagementServiceIT.java
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.UUID;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
@@ -54,7 +53,11 @@ import org.apache.usergrid.utils.JsonUtils;
import org.apache.usergrid.utils.UUIDUtils;
import static org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString;
-import static org.apache.usergrid.UUIDTestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.newUUIDString;
+import static org.apache.usergrid.TestHelper.uniqueApp;
+import static org.apache.usergrid.TestHelper.uniqueEmail;
+import static org.apache.usergrid.TestHelper.uniqueOrg;
+import static org.apache.usergrid.TestHelper.uniqueUsername;
import static org.apache.usergrid.persistence.Schema.DICTIONARY_CREDENTIALS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -486,11 +489,11 @@ public class ManagementServiceIT {
@Test
public void authenticateAdmin() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
UserInfo adminUser = setup.getMgmtSvc()
- .createAdminUser( username, "Todd Nine", newUUIDString() + "@apigee.com", password,
+ .createAdminUser( username, "Todd Nine",uniqueEmail(), password,
false, false );
EntityManager em = setup.getEmf().getEntityManager( setup.getSmf().getManagementAppId() );
@@ -515,7 +518,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeShaType() throws Exception {
- String username = "testAdminPasswordChangeShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -572,7 +575,7 @@ public class ManagementServiceIT {
*/
@Test
public void testAdminPasswordChangeMd5ShaType() throws Exception {
- String username = "testAdminPasswordChangeMd5ShaType"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
@@ -635,10 +638,10 @@ public class ManagementServiceIT {
@Test
public void authenticateUser() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "autneticateUser"+newUUIDString();
- String appName = "authenticateUser"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
@@ -738,10 +741,10 @@ public class ManagementServiceIT {
*/
@Test
public void testAppUserPasswordChangeMd5ShaType() throws Exception {
- String username = "tnine"+newUUIDString();
+ String username = uniqueUsername();
String password = "test";
- String orgName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
- String appName = "testAppUserPasswordChangeMd5ShaType"+newUUIDString();
+ String orgName = uniqueOrg();
+ String appName = uniqueApp();
UUID appId = setup.getEmf().createApplication( orgName, appName );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
new file mode 100644
index 0000000..cf476e2
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/TestHelper.java
@@ -0,0 +1,75 @@
+/*
+ * 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;
+
+
+import org.apache.usergrid.persistence.model.util.UUIDGenerator;
+
+
+/**
+ * Simple class to manipulate UUIDs into strings for unique strings when testing
+ */
+public class TestHelper {
+
+ /**
+ * Generate a unique name for an organization
+ * @return
+ */
+ public static String uniqueOrg(){
+ return "org" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique name for an application
+ * @return
+ */
+ public static String uniqueApp(){
+ return "app" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique username
+ * @return
+ */
+ public static String uniqueUsername(){
+ return "user" + newUUIDString();
+ }
+
+
+ /**
+ * Generate a unique email
+ * @return
+ */
+ public static String uniqueEmail(){
+ return "user" + newUUIDString() + "@apache.org";
+ }
+
+
+
+ /**
+ * Generate a new UUID, and remove all the '-' characters from the resulting string.
+ * @return
+ */
+ public static String newUUIDString() {
+ return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bb05616a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java b/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
deleted file mode 100644
index dffe826..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/UUIDTestHelper.java
+++ /dev/null
@@ -1,38 +0,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;
-
-
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-
-/**
- * Simple class to manipulate UUIDs into strings for unique strings when testing
- */
-public class UUIDTestHelper {
-
- /**
- * Generate a new UUID, and remove all the '-' characters from the resulting string.
- * @return
- */
- public static String newUUIDString() {
- return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
- }
-}
[28/50] [abbrv] incubator-usergrid git commit: Removed
subscribeOnCalls
Posted by sn...@apache.org.
Removed subscribeOnCalls
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/04679c82
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/04679c82
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/04679c82
Branch: refs/heads/two-dot-o-events
Commit: 04679c82a5a5cac1427c9775d40f3f3d76f30bff
Parents: 18197e3
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Dec 9 17:17:12 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Dec 9 17:17:12 2014 -0700
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java | 2 +-
.../apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/04679c82/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
index cd5be7f..99a08da 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexBatchImpl.java
@@ -192,7 +192,7 @@ public class EsEntityIndexBatchImpl implements EntityIndexBatch {
indexes = new String[]{indexIdentifier.getIndex(null)};
}
//get all indexes then flush everyone
- Observable.from(indexes).subscribeOn(Schedulers.io())
+ Observable.from(indexes)
.map(new Func1<String, Object>() {
@Override
public Object call(String index) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/04679c82/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index a6e9337..67e1680 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -444,7 +444,7 @@ public class EsEntityIndexImpl implements AliasedEntityIndex {
public boolean doOp() {
try {
String[] indexes = getIndexes(AliasType.Read);
- Observable.from(indexes).subscribeOn(Schedulers.io()).map(new Func1<String, String>() {
+ Observable.from(indexes).map(new Func1<String, String>() {
@Override
public String call(String index) {
esProvider.getClient().admin().indices().prepareRefresh( index ).execute().actionGet();