You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2015/09/05 00:40:07 UTC
[2/2] incubator-geode git commit: GEODE-77 modified the test to use
the dunit locator
GEODE-77 modified the test to use the dunit locator
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/10035269
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/10035269
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/10035269
Branch: refs/heads/feature/GEODE-77
Commit: 10035269cf6d3f9245b0b1d6edb93085c606b0c3
Parents: d87cf44
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Fri Sep 4 15:39:41 2015 -0700
Committer: Bruce Schuchardt <bs...@pivotal.io>
Committed: Fri Sep 4 15:39:41 2015 -0700
----------------------------------------------------------------------
.../gemfire/redis/RedisDistDUnitTest.java | 30 ++++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/10035269/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
index d3aa334..184de96 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/redis/RedisDistDUnitTest.java
@@ -5,16 +5,16 @@ import java.util.Random;
import redis.clients.jedis.Jedis;
import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
import dunit.AsyncInvocation;
+import dunit.DistributedTestCase;
import dunit.Host;
import dunit.SerializableCallable;
import dunit.VM;
-public class RedisDistDUnitTest extends CacheTestCase {
+public class RedisDistDUnitTest extends DistributedTestCase {
public static final String TEST_KEY = "key";
public static int pushes = 200;
@@ -28,6 +28,8 @@ public class RedisDistDUnitTest extends CacheTestCase {
private int server1Port;
private int server2Port;
+ private String localHost = SocketCreator.getLocalHost().getHostName();
+
private static final int JEDIS_TIMEOUT = 20 * 1000;
private abstract class ClientTestBase extends SerializableCallable {
@@ -52,24 +54,22 @@ public class RedisDistDUnitTest extends CacheTestCase {
server2 = host.getVM(1);
client1 = host.getVM(2);
client2 = host.getVM(3);
- final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+ final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+ final int locatorPort = getDUnitLocatorPort();
final SerializableCallable<Object> startRedisAdapter = new SerializableCallable<Object>() {
private static final long serialVersionUID = 1978017907725504294L;
@Override
public Object call() throws Exception {
- int port = ports[VM.getCurrentVMNum()+1];
+ int port = ports[VM.getCurrentVMNum()];
CacheFactory cF = new CacheFactory();
- String locator = SocketCreator.getLocalHost().getHostName() + "[" + ports[2] + "]";
- cF.set("log-level", "info");
- cF.set("redis-bind-address", "localhost");
+ String locator = SocketCreator.getLocalHost().getHostName() + "[" + locatorPort + "]";
+ cF.set("log-level", getDUnitLogLevel());
+ cF.set("redis-bind-address", localHost);
cF.set("redis-port", ""+port);
cF.set("mcast-port", "0");
cF.set("locators", locator);
- if (VM.getCurrentVMNum() == 0) {
- cF.set("start-locator", locator);
- }
cF.create();
return Integer.valueOf(port);
}
@@ -90,8 +90,8 @@ public class RedisDistDUnitTest extends CacheTestCase {
}
public void testConcListOps() throws Throwable {
- final Jedis jedis1 = new Jedis("localhost", server1Port, JEDIS_TIMEOUT);
- final Jedis jedis2 = new Jedis("localhost", server2Port, JEDIS_TIMEOUT);
+ final Jedis jedis1 = new Jedis(localHost, server1Port, JEDIS_TIMEOUT);
+ final Jedis jedis2 = new Jedis(localHost, server2Port, JEDIS_TIMEOUT);
final int pushes = 20;
class ConcListOps extends ClientTestBase {
protected ConcListOps(int port) {
@@ -100,7 +100,7 @@ public class RedisDistDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
- Jedis jedis = new Jedis("localhost", port, JEDIS_TIMEOUT);
+ Jedis jedis = new Jedis(localHost, port, JEDIS_TIMEOUT);
Random r = new Random();
for (int i = 0; i < pushes; i++) {
if (r.nextBoolean()) {
@@ -139,7 +139,7 @@ public class RedisDistDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
- Jedis jedis = new Jedis("localhost", port, JEDIS_TIMEOUT);
+ Jedis jedis = new Jedis(localHost, port, JEDIS_TIMEOUT);
Random r = new Random();
for (int i = 0; i < ops; i++) {
int n = r.nextInt(4);
@@ -199,7 +199,7 @@ public class RedisDistDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
- Jedis jedis = new Jedis("localhost", port, JEDIS_TIMEOUT);
+ Jedis jedis = new Jedis(localHost, port, JEDIS_TIMEOUT);
Random r = new Random();
for (int i = 0; i < ops; i++) {
int n = r.nextInt(4);