You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/11/07 17:44:11 UTC
[1/5] incubator-usergrid git commit: [APIBAAS-1362]External cassandra
setup
Repository: incubator-usergrid
Updated Branches:
refs/heads/es-type-updates-ryan-external [created] d4ecbe17a
[APIBAAS-1362]External cassandra setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/3275a709
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/3275a709
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/3275a709
Branch: refs/heads/es-type-updates-ryan-external
Commit: 3275a709d70e1dc7eebfed900262d87f7fe0ccd0
Parents: 46d6c05
Author: ryan bridges <rb...@apigee.com>
Authored: Thu Nov 6 12:39:39 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Thu Nov 6 13:43:22 2014 -0500
----------------------------------------------------------------------
.../usergrid/cassandra/CassandraResource.java | 136 +++++++++++++++----
1 file changed, 109 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3275a709/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
index 96d0d74..0b4c083 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
@@ -33,15 +33,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.core.env.PropertySource;
import org.yaml.snakeyaml.Yaml;
-
import org.apache.cassandra.service.CassandraDaemon;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
-
/**
* A JUnit {@link org.junit.rules.ExternalResource} designed to start up Cassandra once in a TestSuite or test Class as
* a shared external resource across test cases and shut it down after the TestSuite has completed.
@@ -65,6 +65,7 @@ public class CassandraResource extends ExternalResource {
public static final int DEFAULT_STORAGE_PORT = 7000;
public static final int DEFAULT_SSL_STORAGE_PORT = 7001;
public static final int DEFAULT_NATIVE_TRANSPORT_PORT = 9042;
+ public static final String DEFAULT_HOST = "127.0.0.1";
public static final String PROPERTIES_FILE = "project.properties";
public static final String TARGET_DIRECTORY_KEY = "target.directory";
@@ -101,9 +102,9 @@ public class CassandraResource extends ExternalResource {
private static Properties properties = null;
private boolean forkCassandra = false;
+ private boolean externalCassandra = false;
-
- /**
+ /**
* Creates a Cassandra starting ExternalResource for JUnit test cases which uses the
* default SchemaManager for Cassandra.
*/
@@ -144,12 +145,15 @@ public class CassandraResource extends ExternalResource {
new ClassPathXmlApplicationContext( locations );
Properties properties = (Properties)appContext.getBean("properties");
+ properties.putAll(ArrayUtils.toMap(this.getProjectProperties().entrySet().toArray(new Object[]{})));
String forkString = properties.getProperty("cassandra.startup");
forkCassandra = "forked".equals( forkString );
+ externalCassandra = "external".equals( forkString );
} catch (Exception ex) {
throw new RuntimeException("Error getting properties", ex);
}
+// throw new RuntimeException("My debugging skills are terrible!");
}
@@ -288,15 +292,26 @@ public class CassandraResource extends ExternalResource {
if ( isReady() ) {
return;
}
-
+
if ( forkCassandra ) {
startCassandraForked();
- } else {
+ } else if (externalCassandra) {
+ startCassandraExternal();
+ }else {
+
startCassandraEmbedded();
}
}
}
+ private void addShutdownHook(){
+ Runtime.getRuntime().addShutdownHook( new Thread() {
+ @Override
+ public void run() {
+ after();
+ }
+ } );
+ }
private void startCassandraEmbedded() throws Throwable {
LOG.info( "-------------------------------------------------------------------");
@@ -366,13 +381,13 @@ public class CassandraResource extends ExternalResource {
cassandraDaemon = new CassandraDaemon();
cassandraDaemon.activate();
- Runtime.getRuntime().addShutdownHook( new Thread() {
- @Override
- public void run() {
- after();
- }
- } );
-
+// Runtime.getRuntime().addShutdownHook( new Thread() {
+// @Override
+// public void run() {
+// after();
+// }
+// } );
+ addShutdownHook();
String[] locations = { "usergrid-test-context.xml" };
applicationContext = new ClassPathXmlApplicationContext( locations );
@@ -501,13 +516,13 @@ public class CassandraResource extends ExternalResource {
}
}).start();
- Runtime.getRuntime().addShutdownHook( new Thread() {
- @Override
- public void run() {
- after();
- }
- } );
-
+// Runtime.getRuntime().addShutdownHook( new Thread() {
+// @Override
+// public void run() {
+// after();
+// }
+// } );
+ addShutdownHook();
// give C* time to start
Thread.sleep(5000);
@@ -519,13 +534,31 @@ public class CassandraResource extends ExternalResource {
LOG.info( "External Cassandra resource at {} is ready!", tempDir.toString() );
lock.notifyAll();
}
-
+ private void startCassandraExternal() throws Throwable {
+ LOG.info( "-------------------------------------------------------------------");
+ LOG.info( "Initializing External Cassandra");
+ LOG.info( "-------------------------------------------------------------------");
+ LOG.info("before() test, setting system properties for ports : "
+ + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
+ new Object[] {rpcPort, storagePort, sslStoragePort, nativeTransportPort});
+ Thread.sleep(5000);
+ String[] locations = { "usergrid-test-context.xml" };
+ applicationContext = new ClassPathXmlApplicationContext( locations );
+// PropertySource ps=new PropertySource<String>();
+// applicationContext.getEnvironment().getPropertySources().addLast(ps);
+ applicationContext.refresh();
+ loadSchemaManager( schemaManagerName );
+ initialized = true;
+
+ LOG.info( "External Cassandra resource at {} is ready!", tempDir.toString() );
+ lock.notifyAll();
+
+ }
/** Stops Cassandra after a TestSuite or test Class executes. */
@Override
protected synchronized void after() {
super.after();
-
if ( process != null ) {
process.destroy();
}
@@ -534,11 +567,15 @@ public class CassandraResource extends ExternalResource {
@Override
public void run() {
try {
- Thread.currentThread().sleep( 100L );
+ Thread.currentThread();
+ Thread.sleep( 100L );
}
catch ( InterruptedException ignored ) {}
-
- LOG.info( "Shutting down Cassandra instance in {}", tempDir.toString() );
+ if(externalCassandra){
+ LOG.info( "Cleaning up external Cassandra instance");
+ }else{
+ LOG.info( "Shutting down Cassandra instance in {}", tempDir.toString() );
+ }
if ( schemaManager != null ) {
LOG.info( "Destroying schemaManager..." );
@@ -556,7 +593,7 @@ public class CassandraResource extends ExternalResource {
LOG.info( "ApplicationContext stopped..." );
try {
- if ( cassandraDaemon != null ) {
+ if ( !externalCassandra && cassandraDaemon != null ) {
LOG.info( "Deactivating CassandraDaemon..." );
cassandraDaemon.deactivate();
}
@@ -641,6 +678,51 @@ public class CassandraResource extends ExternalResource {
return instance;
}
}
+ public static CassandraResource newWithMavenAllocatedPorts() {
+ synchronized ( lock ) {
+ Properties props = new Properties();
+ try {
+ props.load(ClassLoader.getSystemResourceAsStream( "project.properties" ));
+
+ } catch (IOException e) {
+ LOG.error("Unable to load project properties: {}", e.getLocalizedMessage());
+ }
+ int rpcPort = Integer.parseInt(props.getProperty("cassandra.rpcPort", Integer.toString(CassandraResource.DEFAULT_RPC_PORT)));
+ int storagePort = Integer.parseInt(props.getProperty("cassandra.storagePort", Integer.toString(CassandraResource.DEFAULT_STORAGE_PORT))) ;
+ int sslStoragePort = Integer.parseInt(props.getProperty("cassandra.sslPort", Integer.toString(CassandraResource.DEFAULT_SSL_STORAGE_PORT)));
+ int nativeTransportPort = Integer.parseInt(props.getProperty("cassandra.nativeTransportPort", Integer.toString(CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT)));
+ String host = props.getProperty("cassandra.host", DEFAULT_HOST);
+// int rpcPort = CassandraResource.DEFAULT_RPC_PORT;
+// int storagePort = CassandraResource.DEFAULT_STORAGE_PORT ;
+// int sslStoragePort = CassandraResource.DEFAULT_SSL_STORAGE_PORT;
+// int nativeTransportPort = CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT;
+
+ System.setProperty( "cassandra.url", host+":" + Integer.toString( rpcPort ) );
+ System.setProperty( "cassandra.cluster", props.getProperty("cassandra.cluster","Test Cluster") );
+ System.setProperty( "cassandra-foreground", "true" );
+ System.setProperty( "log4j.defaultInitOverride", "true" );
+ System.setProperty( "log4j.configuration", "log4j.properties" );
+ System.setProperty( "cassandra.ring_delay_ms", "100" );
+
+ System.setProperty( "cassandra." + RPC_PORT_KEY, Integer.toString( rpcPort ) );
+ System.setProperty( "cassandra." + STORAGE_PORT_KEY, Integer.toString( storagePort ) );
+ System.setProperty( "cassandra." + SSL_STORAGE_PORT_KEY, Integer.toString( sslStoragePort ) );
+ System.setProperty( "cassandra." + NATIVE_TRANSPORT_PORT_KEY, Integer.toString( nativeTransportPort ) );
+
+ LOG.info("project.properties loaded properties for ports : "
+ + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
+ new Object[] {rpcPort, storagePort, sslStoragePort, nativeTransportPort});
+
+
+ instance = new CassandraResource(
+ null, rpcPort, storagePort, sslStoragePort, nativeTransportPort );
+
+ LOG.info("Created a new instance of CassandraResource: {}", instance);
+ LOG.info("Cassandra using ports {} and {}", storagePort, sslStoragePort);
+
+ return instance;
+ }
+ }
/**
@@ -650,7 +732,7 @@ public class CassandraResource extends ExternalResource {
* @return a new CassandraResource with possibly non-default ports
*/
public static CassandraResource newWithAvailablePorts() {
- return newWithAvailablePorts( null );
+ return newWithMavenAllocatedPorts();
}
[3/5] incubator-usergrid git commit: Tweaks to CassandraResource and
ElasticSearchResource
Posted by to...@apache.org.
Tweaks to CassandraResource and ElasticSearchResource
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/bf2bd804
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/bf2bd804
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/bf2bd804
Branch: refs/heads/es-type-updates-ryan-external
Commit: bf2bd804c469984cecf5b351d51e15bd2b79b46e
Parents: 3275a70
Author: ryan bridges <rb...@apigee.com>
Authored: Thu Nov 6 17:13:03 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Thu Nov 6 17:13:03 2014 -0500
----------------------------------------------------------------------
.../usergrid/persistence/index/impl/ElasticSearchResource.java | 2 +-
.../java/org/apache/usergrid/cassandra/CassandraResource.java | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bf2bd804/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
index d4d2892..4145e32 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
@@ -63,7 +63,7 @@ public class ElasticSearchResource extends EnvironResource {
props.load( ClassLoader.getSystemResourceAsStream( "project.properties" ) );
host=(String)props.getProperty( "elasticsearch.host", "127.0.0.1" );
port=Integer.valueOf(props.getProperty( "elasticsearch.port", "9300" )).intValue();
- String forkString = props.getProperty("elasticsearch.startup");
+ String forkString = props.getProperty("elasticsearch.startup", "external");
externalElasticSearch = "external".equals( forkString );
} catch (Exception ex) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bf2bd804/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
index 0b4c083..5643710 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
@@ -317,7 +317,6 @@ public class CassandraResource extends ExternalResource {
LOG.info( "-------------------------------------------------------------------");
LOG.info( "Initializing Embedded Cassandra at {} ...", tempDir.toString() );
LOG.info( "-------------------------------------------------------------------");
-
// Create temp directory, setup to create new File configuration there
File newYamlFile = new File( tempDir, "cassandra.yaml" );
URL newYamlUrl = FileUtils.toURLs( new File[] { newYamlFile } )[0];
@@ -403,7 +402,6 @@ public class CassandraResource extends ExternalResource {
LOG.info( "-------------------------------------------------------------------");
LOG.info( "Initializing Forked Cassandra at {} ...", tempDir.toString() );
LOG.info( "-------------------------------------------------------------------");
-
// Create temp directory, setup to create new File configuration there
File newYamlFile = new File( tempDir, "cassandra.yaml" );
URL newYamlUrl = FileUtils.toURLs( new File[] { newYamlFile } )[0];
@@ -698,7 +696,7 @@ public class CassandraResource extends ExternalResource {
// int nativeTransportPort = CassandraResource.DEFAULT_NATIVE_TRANSPORT_PORT;
System.setProperty( "cassandra.url", host+":" + Integer.toString( rpcPort ) );
- System.setProperty( "cassandra.cluster", props.getProperty("cassandra.cluster","Test Cluster") );
+ System.setProperty( "cassandra.cluster", props.getProperty("cassandra.cluster","Usergrid") );
System.setProperty( "cassandra-foreground", "true" );
System.setProperty( "log4j.defaultInitOverride", "true" );
System.setProperty( "log4j.configuration", "log4j.properties" );
[5/5] incubator-usergrid git commit: External tests working except
for old static org/app tests
Posted by to...@apache.org.
External tests working except for old static org/app tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d4ecbe17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d4ecbe17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d4ecbe17
Branch: refs/heads/es-type-updates-ryan-external
Commit: d4ecbe17a3063f902d211c8a02e9ba3c1e8de284
Parents: ef9e94e
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Nov 7 09:20:42 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Nov 7 09:20:42 2014 -0700
----------------------------------------------------------------------
.../config/src/test/resources/usergrid-test.properties | 2 +-
.../src/test/resources/usergrid-custom-test.properties | 4 ++--
.../migration/data/MigrationInfoSerializationImpl.java | 2 +-
.../migration/data/MigrationInfoSerializationTest.java | 13 ++++++++++++-
.../src/test/resources/dynamic-test.properties | 2 +-
.../src/test/resources/usergrid-UNIT.properties | 2 +-
.../src/test/resources/usergrid-custom-test.properties | 4 ++--
.../src/test/resources/usergrid-custom-test.properties | 4 ++--
.../src/test/resources/usergrid-custom-test.properties | 2 +-
9 files changed, 23 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/config/src/test/resources/usergrid-test.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/test/resources/usergrid-test.properties b/stack/config/src/test/resources/usergrid-test.properties
index fc654f9..7d1da1e 100644
--- a/stack/config/src/test/resources/usergrid-test.properties
+++ b/stack/config/src/test/resources/usergrid-test.properties
@@ -58,7 +58,7 @@ cassandra.writecl=QUORUM
#Keyspace to use for locking
cassandra.lock.keyspace=Locks
-elasticsearch.startup=forked
+elasticsearch.startup=external
elasticsearch.cluster_name=test_cluster
#Properties to control the number of buckets in the index.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/core/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/usergrid-custom-test.properties b/stack/core/src/test/resources/usergrid-custom-test.properties
index 6917df0..a1ff5b2 100644
--- a/stack/core/src/test/resources/usergrid-custom-test.properties
+++ b/stack/core/src/test/resources/usergrid-custom-test.properties
@@ -14,8 +14,8 @@
# these settings allow tests to run and consistently pass on 16GB MacBook Pro
# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
-cassandra.startup=embedded
-elasticsearch.startup=embedded
+cassandra.startup=external
+elasticsearch.startup=external
cassandra.timeout=2000
cassandra.connections=1000
hystrix.threadpool.graph_user.coreSize=50
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
index 0460e33..5dbadee 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
@@ -62,7 +62,7 @@ public class MigrationInfoSerializationImpl implements MigrationInfoSerializatio
private static final StringSerializer STRING_SERIALIZER = StringSerializer.get();
- private static final MultiTennantColumnFamily<ScopedRowKey<String>, String> CF_MIGRATION_INFO =
+ public static final MultiTennantColumnFamily<ScopedRowKey<String>, String> CF_MIGRATION_INFO =
new MultiTennantColumnFamily<>( "Data_Migration_Info", ROW_KEY_SER, STRING_SERIALIZER );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
index 4742496..598d107 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationTest.java
@@ -27,6 +27,8 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
+import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
import org.apache.usergrid.persistence.core.test.ITRunner;
import org.apache.usergrid.persistence.core.guice.MigrationManagerRule;
import org.apache.usergrid.persistence.core.guice.TestCommonModule;
@@ -35,6 +37,7 @@ import org.apache.usergrid.persistence.core.test.UseModules;
import com.google.inject.Inject;
import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -49,6 +52,9 @@ public class MigrationInfoSerializationTest {
public MigrationManagerRule migrationManagerRule;
@Inject
+ public MigrationManager migrationManager;
+
+ @Inject
protected Keyspace keyspace;
@@ -60,7 +66,12 @@ public class MigrationInfoSerializationTest {
@Test
- public void basicTest(){
+ public void basicTest() throws ConnectionException, MigrationException {
+
+ //drop the column family, then run setup
+ keyspace.dropColumnFamily( MigrationInfoSerializationImpl.CF_MIGRATION_INFO.getName() );
+
+ migrationManager.migrate();
//test getting nothing works
final String emptyStatus = migrationInfoSerialization.getStatusMessage();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/corepersistence/queryindex/src/test/resources/dynamic-test.properties
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/resources/dynamic-test.properties b/stack/corepersistence/queryindex/src/test/resources/dynamic-test.properties
index bf862de..3d4582f 100644
--- a/stack/corepersistence/queryindex/src/test/resources/dynamic-test.properties
+++ b/stack/corepersistence/queryindex/src/test/resources/dynamic-test.properties
@@ -10,7 +10,7 @@ cassandra.timeout=5000
index.query.limit.default=10
elasticsearch.indexname=Usergrid
-elasticsearch.startup=embedded
+elasticsearch.startup=external
elasticsearch.force-refresh=false
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/corepersistence/queryindex/src/test/resources/usergrid-UNIT.properties
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/resources/usergrid-UNIT.properties b/stack/corepersistence/queryindex/src/test/resources/usergrid-UNIT.properties
index 032d5c5..d7d3909 100644
--- a/stack/corepersistence/queryindex/src/test/resources/usergrid-UNIT.properties
+++ b/stack/corepersistence/queryindex/src/test/resources/usergrid-UNIT.properties
@@ -13,7 +13,7 @@ collections.keyspace.strategy.options=replication_factor:1
collections.keyspace.strategy.class=org.apache.cassandra.locator.SimpleStrategy
collection.stage.transient.timeout=6
-elasticsearch.startup=forked
+elasticsearch.startup=external
elasticsearch.cluster_name=usergrid
elasticsearch.index_prefix=usergrid
elasticsearch.hosts=127.0.0.1
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/rest/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/usergrid-custom-test.properties b/stack/rest/src/test/resources/usergrid-custom-test.properties
index 8d39006..ef615a2 100644
--- a/stack/rest/src/test/resources/usergrid-custom-test.properties
+++ b/stack/rest/src/test/resources/usergrid-custom-test.properties
@@ -17,11 +17,11 @@
tomcat.startup=embedded
tomcat.threads=200
-cassandra.startup=forked
+cassandra.startup=external
cassandra.timeout=2000
cassandra.connections=800
-elasticsearch.startup=forked
+elasticsearch.startup=external
hystrix.threadpool.graph_user.coreSize=1200
hystrix.threadpool.graph_async.coreSize=1200
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/services/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/services/src/test/resources/usergrid-custom-test.properties b/stack/services/src/test/resources/usergrid-custom-test.properties
index c39fe3e..5481a43 100644
--- a/stack/services/src/test/resources/usergrid-custom-test.properties
+++ b/stack/services/src/test/resources/usergrid-custom-test.properties
@@ -14,8 +14,8 @@
# these settings allow tests to run and consistently pass on 16GB MacBook Pro
# with ug.heapmax=5000m and ug.heapmin=3000m (set in Maven settings.xml)
-cassandra.startup=embedded
-elasticsearch.startup=embedded
+cassandra.startup=external
+elasticsearch.startup=external
cassandra.timeout=2000
cassandra.connections=1000
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d4ecbe17/stack/test-utils/src/test/resources/usergrid-custom-test.properties
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/resources/usergrid-custom-test.properties b/stack/test-utils/src/test/resources/usergrid-custom-test.properties
index 0ff85ff..5a463aa 100644
--- a/stack/test-utils/src/test/resources/usergrid-custom-test.properties
+++ b/stack/test-utils/src/test/resources/usergrid-custom-test.properties
@@ -15,4 +15,4 @@
# limitations under the License.
-cassandra.startup=forked
\ No newline at end of file
+cassandra.startup=external
[4/5] incubator-usergrid git commit: Merge remote-tracking branch
'ryan/APIBAAS-1362' into merge
Posted by to...@apache.org.
Merge remote-tracking branch 'ryan/APIBAAS-1362' into 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/ef9e94ec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/ef9e94ec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/ef9e94ec
Branch: refs/heads/es-type-updates-ryan-external
Commit: ef9e94ec75a688523c190bb84d4d5bd281eed310
Parents: eef2b70 bf2bd80
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Nov 7 08:56:39 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Nov 7 08:56:39 2014 -0700
----------------------------------------------------------------------
.../index/impl/ElasticSearchResource.java | 30 +++-
stack/loadtests/README.md | 23 +++
stack/loadtests/pom.xml | 10 --
.../datagenerators/EntityDataGenerator.scala | 5 +-
.../org/apache/usergrid/helpers/Setup.scala | 168 +++++++++++++++++++
.../scenarios/NotificationScenarios.scala | 11 +-
.../usergrid/scenarios/UserScenarios.scala | 15 +-
.../org/apache/usergrid/settings/Settings.scala | 20 ++-
.../usergrid/simulations/AppSimulation.scala | 49 ++++++
.../simulations/GeoProfileSimulation.scala | 33 ++++
.../PushNotificationTargetUserSimulation.scala | 22 ++-
stack/loadtests/src/test/scala/Engine.scala | 2 +-
.../usergrid/cassandra/CassandraResource.java | 138 +++++++++++----
13 files changed, 459 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
[2/5] incubator-usergrid git commit: [APIBAAS-1362]External
elasticsearch setup
Posted by to...@apache.org.
[APIBAAS-1362]External elasticsearch setup
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/46d6c059
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/46d6c059
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/46d6c059
Branch: refs/heads/es-type-updates-ryan-external
Commit: 46d6c059f3e3b2a96624c32b3a7c02e4c7cdd217
Parents: c86d541
Author: ryan bridges <rb...@apigee.com>
Authored: Thu Nov 6 12:41:33 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Thu Nov 6 13:43:22 2014 -0500
----------------------------------------------------------------------
.../index/impl/ElasticSearchResource.java | 30 +++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/46d6c059/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
index 42ab652..d4d2892 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/ElasticSearchResource.java
@@ -32,13 +32,13 @@ import org.safehaus.guicyfig.EnvironResource;
import org.safehaus.guicyfig.GuicyFigModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.RandomStringUtils;
-
import org.apache.usergrid.persistence.core.util.AvailablePortFinder;
import org.apache.usergrid.persistence.index.IndexFig;
+import com.amazonaws.util.StringUtils;
import com.google.inject.Guice;
import com.google.inject.Injector;
@@ -50,17 +50,37 @@ public class ElasticSearchResource extends EnvironResource {
private static Node node;
private static int port;
+ private static String host;
+
+ private static boolean externalElasticSearch = false;
public ElasticSearchResource() {
super( Env.UNIT );
+ try {
+ Properties props = new Properties();
+ props.load( ClassLoader.getSystemResourceAsStream( "project.properties" ) );
+ host=(String)props.getProperty( "elasticsearch.host", "127.0.0.1" );
+ port=Integer.valueOf(props.getProperty( "elasticsearch.port", "9300" )).intValue();
+ String forkString = props.getProperty("elasticsearch.startup");
+ externalElasticSearch = "external".equals( forkString );
+
+ } catch (Exception ex) {
+ throw new RuntimeException("Error getting properties", ex);
+ }
}
@Override
protected void before() throws Throwable {
- startEs();
+ if(externalElasticSearch){
+ System.setProperty( IndexFig.ELASTICSEARCH_HOSTS, host );
+ System.setProperty( IndexFig.ELASTICSEARCH_PORT, port+"" );
+
+ }else{
+ startEs();
+ }
}
@@ -133,7 +153,9 @@ public class ElasticSearchResource extends EnvironResource {
public static void shutdown() {
- node.stop();
+ if(!externalElasticSearch){
+ node.stop();
+ }
}