You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/02/12 23:28:25 UTC
[06/27] incubator-usergrid git commit: WIP of refactor
WIP of refactor
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4ac86c9e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4ac86c9e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4ac86c9e
Branch: refs/heads/USERGRID-365
Commit: 4ac86c9e87dd180c68bf92b21ecc0cf7b3d7b866
Parents: e916d6d
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jan 5 10:13:47 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Jan 5 10:13:47 2015 -0700
----------------------------------------------------------------------
.../usergrid/corepersistence/CpSetup.java | 1 +
.../usergrid/corepersistence/GuiceModule.java | 1 -
.../org/apache/usergrid/AbstractCoreIT.java | 2 +-
.../batch/ConcurrentSchedulerITSuite.java | 2 +-
.../batch/job/AbstractSchedulerRuntimeIT.java | 2 +-
.../usergrid/persistence/CoreSchemaManager.java | 1 +
.../cassandra/EntityManagerFactoryImplIT.java | 2 +-
.../query/AbstractIteratingQueryIT.java | 2 +-
.../system/UsergridSystemMonitorIT.java | 2 +-
.../index/impl/ElasticSearchResource.java | 47 ++--
stack/pom.xml | 6 +
.../usergrid/rest/ConcurrentRestITSuite.java | 2 +-
.../java/org/apache/usergrid/rest/ITSetup.java | 23 +-
.../org/apache/usergrid/rest/RestITSuite.java | 2 +-
.../apache/usergrid/management/EmailFlowIT.java | 2 +-
.../usergrid/management/OrganizationIT.java | 2 +-
.../org/apache/usergrid/management/RoleIT.java | 2 +-
.../cassandra/ApplicationCreatorIT.java | 2 +-
.../management/cassandra/ExportServiceIT.java | 2 +-
.../cassandra/ManagementServiceIT.java | 2 +-
.../security/providers/FacebookProviderIT.java | 2 +-
.../providers/PingIdentityProviderIT.java | 2 +-
.../security/tokens/TokenServiceIT.java | 2 +-
.../usergrid/services/AbstractServiceIT.java | 2 +-
.../usergrid/services/ServiceRequestIT.java | 2 +-
stack/test-utils/pom.xml | 7 +
.../usergrid/cassandra/CassandraMain.java | 70 ------
.../usergrid/cassandra/CassandraResource.java | 136 ++++++++++
.../usergrid/cassandra/SpringResource.java | 247 +++----------------
.../usergrid/setup/SpringIntegrationRunner.java | 65 +++++
.../org/apache/usergrid/setup/SystemSetup.java | 108 ++++++++
.../cassandra/AnotherCassandraResourceIT.java | 9 +-
.../cassandra/CassandraResourceITSuite.java | 41 ---
.../usergrid/cassandra/OkThisIsTheLastIT.java | 9 +-
.../usergrid/cassandra/SpringResourceTest.java | 71 +-----
.../YetAnotherCassandraResourceIT.java | 86 -------
36 files changed, 414 insertions(+), 552 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
index d48a20c..4ffbe54 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
@@ -46,6 +46,7 @@ import static org.apache.usergrid.persistence.cassandra.CassandraService.TOKENS_
import static org.apache.usergrid.persistence.cassandra.CassandraService.USE_VIRTUAL_KEYSPACES;
import static org.apache.usergrid.persistence.cassandra.CassandraService.keyspaceForApplication;
import org.apache.usergrid.persistence.cassandra.Setup;
+import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
import org.apache.usergrid.persistence.core.migration.schema.MigrationException;
import org.apache.usergrid.persistence.core.migration.schema.MigrationManager;
import org.apache.usergrid.persistence.entities.Application;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
index 018a9b7..e00769a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceModule.java
@@ -38,7 +38,6 @@ import org.slf4j.LoggerFactory;
* Guice Module that encapsulates Core Persistence.
*/
public class GuiceModule extends AbstractModule {
- private static final Logger log = LoggerFactory.getLogger( GuiceModule.class );
@Override
protected void configure() {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 e7fcee7..b743c97 100644
--- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java
@@ -32,7 +32,7 @@ public abstract class AbstractCoreIT {
private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class );
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java b/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
index ec05398..0800c89 100644
--- a/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/ConcurrentSchedulerITSuite.java
@@ -43,5 +43,5 @@ import org.apache.usergrid.cassandra.ConcurrentSuite;
@Concurrent()
public class ConcurrentSchedulerITSuite {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 baaf76c..73561e1 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
@@ -46,7 +46,7 @@ public class AbstractSchedulerRuntimeIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java
index 345810c..307cdff 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java
@@ -64,6 +64,7 @@ public class CoreSchemaManager implements SchemaManager {
try {
setup.createDefaultApplications();
}
+
catch ( Exception ex ) {
LOG.error( "Could not create default applications", ex );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 175eb16..cbf274b 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
@@ -62,7 +62,7 @@ public class EntityManagerFactoryImplIT extends AbstractCoreIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 4b2ff7c..6f4a6c5 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
@@ -51,7 +51,7 @@ public abstract class AbstractIteratingQueryIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 5dc4379..976e5cc 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
@@ -38,7 +38,7 @@ import static org.junit.Assert.assertTrue;
public class UsergridSystemMonitorIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
private UsergridSystemMonitor usergridSystemMonitor;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 1f04303..7c2ae42 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
@@ -19,28 +19,12 @@
package org.apache.usergrid.persistence.index.impl;
-import java.io.File;
-import java.io.IOException;
import java.util.Properties;
-import org.elasticsearch.common.settings.ImmutableSettings;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.node.Node;
-import org.elasticsearch.node.NodeBuilder;
import org.safehaus.guicyfig.Env;
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;
+import org.apache.usergrid.persistence.index.IndexFig;
public class ElasticSearchResource extends EnvironResource {
@@ -50,33 +34,36 @@ public class ElasticSearchResource extends EnvironResource {
private static String host;
-
-
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", "external");
- } catch (Exception ex) {
- throw new RuntimeException("Error getting properties", ex);
+ host = props.getProperty( "elasticsearch.host", "127.0.0.1" );
+ port = Integer.valueOf( props.getProperty( "elasticsearch.port", "9300" ) ).intValue();
+ }
+ catch ( Exception ex ) {
+ throw new RuntimeException( "Error getting properties", ex );
}
}
- @Override
- protected void before() throws Throwable {
- System.setProperty( IndexFig.ELASTICSEARCH_HOSTS, host );
- System.setProperty( IndexFig.ELASTICSEARCH_PORT, port+"" ); }
+ /**
+ * Start the resources
+ */
+ public void start() {
+ before();
+ }
+ @Override
+ protected void before() {
+ System.setProperty( IndexFig.ELASTICSEARCH_HOSTS, host );
+ System.setProperty( IndexFig.ELASTICSEARCH_PORT, port + "" );
+ }
public static int getPort() {
return port;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index ddcc146..f17e0f5 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -984,6 +984,12 @@
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${org.springframework.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
index e9c46ce..7005277 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ConcurrentRestITSuite.java
@@ -63,5 +63,5 @@ import org.apache.usergrid.rest.management.organizations.AdminEmailEncodingIT;
public class ConcurrentRestITSuite {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
index 9383558..fdf873a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/ITSetup.java
@@ -25,6 +25,8 @@ import javax.ws.rs.core.UriBuilder;
import org.junit.rules.ExternalResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.cassandra.CassandraResource;
import org.apache.usergrid.cassandra.SpringResource;
import org.apache.usergrid.management.ApplicationCreator;
import org.apache.usergrid.management.ManagementService;
@@ -44,6 +46,7 @@ public class ITSetup extends ExternalResource {
private static final Logger LOG = LoggerFactory.getLogger( ITSetup.class );
private final ElasticSearchResource elasticSearchResource;
+ private final CassandraResource cassandraResource;
private final SpringResource springResource;
private final TomcatResource tomcatResource;
@@ -61,12 +64,12 @@ public class ITSetup extends ExternalResource {
public ITSetup( SpringResource springResource ) {
-
+
try {
String[] locations = { "usergrid-properties-context.xml" };
- ConfigurableApplicationContext appContext =
+ ConfigurableApplicationContext appContext =
new ClassPathXmlApplicationContext( locations );
-
+
properties = (Properties)appContext.getBean("properties");
} catch (Exception ex) {
@@ -81,6 +84,7 @@ public class ITSetup extends ExternalResource {
// elasticSearchResource = new ElasticSearchResource().startEs();
elasticSearchResource = new ElasticSearchResource();
+ cassandraResource = new CassandraResource();
}
@@ -109,16 +113,9 @@ public class ITSetup extends ExternalResource {
// setupCalled = true;
// }
- String esStartup = properties.getProperty("elasticsearch.startup");
- if ( "embedded".equals(esStartup)) {
- tomcatResource.setCassandraPort( springResource.getRpcPort() );
- tomcatResource.setElasticSearchPort(
- Integer.parseInt( System.getProperty(LOCAL_ES_PORT_PROPNAME)) );
-
- } else {
- tomcatResource.setCassandraPort( springResource.getRpcPort() );
- tomcatResource.setElasticSearchPort(elasticSearchResource.getPort());
- }
+ tomcatResource.setCassandraPort( cassandraResource.getPort() );
+ tomcatResource.setElasticSearchPort( elasticSearchResource.getPort() );
+
tomcatResource.before();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java b/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
index 116a6e3..ddc8b03 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/RestITSuite.java
@@ -60,5 +60,5 @@ public class RestITSuite {
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 f8c2055..a2127b1 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
@@ -93,7 +93,7 @@ public class EmailFlowIT {
private static final Logger LOG = LoggerFactory.getLogger( EmailFlowIT.class );
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 2821460..530e3be 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
@@ -53,7 +53,7 @@ public class OrganizationIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 b3dcbab..b71598d 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
@@ -48,7 +48,7 @@ public class RoleIT {
private static final Logger LOG = LoggerFactory.getLogger( RoleIT.class );
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 db8f169..6c33338 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
@@ -45,7 +45,7 @@ import static org.junit.Assert.assertTrue;
@Concurrent()
public class ApplicationCreatorIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 777103b..6ab8c16 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
@@ -87,7 +87,7 @@ public class ExportServiceIT {
private static final Logger LOG = LoggerFactory.getLogger( ExportServiceIT.class );
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 85c14c7..c15cf83 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
@@ -74,7 +74,7 @@ public class ManagementServiceIT {
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 87684be..3622487 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
@@ -53,7 +53,7 @@ public class FacebookProviderIT {
private static UUID applicationId;
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 236a1c3..91c7ca8 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
@@ -50,7 +50,7 @@ public class PingIdentityProviderIT {
private static UUID applicationId;
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 b5addd6..632a337 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
@@ -63,7 +63,7 @@ public class TokenServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 6f36083..293c8a5 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
@@ -35,7 +35,7 @@ public abstract class AbstractServiceIT {
public ClearShiroSubject clearShiroSubject = new ClearShiroSubject();
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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 bcff258..f105f4e 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
@@ -46,7 +46,7 @@ public class ServiceRequestIT {
private static final Logger logger = LoggerFactory.getLogger( ServiceRequestIT.class );
@ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
+ public static SpringResource springResource = SpringResource.getInstance();
@ClassRule
public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/stack/test-utils/pom.xml b/stack/test-utils/pom.xml
index c872653..5c3539b 100644
--- a/stack/test-utils/pom.xml
+++ b/stack/test-utils/pom.xml
@@ -286,6 +286,13 @@
<artifactId>tomcat-jsp-api</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ </dependency>
+
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
deleted file mode 100644
index 8a8baa0..0000000
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraMain.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2014 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.cassandra;
-
-import org.apache.cassandra.service.CassandraDaemon;
-import static org.apache.usergrid.cassandra.SpringResource.LOG;
-import static org.apache.usergrid.cassandra.SpringResource.NATIVE_TRANSPORT_PORT_KEY;
-import static org.apache.usergrid.cassandra.SpringResource.RPC_PORT_KEY;
-import static org.apache.usergrid.cassandra.SpringResource.SSL_STORAGE_PORT_KEY;
-import static org.apache.usergrid.cassandra.SpringResource.STORAGE_PORT_KEY;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Simple wrapper for starting "embedded" Tomcat as it's own process, for testing.
- */
-public class CassandraMain {
-
- private static final Logger log = LoggerFactory.getLogger( CassandraMain.class );
-
- public static void main(String[] args) throws Exception {
-
- String yamlFileName = args[0];
- String tmpDirName = args[1];
- String log4jConfig = args[2];
- int rpcPort = Integer.parseInt( args[3] );
- int storagePort = Integer.parseInt( args[4] );
- int sslStoragePort = Integer.parseInt( args[5] );
- int nativeTransportPort = Integer.parseInt( args[6] );
-
- 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 ) );
-
- System.setProperty( "cassandra.url", "localhost:" + Integer.toString( rpcPort ) );
- System.setProperty( "cassandra-foreground", "true" );
- System.setProperty( "log4j.defaultInitOverride", "true" );
- System.setProperty( "log4j.configuration", "file:" + log4jConfig );
- System.setProperty( "cassandra.ring_delay_ms", "100" );
- System.setProperty( "cassandra.config", yamlFileName );
- System.setProperty( "cassandra.tempName", tmpDirName );
-
- LOG.info("Starting forked Cassandra: test, setting system properties for ports : "
- + "[rpc, storage, sslStorage, native] = [{}, {}, {}, {}]",
- new Object[] {rpcPort, storagePort, sslStoragePort, nativeTransportPort});
-
- CassandraDaemon cassandraDaemon = new CassandraDaemon();
- cassandraDaemon.activate();
-
- while ( true ) {
- Thread.sleep(1000);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/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
new file mode 100644
index 0000000..6d737e1
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
@@ -0,0 +1,136 @@
+/*
+ * 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.cassandra;
+
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.safehaus.guicyfig.Env;
+import org.safehaus.guicyfig.EnvironResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Create the resource that sets the cassandra properties
+ */
+public class CassandraResource extends EnvironResource {
+
+
+ public static final Logger LOG = LoggerFactory.getLogger( SpringResource.class );
+ public static final String DEFAULT_HOST = "127.0.0.1";
+
+
+ public static final int DEFAULT_RPC_PORT = 9160;
+
+ 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 NATIVE_TRANSPORT_PORT_KEY = "native_transport_port";
+ public static final String RPC_PORT_KEY = "rpc_port";
+
+ private static final Object lock = new Object();
+
+
+ private static int port;
+ private static String host;
+ private static String hostUrl;
+
+
+ private static boolean initialized = false;
+
+
+ public CassandraResource() {
+ super( Env.UNIT );
+ }
+
+
+ /**
+ * Start the cassandra setup
+ * @throws Throwable
+ */
+ public void start() {
+ before();
+ }
+
+
+ @Override
+ protected void before() {
+ if ( initialized ) {
+ return;
+ }
+
+ synchronized ( lock ) {
+
+ if ( initialized ) {
+ return;
+ }
+
+ Properties props = new Properties();
+ try {
+ props.load( ClassLoader.getSystemResourceAsStream( "project.properties" ) );
+ }
+ catch ( IOException e ) {
+ LOG.error( "Unable to load project properties: {}", e.getLocalizedMessage() );
+ }
+ port = Integer.parseInt(
+ props.getProperty( "cassandra.rpcPort", Integer.toString( DEFAULT_RPC_PORT ) ) );
+
+ host = props.getProperty( "cassandra.host", DEFAULT_HOST );
+
+
+ hostUrl = host + ":" + Integer.toString( port );
+
+
+ System.setProperty( "cassandra.url", hostUrl );
+ 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" );
+ System.setProperty( "cassandra.ring_delay_ms", "100" );
+
+ System.setProperty( "cassandra." + RPC_PORT_KEY, Integer.toString( port ) );
+
+ LOG.info( "project.properties loaded properties for ports : " + "[rpc] = [{}]", new Object[] { port } );
+
+
+ initialized = true;
+ }
+ }
+
+
+ /**
+ * Get the cassandra host
+ * @return
+ */
+ public static int getPort() {
+ return port;
+ }
+
+
+ /**
+ * Get the cassandra host
+ * @return
+ */
+ public static String getHost() {return host;}
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
index 77a28cf..ef860f8 100644
--- a/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/cassandra/SpringResource.java
@@ -17,90 +17,52 @@
package org.apache.usergrid.cassandra;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.junit.rules.ExternalResource;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.safehaus.guicyfig.EnvironResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.apache.commons.lang.ArrayUtils;
-
/**
- * A JUnit {@link org.junit.rules.ExternalResource} designed to set our system properties then start spring so it connects to cassandra correctly
- *
+ * A singleton resource for spring that is used during testing. This will intialize spring, and then hold on to the
+ * spring context within this singleton
*/
-public class SpringResource extends ExternalResource {
+public class SpringResource extends EnvironResource {
public static final Logger LOG = LoggerFactory.getLogger( SpringResource.class );
- public static final int DEFAULT_RPC_PORT = 9160;
- 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 NATIVE_TRANSPORT_PORT_KEY = "native_transport_port";
- public static final String RPC_PORT_KEY = "rpc_port";
- public static final String STORAGE_PORT_KEY = "storage_port";
- public static final String SSL_STORAGE_PORT_KEY = "ssl_storage_port";
- private static final Object lock = new Object();
+ private static SpringResource instance;
- private boolean initialized = false;
- private int rpcPort = DEFAULT_RPC_PORT;
- private int storagePort = DEFAULT_STORAGE_PORT;
- private int sslStoragePort = DEFAULT_SSL_STORAGE_PORT;
- private int nativeTransportPort = DEFAULT_NATIVE_TRANSPORT_PORT;
private ConfigurableApplicationContext applicationContext;
private SchemaManager schemaManager;
- private static SpringResource instance;
-
- private static Properties properties = null;
-
/**
* Creates a Cassandra starting ExternalResource for JUnit test cases which uses the specified SchemaManager for
* Cassandra.
*/
- SpringResource( int rpcPort, int storagePort, int sslStoragePort, int nativeTransportPort ) {
+ private SpringResource() {
LOG.info( "Creating CassandraResource using {} for the ClassLoader.",
Thread.currentThread().getContextClassLoader() );
-
- this.rpcPort = rpcPort;
- this.storagePort = storagePort;
- this.sslStoragePort = sslStoragePort;
- this.nativeTransportPort = nativeTransportPort;
-
-
- try {
- String[] locations = { "usergrid-properties-context.xml" };
- ConfigurableApplicationContext appContext = new ClassPathXmlApplicationContext( locations );
-
- Properties properties = ( Properties ) appContext.getBean( "properties" );
- properties.putAll( ArrayUtils.toMap( this.getProjectProperties().entrySet().toArray( new Object[] { } ) ) );
- }
- catch ( Exception ex ) {
- throw new RuntimeException( "Error getting properties", ex );
- }
}
/**
- * Gets the rpcPort for Cassandra.
- *
- * @return the rpc_port (in yaml file) used by Cassandra
+ * A singleton of this spring resource. This will instantiate and create
+ * the spring context if an instance is not present.
*/
- public int getRpcPort() {
- return rpcPort;
- }
-
+ public static synchronized SpringResource getInstance() {
+ if ( instance == null ) {
+ instance = new SpringResource();
+ instance.startSpringInternal();
+ }
+ return instance;
+ }
/**
@@ -112,7 +74,6 @@ public class SpringResource extends ExternalResource {
* @return the bean
*/
public <T> T getBean( String name, Class<T> requiredType ) {
- protect();
return applicationContext.getBean( name, requiredType );
}
@@ -126,90 +87,18 @@ public class SpringResource extends ExternalResource {
* @return the bean
*/
public <T> T getBean( Class<T> requiredType ) {
- protect();
return applicationContext.getBean( requiredType );
}
/**
- * Gets whether this resource is ready to use.
- *
- * @return true if ready to use, false otherwise
- */
- public boolean isReady() {
- return initialized;
- }
-
-
-
-
- /**
- * Protects against IDE or command line runs of a unit test which when starting the test outside of the Suite will
- * not start the resource. This makes sure the resource is automatically started on a usage attempt.
- */
- private void protect() {
- if ( !isReady() ) {
- try {
- before();
- }
- catch ( Throwable t ) {
- LOG.error( "Failed to start up Cassandra.", t );
- throw new RuntimeException( t );
- }
- }
- }
-
-
- /**
- * Starts up Cassandra before TestSuite or test Class execution.
- *
- * @throws Throwable if we cannot start up Cassandra
- */
- @Override
- protected void before() throws Throwable {
- /*
- * Note that the lock is static so it is JVM wide which prevents other
- * instances of this class from making changes to the Cassandra system
- * properties while we are initializing Cassandra with unique settings.
- */
-
- synchronized ( lock ) {
- super.before();
-
- if ( isReady() ) {
- return;
- }
-
- startSpring();
- }
- }
-
-
- private void startSpring() 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 } );
- String[] locations = { "usergrid-test-context.xml" };
- applicationContext = new ClassPathXmlApplicationContext( locations );
- applicationContext.refresh();
- initialized = true;
- lock.notifyAll();
- }
-
-
- /**
- * Loads the specified {@link SchemaManager} or the default manager if the manager name that is provided is null.
- *
- *
+ * Creates the schema and performs any migration
*/
- private void loadSchemaManager() {
- if ( !applicationContext.isActive() ) {
- LOG.info( "Restarting context..." );
- applicationContext.refresh();
- }
+ public void migrate() {
+ // if ( !applicationContext.isActive() ) {
+ // LOG.info( "Restarting context..." );
+ // applicationContext.refresh();
+ // }
LOG.info( "The SchemaManager is not specified - using the default SchemaManager impl" );
@@ -220,91 +109,19 @@ public class SpringResource extends ExternalResource {
}
- public static SpringResource setAllocatedPorts() {
- synchronized ( lock ) {
-
- //don't keep re-initializing if it's already done
- if(instance != null){
- return instance;
- }
-
- 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( SpringResource.DEFAULT_RPC_PORT ) ) );
- int storagePort = Integer.parseInt( props.getProperty( "cassandra.storagePort",
- Integer.toString( SpringResource.DEFAULT_STORAGE_PORT ) ) );
- int sslStoragePort = Integer.parseInt( props.getProperty( "cassandra.sslPort",
- Integer.toString( SpringResource.DEFAULT_SSL_STORAGE_PORT ) ) );
- int nativeTransportPort = Integer.parseInt( props.getProperty( "cassandra.nativeTransportPort",
- Integer.toString( SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT ) ) );
- String host = props.getProperty( "cassandra.host", DEFAULT_HOST );
-
- System.setProperty( "cassandra.url", host + ":" + Integer.toString( rpcPort ) );
- 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" );
- 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 SpringResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
-
- LOG.info( "Created a new instance of CassandraResource: {}", instance );
- LOG.info( "Cassandra using ports {} and {}", storagePort, sslStoragePort );
-
-
-
- return instance;
- }
- }
-
-
/**
- * Creates a new instance of the CassandraResource with rpc and storage ports that may or may not be the default
- * ports. If either port is taken, an alternative free port is found.
- *
- * @return a new CassandraResource with possibly non-default ports
+ * Start our spring context. Only invoke this if it is not set
*/
- public static SpringResource setPortsAndStartSpring() {
- return setAllocatedPorts();
- }
-
+ private void startSpringInternal() {
+ LOG.info( "-------------------------------------------------------------------" );
+ LOG.info( "Initializing Spring" );
+ LOG.info( "-------------------------------------------------------------------" );
+ String[] locations = { "usergrid-test-context.xml" };
+ applicationContext = new ClassPathXmlApplicationContext( locations );
+ // applicationContext.refresh();
- public static Properties getProjectProperties() throws IOException {
- if ( properties == null ) {
- properties = new Properties();
- properties.load( ClassLoader.getSystemResourceAsStream( PROPERTIES_FILE ) );
- }
- return properties;
}
- @Override
- public String toString() {
- return "CassandraResource{" +
- "initialized=" + initialized +
- ", rpcPort=" + rpcPort +
- ", storagePort=" + storagePort +
- ", sslStoragePort=" + sslStoragePort +
- ", nativeTransportPort=" + nativeTransportPort +
- ", applicationContext=" + applicationContext +
- ", schemaManager=" + schemaManager +
- "} " + super.toString();
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java b/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
new file mode 100644
index 0000000..e04a710
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/setup/SpringIntegrationRunner.java
@@ -0,0 +1,65 @@
+/*
+ * 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.setup;
+
+
+import org.junit.ClassRule;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+
+
+/**
+ * Initializes the casandra and configuration before starting spring
+ */
+public class SpringIntegrationRunner extends SpringJUnit4ClassRunner {
+
+ public static ElasticSearchResource ELASTICSEARCH = new ElasticSearchResource();
+ public static CassandraResource CASSANDRA_RESOURCE = new CassandraResource();
+
+ private static boolean initialized;
+
+
+
+
+ /**
+ *
+ * @see #createTestContextManager(Class)
+ */
+ public SpringIntegrationRunner( final Class<?> clazz ) throws InitializationError {
+ super( clazz );
+ }
+
+
+ @Override
+ protected Statement withBeforeClasses( final Statement statement ) {
+
+
+
+ final Statement toReturn = super.withBeforeClasses( statement );
+
+ return toReturn;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/main/java/org/apache/usergrid/setup/SystemSetup.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/apache/usergrid/setup/SystemSetup.java b/stack/test-utils/src/main/java/org/apache/usergrid/setup/SystemSetup.java
new file mode 100644
index 0000000..32434e6
--- /dev/null
+++ b/stack/test-utils/src/main/java/org/apache/usergrid/setup/SystemSetup.java
@@ -0,0 +1,108 @@
+/*
+ * 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.setup;
+
+
+import java.io.File;
+
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunListener;
+
+import org.apache.usergrid.cassandra.CassandraResource;
+import org.apache.usergrid.cassandra.SpringResource;
+import org.apache.usergrid.lock.MultiProcessBarrier;
+import org.apache.usergrid.lock.MultiProcessLocalLock;
+import org.apache.usergrid.persistence.index.impl.ElasticSearchResource;
+
+
+/**
+ * Perform the following setup in the system.
+ *
+ * 1) Inject the properties
+ */
+public class SystemSetup {
+
+ private static final String TEMP_FILE_PATH = "target/surefirelocks";
+ public static final String LOCK_NAME = TEMP_FILE_PATH + "/lock";
+ public static final String START_BARRIER_NAME = TEMP_FILE_PATH + "/start_barrier";
+
+
+// public static final long ONE_MINUTE = 60000;
+
+ /**
+ *
+ */
+ public static CassandraResource cassandraResource = new CassandraResource();
+
+ public static ElasticSearchResource elasticSearchResource = new ElasticSearchResource();
+
+ public static SpringResource springResource = SpringResource.getInstance();
+
+ private SystemSetup(){
+
+ }
+
+
+ public void maybeInitialize() throws Exception {
+
+ final MultiProcessLocalLock lock = new MultiProcessLocalLock( LOCK_NAME );
+
+ final MultiProcessBarrier barrier = new MultiProcessBarrier( START_BARRIER_NAME );
+
+ //we have a lock, so init the system
+ if ( lock.tryLock() ) {
+ initSystem();
+ barrier.proceed();
+ }
+
+
+ barrier.await( ONE_MINUTE );
+
+ //it doesn't matter who finishes first. We need to remove the resources so we start correctly next time.
+ //not ideal, but a clean will solve this issue too
+ if ( lock.hasLock() ) {
+ deleteFile( LOCK_NAME );
+ deleteFile( START_BARRIER_NAME );
+ lock.releaseLock();
+ }
+ }
+
+
+ /**
+ * Delete the files after we start
+ */
+ private void deleteFile( final String fileName ) {
+ File file = new File( fileName );
+
+ if ( file.exists() ) {
+ file.delete();
+ }
+ }
+
+
+ /**
+ * Initialize the system
+ */
+ public void initSystem() {
+ cassandraResource.start();
+ elasticSearchResource.start();
+ springResource.migrate();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
index 095179d..77e1c89 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/AnotherCassandraResourceIT.java
@@ -24,8 +24,7 @@ import org.slf4j.LoggerFactory;
public class AnotherCassandraResourceIT {
private static final Logger logger = LoggerFactory.getLogger( AnotherCassandraResourceIT.class );
- private SpringResource springResource = CassandraResourceITSuite.springResource;
- private static final long WAIT = 200L;
+ private SpringResource springResource = SpringResource.getInstance();
@Test
@@ -39,7 +38,6 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -47,7 +45,6 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain2() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -55,7 +52,6 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain3() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -63,7 +59,6 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain4() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -71,7 +66,6 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain5() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -79,6 +73,5 @@ public class AnotherCassandraResourceIT {
public void testItAgainAndAgain6() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
deleted file mode 100644
index be8b0b5..0000000
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/CassandraResourceITSuite.java
+++ /dev/null
@@ -1,41 +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.cassandra;
-
-
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-
-/**
- * An example TestSuite to demonstrate how to use the new CassandraResource ExternalResource. Note that this suite fires
- * up a CassandraResource and so does the first test class: in fact it fires up two together besides the third one fired
- * up by the suite. This demonstrates how the parallelism works along with the instance isolation.
- */
-@RunWith(ConcurrentSuite.class)
-@Suite.SuiteClasses({
- SpringResourceTest.class, // <== itself fires up instances
- AnotherCassandraResourceIT.class, // <== uses the existing suite instance
- YetAnotherCassandraResourceIT.class, // <== uses the existing suite instance
- OkThisIsTheLastIT.class // <== uses the existing suite instance
-})
-@Concurrent()
-public class CassandraResourceITSuite {
- @ClassRule
- public static SpringResource springResource = SpringResource.setPortsAndStartSpring();
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
index b0d7d88..da253d0 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/OkThisIsTheLastIT.java
@@ -27,12 +27,11 @@ import org.slf4j.LoggerFactory;
@Concurrent()
public class OkThisIsTheLastIT {
public static final Logger logger = LoggerFactory.getLogger( SpringResource.class );
- private static final long WAIT = 200L;
@Rule
public TestName name = new TestName();
- private SpringResource springResource = CassandraResourceITSuite.springResource;
+ private SpringResource springResource = SpringResource.getInstance();
@Test
@@ -47,7 +46,6 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -55,7 +53,6 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain2() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -63,7 +60,6 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain3() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -71,7 +67,6 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain4() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -79,7 +74,6 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain5() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
@@ -87,6 +81,5 @@ public class OkThisIsTheLastIT {
public void testItAgainAndAgain6() throws Exception {
String testBean = springResource.getBean( "testBean", String.class );
logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
index ccf53a3..08ced41 100644
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
+++ b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/SpringResourceTest.java
@@ -22,60 +22,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static junit.framework.Assert.assertTrue;
+import static junit.framework.TestCase.assertSame;
/** This tests the CassandraResource. */
@Concurrent()
public class SpringResourceTest {
public static final Logger LOG = LoggerFactory.getLogger( SpringResourceTest.class );
- public static final long WAIT = 200L;
-
-
- /** Tests to make sure port overrides works properly. */
- @Test
- public void testPortOverride() throws Throwable {
- int rpcPort;
- int storagePort;
- int sslStoragePort;
- int nativeTransportPort;
-
- do {
- rpcPort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_RPC_PORT + 1 );
- }
- while ( rpcPort == SpringResource.DEFAULT_RPC_PORT );
- LOG.info( "Setting rpc_port to {}", rpcPort );
-
- do {
- storagePort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_STORAGE_PORT + 1 );
- }
- while ( storagePort == SpringResource.DEFAULT_STORAGE_PORT || storagePort == rpcPort );
- LOG.info( "Setting storage_port to {}", storagePort );
-
- do {
- sslStoragePort = AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_SSL_STORAGE_PORT + 1 );
- }
- while ( sslStoragePort == SpringResource.DEFAULT_SSL_STORAGE_PORT || storagePort == sslStoragePort );
- LOG.info( "Setting ssl_storage_port to {}", sslStoragePort );
-
- do {
- nativeTransportPort =
- AvailablePortFinder.getNextAvailable( SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT + 1 );
- }
- while ( nativeTransportPort == SpringResource.DEFAULT_NATIVE_TRANSPORT_PORT
- || sslStoragePort == nativeTransportPort );
- LOG.info( "Setting native_transport_port to {}", nativeTransportPort );
-
- final SpringResource springResource =
- new SpringResource( rpcPort, storagePort, sslStoragePort, nativeTransportPort );
-
- springResource.before();
-
- // test here to see if we can access cassandra's ports
- // TODO - add some test code here using Hector
-
- LOG.info( "Got the test bean: " );
- }
-
@@ -87,25 +40,21 @@ public class SpringResourceTest {
*/
@Test
public void testDoubleTrouble() throws Throwable {
- SpringResource c1 = SpringResource.setPortsAndStartSpring();
- LOG.info( "Starting up first Cassandra instance: {}", c1 );
- c1.before();
+ SpringResource c1 = SpringResource.getInstance();
+ LOG.info( "Starting up first Spring instance: {}", c1 );
LOG.debug( "Waiting for the new instance to come online." );
- while ( !c1.isReady() ) {
- Thread.sleep( WAIT );
- }
- SpringResource c2 = SpringResource.setPortsAndStartSpring();
- LOG.debug( "Starting up second Cassandra instance: {}", c2 );
- c2.before();
+ SchemaManager c1SchemaManager = c1.getBean( SchemaManager.class );
+
+ SpringResource c2 = SpringResource.getInstance();
+ LOG.debug( "Starting up second Spring instance: {}", c2 );
+
+ SchemaManager c2SchemaManager = c2.getBean( SchemaManager.class );
LOG.debug( "Waiting a few seconds for second instance to be ready before shutting down." );
- while ( !c2.isReady() ) {
- Thread.sleep( WAIT );
- }
- LOG.debug( "Shutting Cassandra instances down." );
+ assertSame("Instances should be from the same spring context", c1SchemaManager, c2SchemaManager);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4ac86c9e/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java b/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
deleted file mode 100644
index 088e526..0000000
--- a/stack/test-utils/src/test/java/org/apache/usergrid/cassandra/YetAnotherCassandraResourceIT.java
+++ /dev/null
@@ -1,86 +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.cassandra;
-
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-@Concurrent()
-public class YetAnotherCassandraResourceIT {
- public static final Logger logger = LoggerFactory.getLogger( SpringResource.class );
- private static final long WAIT = 200L;
-
- private SpringResource springResource = CassandraResourceITSuite.springResource;
-
-
- @Test
- public void testUsage() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got the test bean: " + testBean );
- }
-
-
- @Test
- public void testItAgainAndAgain() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-
-
- @Test
- public void testItAgainAndAgain2() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-
-
- @Test
- public void testItAgainAndAgain3() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-
-
- @Test
- public void testItAgainAndAgain4() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-
-
- @Test
- public void testItAgainAndAgain5() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-
-
- @Test
- public void testItAgainAndAgain6() throws Exception {
- String testBean = springResource.getBean( "testBean", String.class );
- logger.info( "Got another testBean again: {}", testBean );
- Thread.sleep( WAIT );
- }
-}