You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/02/13 04:55:33 UTC
[1/2] incubator-usergrid git commit: First pass for refactoring tomcat
Repository: incubator-usergrid
Updated Branches:
refs/heads/USERGRID-273 05e06671c -> 75a8361cd
First pass for refactoring tomcat
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/9b118602
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/9b118602
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/9b118602
Branch: refs/heads/USERGRID-273
Commit: 9b11860230124e511a3f39e9e77e81f4e01ab411
Parents: 05e0667
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Feb 12 16:41:12 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Feb 12 16:41:12 2015 -0700
----------------------------------------------------------------------
stack/rest/pom.xml | 5 +-
.../java/org/apache/usergrid/rest/ITSetup.java | 2 +
.../apache/usergrid/rest/TomcatResource.java | 337 ++-----------------
3 files changed, 40 insertions(+), 304 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b118602/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index c2b8502..7fa0abe 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -32,6 +32,7 @@
<!-- Override these properties in an active profile within your settings.xml -->
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
+ <usergrid.rest.threads>1C</usergrid.rest.threads>
</properties>
@@ -111,8 +112,8 @@
<target.directory>${project.build.directory}</target.directory>
</systemPropertyVariables>
<parallel>methods</parallel>
- <forkCount>${usergrid.it.forkCount}</forkCount>
- <threadCount>${usergrid.it.threads}</threadCount>
+ <forkCount>1</forkCount>
+ <threadCount>${usergrid.rest.threads}</threadCount>
<reuseForks>true</reuseForks>
<argLine>-Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true -Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b118602/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 d107fd6..021f937 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
@@ -52,6 +52,8 @@ public class ITSetup {
this.springResource = ConcurrentProcessSingleton.getInstance().getSpringResource();
+ //start tomcat
+
emf = springResource.getBean( EntityManagerFactory.class );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9b118602/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
index 13c5088..0446ef1 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
@@ -47,332 +47,84 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
- * Setup Tomcat to run Usergrid from src/main/webapps plus inherited (Maven) classpath.
- * Caller must provide Cassandra and ElasticSearch ports.
- * Generates Usergrid properties files.
+ * Simple singleton to get tests running again. A temporary solution until we start using
+ * Arquillian
+ *
*/
-public class TomcatResource extends ExternalResource {
+public class TomcatResource {
private static final Logger log = LoggerFactory.getLogger(TomcatResource.class);
- public static final TomcatResource instance = new TomcatResource();
+ public static TomcatResource instance;
- private static final Object mutex = new Object();
- private String webAppsPath;
- private int port;
- private int esPort;
- private int cassPort;
- private boolean started = false;
- private Properties properties;
- private boolean forkTomcat = true;
- private static AtomicInteger clientCount = new AtomicInteger(0);
+ private Tomcat tomcat = null;
+ private int port;
- Tomcat tomcat = null;
- Process process = null;
- protected TomcatResource() {
- try {
- String[] locations = { "usergrid-properties-context.xml" };
- ConfigurableApplicationContext appContext =
- new ClassPathXmlApplicationContext( locations );
-
- properties = (Properties)appContext.getBean("properties");
+ public static synchronized TomcatResource getInstance(){
+ if(instance == null){
+ instance = new TomcatResource();
+ }
- } catch (Exception ex) {
- throw new RuntimeException("Error getting properties", ex);
- }
+ return instance;
}
-
- @Override
- protected void after() {
- log.info("Entering after");
-
- synchronized (mutex) {
-
- if ( clientCount.decrementAndGet() < 1 ) {
-
- log.info("----------------------------------------------------------------------");
- log.info("Destroying Tomcat running on port " + port);
- log.info("----------------------------------------------------------------------");
-
- if ( process != null ) {
- process.destroy();
-
- } else if ( tomcat != null ) {
- try {
- tomcat.stop();
- tomcat.destroy();
- } catch (LifecycleException ex) {
- log.error("Error stopping Tomcat", ex);
- }
- }
- started = false;
-
- } else {
- log.info("NOT stopping Tomcat because it is still in use by {}", clientCount.get());
- }
+ private TomcatResource(){
+ try {
+ startTomcatEmbedded();
}
-
- log.info("Leaving after");
- }
-
-
- @Override
- protected void before() throws Throwable {
- log.info("Entering before");
-
- String esStartup = properties.getProperty("tomcat.startup");
- if ( "forked".equals( esStartup )) {
- forkTomcat = true;
- } else {
- forkTomcat = false;
+ catch ( Exception e ) {
+ throw new RuntimeException( "Unable to delete tomcat" );
}
-
- synchronized (mutex) {
-
- clientCount.incrementAndGet();
-
- if (started) {
- log.info("NOT starting Tomcat because it is already started");
- log.info("Leaving before: {} users of Tomcat", clientCount.get());
- return;
- }
-
- if ( forkTomcat ) {
- process = startTomcatProcess();
- } else {
- startTomcatEmbedded();
- }
-
- log.info("Leaving before: Started Tomcat, now {} users", clientCount.get());
- }
-
- }
-
-
- private String createPropDir() {
- String propDirName = "target" + File.separator + "tomcat_" + port;
- File newDir = new File( propDirName );
- newDir.mkdirs();
- String propDirPath = newDir.getAbsolutePath();
- return propDirPath;
}
-
private void waitForTomcat() throws RuntimeException {
- String url = "http://localhost:" + port + "/status";
+ String url = "http://localhost:" + port + "/status";
int count = 0;
while (count++ < 30) {
try {
Thread.sleep(1000);
Client c = Client.create();
WebResource wr = c.resource( url );
- wr.get(String.class);
+ wr.get( String.class );
log.info("Tomcat is started.");
- started = true;
- break;
-
+ return;
+
} catch (Exception e) {
log.info("Waiting for Tomcat on url {}", url);
}
}
- if ( !started ) {
- throw new RuntimeException("Tomcat process never started.");
- }
- }
-
-
- private void startTomcatEmbedded() throws ServletException, LifecycleException {
-
- File dataDir = Files.createTempDir();
- dataDir.deleteOnExit();
-
- port = AvailablePortFinder.getNextAvailable( 9998 + RandomUtils.nextInt(10) );
- String threads = (String)properties.get("tomcat.threads");
- tomcat = new Tomcat();
- tomcat.setBaseDir( dataDir.getAbsolutePath() );
- tomcat.setPort( port );
- tomcat.getConnector().setAttribute("maxThreads", "2000");
- tomcat.addWebapp( "/", new File( getWebAppsPath() ).getAbsolutePath() );
+ throw new RuntimeException("Tomcat process never started.");
- log.info("-----------------------------------------------------------------");
- log.info("Starting Tomcat embedded port {} dir {}", port, dataDir.getAbsolutePath());
- log.info("-----------------------------------------------------------------");
- tomcat.start();
-
- waitForTomcat();
-
- mutex.notifyAll();
}
- private Process startTomcatProcess() throws IOException {
-
- port = AvailablePortFinder.getNextAvailable(9998 + RandomUtils.nextInt(10));
-
- String propDirPath = createPropDir();
-
- createPropertyFilesForForkedTomcat( propDirPath );
-
- String javaHome = (String)System.getenv("JAVA_HOME");
-
- String logConfig = "-Dlog4j.configuration=file:./src/test/resources/log4j.properties";
- String maxMemory = "-Xmx1000m";
-
- ProcessBuilder pb = new ProcessBuilder(javaHome + "/bin/java", maxMemory, logConfig,
- "org.apache.usergrid.TomcatMain", "src/main/webapp", port + "");
-
- // ensure Tomcat gets same classpath we have, but with...
- String classpath = System.getProperty("java.class.path");
- List<String> path = new ArrayList<String>();
-
- // our properties dir at the start
- path.add( propDirPath );
-
- String parts[] = classpath.split( File.pathSeparator );
- for ( String part : parts ) {
- if ( part.endsWith("test-classes") ) {
- continue;
- }
- path.add(part);
- }
- String newClasspath = StringUtils.join( path, File.pathSeparator );
-
- Map<String, String> env = pb.environment();
- StringBuilder sb = new StringBuilder();
- sb.append( newClasspath );
- env.put("CLASSPATH", sb.toString());
-
- //pb.directory(new File("."));
- pb.redirectErrorStream(true);
+ private void startTomcatEmbedded() throws ServletException, LifecycleException {
- final Process p = pb.start();
+ File dataDir = Files.createTempDir();
+ dataDir.deleteOnExit();
- //log.debug("Started Tomcat process with classpath = " + newClasspath );
+ port = AvailablePortFinder.getNextAvailable( 9998 + RandomUtils.nextInt( 10 ) );
- // use thread to log Tomcat output
- new Thread( new Runnable() {
- @Override
- public void run() {
- BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String line = null;
- try {
- while ((line = br.readLine()) != null) {
- log.info(line);
- }
- } catch (Exception ex) {
- log.error("Error reading from Tomcat process", ex);
- return;
- }
- }
- }).start();
+ tomcat = new Tomcat();
+ tomcat.setBaseDir( dataDir.getAbsolutePath() );
+ tomcat.setPort( port );
+ tomcat.getConnector().setAttribute( "maxThreads", "2000" );
+ tomcat.addWebapp( "/", new File( "target/ROOT" ).getAbsolutePath() );
+ log.info( "-----------------------------------------------------------------" );
+ log.info( "Starting Tomcat embedded port {} dir {}", port, dataDir.getAbsolutePath() );
+ log.info( "-----------------------------------------------------------------" );
+ tomcat.start();
waitForTomcat();
-
- Runtime.getRuntime().addShutdownHook( new Thread() {
- @Override
- public void run() {
- after();
- }
- } );
-
- mutex.notifyAll();
-
- return p;
}
- private void createPropertyFilesForForkedTomcat( String propDirPath ) throws IOException {
-
- PrintWriter pw = new PrintWriter(
- new FileWriter( propDirPath + File.separator + "usergrid-deployment.properties"));
-
- pw.println("cassandra.url=localhost:" + cassPort);
- pw.println("cassandra.version=1.2");
- pw.println("cassandra.cluster_name=Usergrid");
- pw.println("cassandra.connections=600");
- pw.println("cassandra.timeout=5000");
-
- pw.println("elasticsearch.hosts=127.0.0.1");
- pw.println("elasticsearch.port=" + esPort);
- pw.println("elasticsearch.cluster_name=test_cluster");
- pw.println("elasticsearch.index_prefix=usergrid");
- pw.println("elasticsearch.startup=remote");
- pw.println("elasticsearch.force_refresh=" + properties.getProperty("elasticsearch.force_refresh"));
-
- pw.println("collections.keyspace=Usergrid_Applications");
- pw.println("collections.keyspace.strategy.options=replication_factor:1");
- pw.println("collections.keyspace.strategy.class=org.apache.cassandra.locator.SimpleStrategy");
- pw.println("collection.stage.transient.timeout=6");
-
- pw.println("usergrid.mongo.disable=true");
- pw.println("swagger.basepath=http://sometestvalue");
- pw.println("usergrid.counter.batch.size=1");
- pw.println("usergrid.test=true");
-
- pw.println("usergrid.sysadmin.login.name=superuser");
- pw.println("usergrid.sysadmin.login.email=superuser@usergrid.com");
- pw.println("usergrid.sysadmin.login.password=superpassword");
- pw.println("usergrid.sysadmin.login.allowed=true");
-
- pw.println("mail.transport.protocol=smtp");
- pw.println("mail.store.protocol=imap");
- pw.println("mail.smtp.host=usergrid.com");
- pw.println("mail.smtp.username=testuser");
- pw.println("mail.smtp.password=testpassword");
-
- pw.println("index.query.limit.default=1000");
-
- pw.println("usergrid.recaptcha.public=");
- pw.println("usergrid.recaptcha.private=");
- pw.println("usergrid.sysadmin.email=");
-
- pw.println("usergrid.management.admin_users_require_confirmation=false");
- pw.println("usergrid.management.admin_users_require_activation=false");
- pw.println("usergrid.management.notify_admin_of_activation=false");
- pw.println("usergrid.management.organizations_require_confirmation=false");
- pw.println("usergrid.management.organizations_require_activation=false");
- pw.println("usergrid.management.notify_sysadmin_of_new_organizations=false");
- pw.println("usergrid.management.notify_sysadmin_of_new_admin_users=false");
-
- pw.println("usergrid.setup-test-account=true");
- pw.println("usergrid.test-account.app=test-app");
- pw.println("usergrid.test-account.organization=test-organization");
- pw.println("usergrid.test-account.admin-user.username=test");
- pw.println("usergrid.test-account.admin-user.name=Test User");
- pw.println("usergrid.test-account.admin-user.email=test@usergrid.com");
- pw.println("usergrid.test-account.admin-user.password=test");
-
- pw.flush();
- pw.close();
-
-
-// // include all properties
-// Map<String, String> allProperties = new HashMap<String, String>();
-// for ( Object name : properties.keySet() ) {
-// allProperties.put( (String)name, properties.getProperty((String)name));
-// }
-//
-// // override some properties with correct port numbers
-// allProperties.put("cassandra.url", "localhost:" + cassPort);
-// allProperties.put("elasticsearch.hosts", "127.0.0.1");
-// allProperties.put("elasticsearch.port", ""+esPort );
-//
-// PrintWriter pw = new PrintWriter(
-// new FileWriter( propDirPath + File.separator + "usergrid-deployment.properties"));
-// for ( String name : allProperties.keySet() ) {
-// pw.println(name + "=" + allProperties.get( name ));
-// }
-// pw.flush();
-// pw.close();
- }
-
/**
* Get the port Tomcat runs on.
*/
@@ -380,23 +132,4 @@ public class TomcatResource extends ExternalResource {
return port;
}
- public String getWebAppsPath() {
- return webAppsPath;
- }
-
- public void setWebAppsPath(String webAppsPath) {
- this.webAppsPath = webAppsPath;
- }
-
- void setCassandraPort(int cassPort) {
- this.cassPort = cassPort;
- }
-
- void setElasticSearchPort(int esPort) {
- this.esPort = esPort;
- }
-
- void setProperties(Properties properties) {
- this.properties = properties;
- }
}
[2/2] incubator-usergrid git commit: First pass at embedded tomcat.
Experiencing classloading issues.
Posted by to...@apache.org.
First pass at embedded tomcat. Experiencing classloading issues.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/75a8361c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/75a8361c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/75a8361c
Branch: refs/heads/USERGRID-273
Commit: 75a8361cd425608a70ae325cde1f62cb179cfbed
Parents: 9b11860
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Feb 12 20:55:31 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Feb 12 20:55:31 2015 -0700
----------------------------------------------------------------------
.../org/apache/usergrid/batch/service/App.java | 86 ------
.../batch/job/AbstractSchedulerRuntimeIT.java | 3 +-
stack/corepersistence/pom.xml | 2 +-
stack/pom.xml | 10 +-
stack/rest/pom.xml | 274 +++++++++----------
.../resources/usergrid-rest-deploy-context.xml | 6 +-
.../apache/usergrid/rest/AbstractRestIT.java | 25 ++
.../apache/usergrid/rest/TomcatResource.java | 135 ---------
.../endpoints/mgmt/ApplicationResource.java | 10 +-
stack/rest/src/test/resources/arquillian.xml | 43 +++
.../apache/usergrid/services/ServiceInfo.java | 5 +-
11 files changed, 221 insertions(+), 378 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/core/src/main/java/org/apache/usergrid/batch/service/App.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/batch/service/App.java b/stack/core/src/main/java/org/apache/usergrid/batch/service/App.java
deleted file mode 100644
index d339c4c..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/batch/service/App.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.batch.service;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-import com.google.common.base.CharMatcher;
-
-
-/**
- * Entry point for CLI functions of Usergrid batch framework
- * <p/>
- * To run this with the built-in examples, invoke it thusly from the top level of the project directory:
- * <p/>
- * mvn -e exec:java -Dexec.mainClass="org.apache.usergrid.batch.App" -Dexec.args="-appContext
- * src/test/resources/appContext.xml"
- *
- * @author zznate
- */
-public class App {
-
- private static Logger logger = LoggerFactory.getLogger( App.class );
-
- private ApplicationContext appContext;
- private final org.apache.usergrid.batch.AppArgs appArgs;
-
-
- public static void main( String[] args ) {
- org.apache.usergrid.batch.AppArgs appArgs = org.apache.usergrid.batch.AppArgs.parseArgs( args );
- if ( logger.isDebugEnabled() ) {
- logger.debug( "Invoked App with appArgs: {}", appArgs.toString() );
- }
-
- App app = new App( appArgs );
-
- app.loadContext();
-
- logger.info( "Context loaded, invoking execute() ..." );
- app.doExecute();
- }
-
-
- App( org.apache.usergrid.batch.AppArgs appArgs ) {
- this.appArgs = appArgs;
- }
-
-
- private void loadContext() {
- logger.info( "loading context" );
- // spring context
- int index = CharMatcher.is( ':' ).indexIn( appArgs.getAppContext() );
- if ( index > 0 ) {
- appContext = new ClassPathXmlApplicationContext( appArgs.getAppContext().substring( ++index ) );
- }
- else {
- appContext = new FileSystemXmlApplicationContext( appArgs.getAppContext() );
- }
- }
-
-
- private void doExecute() {
- JobSchedulerService bjss = appContext.getBean( "bulkJobScheduledService", JobSchedulerService.class );
- logger.info( "starting scheduledService..." );
- bjss.startAndWait();
- logger.info( "scheduledService started." );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/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 8825497..534689c 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
@@ -96,7 +96,8 @@ public class AbstractSchedulerRuntimeIT {
JobSchedulerService jobScheduler = springResource.getBean( JobSchedulerService.class );
jobScheduler.setJobListener( listener );
if ( jobScheduler.state() != State.RUNNING ) {
- jobScheduler.startAndWait();
+ jobScheduler.startAsync();
+ jobScheduler.awaitRunning();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/pom.xml b/stack/corepersistence/pom.xml
index 9bd53fa..c89e62f 100644
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@ -61,7 +61,7 @@ limitations under the License.
<commons.lang.version>3.1</commons.lang.version>
<elasticsearch.version>1.3.2</elasticsearch.version>
<fasterxml-uuid.version>3.1.3</fasterxml-uuid.version>
- <guava.version>15.0</guava.version>
+ <guava.version>18.0</guava.version>
<guice.version>4.0-beta5</guice.version>
<guicyfig.version>3.2</guicyfig.version>
<hystrix.version>1.3.16</hystrix.version>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 2a08f91..27bd1bb 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -89,7 +89,6 @@
<ug.heapmin>2048m</ug.heapmin>
<ug.argline>-Djava.awt.headless=true</ug.argline>
- <usergrid-custom-spring-properties>classpath:/usergrid-deployment.properties</usergrid-custom-spring-properties>
<usergrid-custom-spring-test-properties>classpath:/usergrid-custom-test.properties</usergrid-custom-spring-test-properties>
<!-- =================================================================== -->
@@ -816,7 +815,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>15.0</version>
+ <version>18.0</version>
</dependency>
<dependency>
@@ -944,6 +943,13 @@
<version>${jackson-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>${jackson-version}</version>
+ </dependency>
+
+
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/pom.xml
----------------------------------------------------------------------
diff --git a/stack/rest/pom.xml b/stack/rest/pom.xml
index 7fa0abe..1c2e3ba 100644
--- a/stack/rest/pom.xml
+++ b/stack/rest/pom.xml
@@ -32,9 +32,56 @@
<!-- Override these properties in an active profile within your settings.xml -->
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
- <usergrid.rest.threads>1C</usergrid.rest.threads>
+ <usergrid.rest.threads>8</usergrid.rest.threads>
+ <guice.version>4.0-beta5</guice.version>
</properties>
+ <!-- profile that arquillian uses when it builds/starts tomcat -->
+ <profiles>
+ <profile>
+ <id>arquillian-tomcat</id>
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>7.0.59</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>7.0.59</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>7.0.59</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ <version>3.7</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Weld servlet for testing CDI injections -->
+ <dependency>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
+ <version>2.2.9.Final</version>
+ </dependency>
+
+ </dependencies>
+
+
+ </profile>
+
+
+ </profiles>
<build>
<finalName>ROOT</finalName>
@@ -60,6 +107,7 @@
</testResource>
</testResources>
+
<plugins>
<plugin>
@@ -67,24 +115,21 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
<configuration>
- <skipTests>true</skipTests>
- <!--<systemPropertyVariables>-->
- <!--<storage-config>${basedir}/src/test/conf</storage-config>-->
- <!--<target.directory>${project.build.directory}</target.directory>-->
- <!--</systemPropertyVariables>-->
- <!--<parallel>methods</parallel>-->
- <!--<forkCount>${usergrid.it.forkCount}</forkCount>-->
- <!--<threadCount>${usergrid.it.threads}</threadCount>-->
- <!--<reuseForks>true</reuseForks>-->
- <!--<argLine>-Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true-->
- <!---Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8-->
- <!---javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar-->
- <!--${ug.argline}-->
- <!--</argLine>-->
- <!--<includes>-->
- <!--<include>**/*IT.java</include>-->
- <!--<include>**/*Test.java</include>-->
- <!--</includes>-->
+ <!--<skipTests>true</skipTests>-->
+ <systemPropertyVariables>
+ <storage-config>${basedir}/src/test/conf</storage-config>
+ <target.directory>${project.build.directory}</target.directory>
+ </systemPropertyVariables>
+ <parallel>methods</parallel>
+ <forkCount>1</forkCount>
+ <threadCount>${usergrid.rest.threads}</threadCount>
+ <reuseForks>true</reuseForks>
+ <argLine>-Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true -Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}
+ </argLine>
+ <includes>
+ <include>**/*IT.java</include>
+ <include>**/*Test.java</include>
+ </includes>
</configuration>
@@ -97,46 +142,6 @@
</dependencies>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>${surefire.plugin.version}</version>
- <configuration>
- <includes>
- <include>**/*IT.java</include>
- <include>**/*Test.java</include>
- </includes>
-
- <systemPropertyVariables>
- <storage-config>${basedir}/src/test/conf</storage-config>
- <target.directory>${project.build.directory}</target.directory>
- </systemPropertyVariables>
- <parallel>methods</parallel>
- <forkCount>1</forkCount>
- <threadCount>${usergrid.rest.threads}</threadCount>
- <reuseForks>true</reuseForks>
- <argLine>-Dtest.barrier.timestamp=${maven.build.timestamp} -Dtest.clean.storage=true -Xmx${ug.heapmax} -Xms${ug.heapmin} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.surefire</groupId>
- <artifactId>surefire-junit47</artifactId>
- <version>${surefire.plugin.version}</version>
- </dependency>
- </dependencies>
-
- <!-- run the integration tests then verify the results -->
- <executions>
- <execution>
- <id>failsafe-integration-tests</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -204,77 +209,6 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.4.12</version>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
-
- <configuration>
- <container>
- <containerId>tomcat7x</containerId>
- <!-- Run the latest version of to tomcat 7 -->
- <zipUrlInstaller>
- <url>http://mirror.tcpdiag.net/apache/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.zip</url>
- </zipUrlInstaller>
-
- </container>
- <configuration>
- <configfiles>
- <configfile>
- <file>${project.basedir}/target/test-classes/usergrid-deployment.properties</file>
- <todir>lib</todir>
- </configfile>
- </configfiles>
- <!--If you're getting port conflicts, override the ports here-->
- <properties>
- <cargo.jvmargs>-Xmx1G -Xms500m -server -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000</cargo.jvmargs>
- <!--<cargo.rmi.port>10200</cargo.rmi.port>-->
- <!--<cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>-->
- <!--<cargo.tomcat.ajp.port>10201</cargo.tomcat.ajp.port>-->
- </properties>
-
-
- </configuration>
-
- <deployables>
- <!-- This deployable specifies the webapp you want to deploy -->
- <deployable>
- <groupId>${project.groupId}</groupId>
- <artifactId>${project.artifactId}</artifactId>
- <type>war</type>
- </deployable>
-
- </deployables>
-
-
-
-
- <!--<configFiles>-->
- <!--<configfile>-->
- <!--<file>${project.basedir}/src/main/config/jetty-env.xml</file>-->
- <!--<todir>webapps/datasource-war/WEB-INF</todir>-->
- <!--</configfile>-->
- </configuration>
- </plugin>
-
-
</plugins>
</build>
@@ -434,35 +368,91 @@
<scope>test</scope>
</dependency>
-<!-- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
+ <!-- arquillian deps -->
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-xc</artifactId>
+ <version>${jackson-version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
+
+ <!--<dependency>-->
+ <!--<groupId>org.jboss.arquillian.container</groupId>-->
+ <!--<artifactId>arquillian-tomcat-embedded-7</artifactId>-->
+ <!--<version>1.1.7.Final</version>-->
+ <!--<scope>test</scope>-->
+ <!--</dependency>-->
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-bom</artifactId>
+ <version>1.1.7.Final</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>1.1.7.Final</version>
<scope>test</scope>
</dependency>
+
+
+ <!-- Some arquillian dependency runs and old version of guice. We're overridding it here so that we include
+ the right value into the test scope -->
<dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ <version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jasper-el</artifactId>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-assistedinject</artifactId>
+ <version>${guice.version}</version>
<scope>test</scope>
</dependency>
+
+ <!-- documentation here
+ https://github.com/shrinkwrap/resolver
+ -->
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <version>2.1.1</version>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+
+ <!--<dependency>-->
+ <!--<groupId>org.jboss.shrinkwrap.resolver</groupId>-->
+ <!--<artifactId>shrinkwrap-resolver-impl-maven</artifactId>-->
+ <!--<scope>test</scope>-->
+ <!--<version>2.1.1</version>-->
+ <!--</dependency>-->
+
+
<dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ <version>1.0.0.CR7</version>
<scope>test</scope>
- </dependency>-->
+ </dependency>
<!-- use the external test client. Just depend on the maven jetty plugin to launch jetty -->
<dependency>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/src/main/resources/usergrid-rest-deploy-context.xml
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/resources/usergrid-rest-deploy-context.xml b/stack/rest/src/main/resources/usergrid-rest-deploy-context.xml
index 73a4bd2..d240231 100644
--- a/stack/rest/src/main/resources/usergrid-rest-deploy-context.xml
+++ b/stack/rest/src/main/resources/usergrid-rest-deploy-context.xml
@@ -24,8 +24,8 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<import resource="classpath:/usergrid-rest-context.xml" />
-
-
+
+
<bean id="properties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="singleton" value="true" />
@@ -33,7 +33,7 @@
<property name="locations">
<list>
<value>classpath:/usergrid-default.properties</value>
- <value>${usergrid-custom-spring-properties}</value>
+ <value>classpath:/usergrid-deployment.properties</value>
</list>
</property>
</bean>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
index 202e500..41b3be5 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
@@ -39,11 +39,20 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.usergrid.java.client.Client;
import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
import static org.apache.usergrid.utils.MapUtils.hashMap;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;
import org.junit.AfterClass;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +65,7 @@ import org.slf4j.LoggerFactory;
* failure condition if multiple]
*/
//
+@RunWith( Arquillian.class )
public abstract class AbstractRestIT extends JerseyTest {
private static final Logger LOG = LoggerFactory.getLogger( AbstractRestIT.class );
private static boolean usersSetup = false;
@@ -91,6 +101,21 @@ public abstract class AbstractRestIT extends JerseyTest {
}
+ @Deployment(testable = false)
+ public static WebArchive createTestArchive() {
+
+ //we use the MavenImporter from shrinkwrap to just produce whatever maven would build then test with it
+
+ //set maven to be in offline mode
+ System.setProperty( "org.apache.maven.offline", "true" );
+
+ return ShrinkWrap.create(MavenImporter.class)
+ .loadPomFromFile("pom.xml", "arquillian-tomcat" ).importBuildOutput().as(WebArchive.class);
+
+ }
+
+
+
@AfterClass
public static void teardown() {
access_token = null;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
deleted file mode 100644
index 0446ef1..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/TomcatResource.java
+++ /dev/null
@@ -1,135 +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.rest;
-
-import com.google.common.io.Files;
-import java.io.File;
-
-import org.junit.rules.ExternalResource;
-import org.apache.usergrid.cassandra.AvailablePortFinder;
-
-import org.apache.commons.lang.math.RandomUtils;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import java.io.BufferedReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
-import javax.servlet.ServletException;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- * Simple singleton to get tests running again. A temporary solution until we start using
- * Arquillian
- *
- */
-public class TomcatResource {
- private static final Logger log = LoggerFactory.getLogger(TomcatResource.class);
-
- public static TomcatResource instance;
-
-
- private Tomcat tomcat = null;
- private int port;
-
-
-
- public static synchronized TomcatResource getInstance(){
- if(instance == null){
- instance = new TomcatResource();
- }
-
- return instance;
- }
-
- private TomcatResource(){
- try {
- startTomcatEmbedded();
- }
- catch ( Exception e ) {
- throw new RuntimeException( "Unable to delete tomcat" );
- }
- }
-
- private void waitForTomcat() throws RuntimeException {
- String url = "http://localhost:" + port + "/status";
- int count = 0;
- while (count++ < 30) {
- try {
- Thread.sleep(1000);
- Client c = Client.create();
- WebResource wr = c.resource( url );
- wr.get( String.class );
- log.info("Tomcat is started.");
- return;
-
- } catch (Exception e) {
- log.info("Waiting for Tomcat on url {}", url);
- }
- }
-
-
- throw new RuntimeException("Tomcat process never started.");
-
- }
-
-
- private void startTomcatEmbedded() throws ServletException, LifecycleException {
-
- File dataDir = Files.createTempDir();
- dataDir.deleteOnExit();
-
- port = AvailablePortFinder.getNextAvailable( 9998 + RandomUtils.nextInt( 10 ) );
-
-
- tomcat = new Tomcat();
- tomcat.setBaseDir( dataDir.getAbsolutePath() );
- tomcat.setPort( port );
- tomcat.getConnector().setAttribute( "maxThreads", "2000" );
- tomcat.addWebapp( "/", new File( "target/ROOT" ).getAbsolutePath() );
-
- log.info( "-----------------------------------------------------------------" );
- log.info( "Starting Tomcat embedded port {} dir {}", port, dataDir.getAbsolutePath() );
- log.info( "-----------------------------------------------------------------" );
- tomcat.start();
-
- waitForTomcat();
- }
-
-
- /**
- * Get the port Tomcat runs on.
- */
- public int getPort() {
- return port;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
index 4ee8055..a820a7b 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource2point0/endpoints/mgmt/ApplicationResource.java
@@ -20,18 +20,14 @@
package org.apache.usergrid.rest.test.resource2point0.endpoints.mgmt;
-import org.apache.usergrid.batch.service.App;
+
+import javax.ws.rs.core.MediaType;
+
import org.apache.usergrid.rest.test.resource2point0.endpoints.NamedResource;
import org.apache.usergrid.rest.test.resource2point0.endpoints.UrlResource;
-import org.apache.usergrid.rest.test.resource2point0.model.ApiResponse;
import org.apache.usergrid.rest.test.resource2point0.model.Application;
-import org.apache.usergrid.rest.test.resource2point0.model.Organization;
-import org.apache.usergrid.rest.test.resource2point0.model.Token;
import org.apache.usergrid.rest.test.resource2point0.state.ClientContext;
-import javax.ws.rs.core.MediaType;
-import java.util.Map;
-
/**
* Classy class class.
*/
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/rest/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/arquillian.xml b/stack/rest/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..a208aeb
--- /dev/null
+++ b/stack/rest/src/test/resources/arquillian.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ~ 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.
+ -->
+
+<arquillian
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://jboss.org/schema/arquillian"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <!--<container qualifier="tomcat" default="true">-->
+ <!--<configuration>-->
+ <!--<property name="unpackArchive">true</property>-->
+ <!--</configuration>-->
+ <!--</container>-->
+
+
+ <container qualifier="tomcat" default="true">
+ <configuration>
+ <property name="tomcatHome">target/tomcat-embedded-7</property>
+ <property name="workDir">work</property>
+ <property name="bindHttpPort">8888</property>
+ <property name="unpackArchive">true</property>
+ <property name="serverName">arquillian-tomcat-embedded-7</property>
+ </configuration>
+ </container>
+</arquillian>
+
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75a8361c/stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java b/stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java
index ea85686..0d34e1e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java
@@ -17,6 +17,7 @@
package org.apache.usergrid.services;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -44,6 +45,8 @@ import static org.apache.usergrid.utils.StringUtils.stringOrSubstringBeforeLast;
public class ServiceInfo {
+ public static final Charset UTF_8 = Charset.forName( "UTF-8" );
+
private final String name;
private final boolean rootService;
private final String rootType;
@@ -71,7 +74,7 @@ public class ServiceInfo {
Hasher hasher = Hashing.md5().newHasher();
for ( String pattern : patterns ) {
- hasher.putString( pattern );
+ hasher.putString( pattern, UTF_8 );
}
hashCode = hasher.hash().asInt();