Permalink
Browse files

Cassandra plugin - using static final literal constants for repeated …

…values

Also added remark in YAML file as to the need of these values to match the ones in the file
  • Loading branch information...
1 parent 3a524a2 commit d56a86e941f572a3cba7945069df05e5dde6d6d1 lgoldstein committed Dec 23, 2012
@@ -25,6 +25,11 @@
import com.springsource.insight.intercept.operation.OperationType;
public abstract class AbstractOperationCollectionAspectTest extends OperationCollectionAspectTestSupport {
+
+ protected AbstractOperationCollectionAspectTest() {
+ super();
+ }
+
public void validate(OperationType opType, String... p_params) throws Exception {
// Step 2: Get the Operation that was just created by our aspect
Operation op = getLastEntered();
@@ -36,7 +41,7 @@ public void validate(OperationType opType, String... p_params) throws Exception
// prepare parameters
List<String> params=new ArrayList<String>();
Collections.addAll(params, p_params);
- params.add("server = localhost:9160");
+ params.add("server = " + CassandraUnitTests.TEST_HOST + ":" + CassandraUnitTests.RPC_PORT);
// Step 4: Validate parameters
for (String def: params) {
String[] param=null;
@@ -39,6 +39,10 @@
import com.springsource.insight.plugin.cassandra.embeded.EmbeddedCassandraService;
public class CassandraUnitTests {
+ // NOTE !!! must match the values in the yaml file
+ public static final String TEST_HOST="127.0.0.1";
+ public static final int RPC_PORT=7365;
+
private static EmbeddedCassandraService cassandra;
private static CassandraUnitTests instance;
private static Cassandra.Client lastClient;
@@ -59,7 +63,7 @@ public static CassandraUnitTests getInstance() throws Exception {
private Cassandra.Client getClient() throws TTransportException {
if (lastClient==null) {
- TTransport tr = new TFramedTransport(new TSocket("localhost", 9160));
+ TTransport tr = new TFramedTransport(new TSocket(TEST_HOST, RPC_PORT));
lastClient=new Cassandra.Client(new TBinaryProtocol(tr));
tr.open();
}
@@ -6,10 +6,10 @@ data_file_directories:
commitlog_directory: /tmp/cassandra/commitlog
saved_caches_directory: /tmp/cassandra/saved_caches
-listen_address: localhost
+listen_address: 127.0.0.1
storage_port: 7000
-rpc_address: localhost
-rpc_port: 9160
+rpc_address: 127.0.0.1
+rpc_port: 7365
commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000

0 comments on commit d56a86e

Please sign in to comment.