Skip to content
Permalink
Browse files
use dynamic port for cassandra testing
git-svn-id: https://svn.apache.org/repos/asf/archiva/sandbox/trunk@1491404 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
olamy committed Jun 10, 2013
1 parent 43a6695 commit 5660df0f562e85f0330c2943e879e8ffbab5d243
Showing 2 changed files with 36 additions and 2 deletions.
@@ -222,6 +222,24 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-ports</id>
<phase>process-test-resources</phase>
<goals>
<goal>reserve-network-port</goal>
</goals>
<configuration>
<portNames>
<portName>cassandraPort</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<!-- TODO use dynamic port -->

<plugin>
@@ -235,6 +253,9 @@
<goals>
<goal>start</goal>
</goals>
<configuration>
<rpcPort>${cassandraPort}</rpcPort>
</configuration>
</execution>
<execution>
<id>stop-cassandra</id>
@@ -253,6 +274,19 @@
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<cassandraPort>${cassandraPort}</cassandraPort>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<repositories>
@@ -60,14 +60,14 @@
public void initialize()
throws ConnectionException
{

String cassandraPort = System.getProperty( "cassandraPort" );
keyspaceContext = new AstyanaxContext.Builder().forCluster( CLUSTER_NAME ).forKeyspace(
KEYSPACE_NAME ).withAstyanaxConfiguration(
new AstyanaxConfigurationImpl().setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE ).setConnectionPoolType(
ConnectionPoolType.TOKEN_AWARE ) ).withConnectionPoolConfiguration(
new ConnectionPoolConfigurationImpl( CLUSTER_NAME + "_" + KEYSPACE_NAME ).setSocketTimeout(
30000 ).setMaxTimeoutWhenExhausted( 2000 ).setMaxConnsPerHost( 20 ).setInitConnsPerHost( 10 ).setSeeds(
"localhost:9160" ) ).withConnectionPoolMonitor( new CountingConnectionPoolMonitor() ).buildKeyspace(
"localhost:"+ cassandraPort ) ).withConnectionPoolMonitor( new CountingConnectionPoolMonitor() ).buildKeyspace(
ThriftFamilyFactory.getInstance() );

keyspaceContext.start();

0 comments on commit 5660df0

Please sign in to comment.