Repository: incubator-usergrid Updated Branches: refs/heads/USERGRID-273 e80df0d5a -> b61349865
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 deleted file mode 100644 index 9e0e86e..0000000 --- a/stack/test-utils/src/main/java/org/apache/usergrid/setup/SystemSetup.java +++ /dev/null @@ -1,90 +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.setup; - - -import java.io.File; - -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 for Cassandra 2) Inject the properties for Elastic Search 3) Initialize spring 4) If we - * obtain the lock, we then initialize cassandra. 5) After initialization, we proceed. - */ -public class SystemSetup { - - private static final String TEMP_FILE_PATH = "target/surefirelocks/start_barrier-" + System.getProperty( "test.barrier.timestamp", "default" ); - - public static final int LOCK_PORT = Integer.parseInt( System.getProperty( "test.lock.port", "10101") ); - - - public static final long ONE_MINUTE = 60000; - - final MultiProcessLocalLock lock = new MultiProcessLocalLock( LOCK_PORT ); - final MultiProcessBarrier barrier = new MultiProcessBarrier( TEMP_FILE_PATH ); - - - /** - * Use the file system to create a multi process lock. If we have the lock, perform the initialization of the - * system. - */ - public void maybeInitialize() throws Exception { - - - //we have a lock, so init the system - if ( lock.tryLock() ) { - - //wire up cassandra and elasticsearch before we start spring, otherwise this won't work - new CassandraResource().start(); - - new ElasticSearchResource().start(); - - SpringResource.getInstance().migrate(); - - - //signal to other processes we've migrated, and they can proceed - barrier.proceed(); - } - - - barrier.await( ONE_MINUTE ); - - lock.maybeReleaseLock(); - } - - - /** - * Delete the files after we start - */ - private void deleteFile( final String fileName ) { - File file = new File( fileName ); - - if ( file.exists() ) { - file.delete(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 da253d0..2f54ba5 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 @@ -23,8 +23,6 @@ import org.junit.rules.TestName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -@Concurrent() public class OkThisIsTheLastIT { public static final Logger logger = LoggerFactory.getLogger( SpringResource.class ); http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1fbe3e54/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 08ced41..140e318 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 @@ -26,7 +26,6 @@ import static junit.framework.TestCase.assertSame; /** This tests the CassandraResource. */ -@Concurrent() public class SpringResourceTest { public static final Logger LOG = LoggerFactory.getLogger( SpringResourceTest.class );