Author: olamy
Date: Mon Jun 10 10:44:06 2013
New Revision: 1491404
URL: http://svn.apache.org/r1491404
Log:
use dynamic port for cassandra testing
Modified:
archiva/sandbox/trunk/metadata-store-cassandra/pom.xml
archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraEntityManagerFactory.java
Modified: archiva/sandbox/trunk/metadata-store-cassandra/pom.xml
URL:
http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/pom.xml?rev=1491404&r1=1491403&r2=1491404&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/pom.xml (original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/pom.xml Mon Jun 10 10:44:06
2013
@@ -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>
Modified:
archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraEntityManagerFactory.java
URL:
http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraEntityManagerFactory.java?rev=1491404&r1=1491403&r2=1491404&view=diff
==============================================================================
---
archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraEntityManagerFactory.java
(original)
+++
archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraEntityManagerFactory.java
Mon Jun 10 10:44:06 2013
@@ -60,14 +60,14 @@ public class DefaultCassandraEntityManag
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();