Allow to execute tests against a remote server.

Update Maven pom to use "redis-host" and "redis-port" env. properties.
Default values point to localhost:6379.

Tests updated to use this properties and also defaulted to localhost:6379.
This commit is contained in:
Yaourt
2010-09-13 10:55:58 +02:00
parent 9211335f0d
commit d61f4d79d8
5 changed files with 185 additions and 96 deletions

View File

@@ -5,6 +5,7 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;
@@ -13,6 +14,17 @@ import redis.clients.jedis.Transaction;
import redis.clients.jedis.TransactionBlock;
public class TransactionCommandsTest extends JedisCommandTestBase {
Jedis nj;
@Before
public void setUp() throws Exception {
super.setUp();
nj = new Jedis(host, port, 500);
nj.connect();
nj.auth("foobared");
nj.flushAll();
}
@Test
public void multi() {
Transaction trans = jedis.multi();
@@ -62,7 +74,6 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
jedis.watch("mykey");
Transaction t = jedis.multi();
Jedis nj = new Jedis("localhost");
nj.connect();
nj.auth("foobared");
nj.set("mykey", "bar");
@@ -83,7 +94,6 @@ public class TransactionCommandsTest extends JedisCommandTestBase {
assertEquals("OK", status);
Transaction t = jedis.multi();
Jedis nj = new Jedis("localhost");
nj.connect();
nj.auth("foobared");
nj.set("mykey", "bar");