Merge branch 'speed-up-unit-test' of github.com:HeartSaVioR/jedis into upgrade_libs
Conflicts: src/test/java/redis/clients/jedis/tests/JedisPoolTest.java src/test/java/redis/clients/jedis/tests/JedisSentinelPoolTest.java src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java src/test/java/redis/clients/jedis/tests/ShardedJedisPipelineTest.java src/test/java/redis/clients/jedis/tests/ShardedJedisPoolTest.java src/test/java/redis/clients/jedis/tests/benchmark/PoolBenchmark.java src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java
This commit is contained in:
@@ -4,9 +4,9 @@ import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||
|
||||
public class GetSetBenchmark {
|
||||
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||
@@ -14,7 +14,7 @@ public class GetSetBenchmark {
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException,
|
||||
IOException {
|
||||
Jedis jedis = new Jedis(hnp.host, hnp.port);
|
||||
Jedis jedis = new Jedis(hnp.getHost(), hnp.getPort());
|
||||
jedis.connect();
|
||||
jedis.auth("foobared");
|
||||
jedis.flushAll();
|
||||
|
||||
@@ -7,11 +7,11 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisShardInfo;
|
||||
import redis.clients.jedis.ShardedJedis;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||
|
||||
public class HashingBenchmark {
|
||||
private static HostAndPort hnp1 = HostAndPortUtil.getRedisServers().get(0);
|
||||
@@ -21,10 +21,10 @@ public class HashingBenchmark {
|
||||
public static void main(String[] args) throws UnknownHostException,
|
||||
IOException {
|
||||
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>();
|
||||
JedisShardInfo shard = new JedisShardInfo(hnp1.host, hnp1.port);
|
||||
JedisShardInfo shard = new JedisShardInfo(hnp1.getHost(), hnp1.getPort());
|
||||
shard.setPassword("foobared");
|
||||
shards.add(shard);
|
||||
shard = new JedisShardInfo(hnp2.host, hnp2.port);
|
||||
shard = new JedisShardInfo(hnp2.getHost(), hnp2.getPort());
|
||||
shard.setPassword("foobared");
|
||||
shards.add(shard);
|
||||
ShardedJedis jedis = new ShardedJedis(shards);
|
||||
|
||||
@@ -4,10 +4,10 @@ import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.Pipeline;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||
|
||||
public class PipelinedGetSetBenchmark {
|
||||
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||
@@ -15,7 +15,7 @@ public class PipelinedGetSetBenchmark {
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException,
|
||||
IOException {
|
||||
Jedis jedis = new Jedis(hnp.host, hnp.port);
|
||||
Jedis jedis = new Jedis(hnp.getHost(), hnp.getPort());
|
||||
jedis.connect();
|
||||
jedis.auth("foobared");
|
||||
jedis.flushAll();
|
||||
|
||||
@@ -6,17 +6,17 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil;
|
||||
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
|
||||
|
||||
public class PoolBenchmark {
|
||||
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
|
||||
private static final int TOTAL_OPERATIONS = 100000;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Jedis j = new Jedis(hnp.host, hnp.port);
|
||||
Jedis j = new Jedis(hnp.getHost(), hnp.getPort());
|
||||
j.connect();
|
||||
j.auth("foobared");
|
||||
j.flushAll();
|
||||
@@ -31,7 +31,7 @@ public class PoolBenchmark {
|
||||
|
||||
private static void withPool() throws Exception {
|
||||
final JedisPool pool = new JedisPool(new GenericObjectPoolConfig(),
|
||||
hnp.host, hnp.port, 2000, "foobared");
|
||||
hnp.getHost(), hnp.getPort(), 2000, "foobared");
|
||||
List<Thread> tds = new ArrayList<Thread>();
|
||||
|
||||
final AtomicInteger ind = new AtomicInteger();
|
||||
@@ -59,5 +59,6 @@ public class PoolBenchmark {
|
||||
t.join();
|
||||
|
||||
pool.destroy();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user