use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTwoLockedThread method before.
@Before
public void before() throws IOException, InterruptedException {
if (RedissonRuntimeEnvironment.isTravis) {
RedisRunner.startDefaultRedisServerInstance();
redisson = createInstance();
}
Config config = BaseTest.createConfig();
config.setCodec(codec);
redisson = Redisson.create(config);
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonExecutorServiceTest method before.
@Before
@Override
public void before() throws IOException, InterruptedException {
super.before();
if (RedissonRuntimeEnvironment.isTravis) {
Config config = createConfig();
RedissonNodeConfig nodeConfig = new RedissonNodeConfig(config);
nodeConfig.setExecutorServiceWorkers(Collections.singletonMap("test", 1));
node = RedissonNode.create(nodeConfig);
node.start();
}
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTest method testMemoryScript.
@Test(expected = RedisOutOfMemoryException.class)
public void testMemoryScript() throws IOException, InterruptedException {
RedisProcess p = redisTestSmallMemory();
Config config = new Config();
config.useSingleServer().setAddress(p.getRedisServerAddressAndPort()).setTimeout(100000);
RedissonClient r = null;
try {
r = Redisson.create(config);
r.getKeys().flushall();
for (int i = 0; i < 10000; i++) {
r.getMap("test").put("" + i, "" + i);
}
} finally {
r.shutdown();
p.stop();
}
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTest method testSmallPool.
@Test
public void testSmallPool() throws InterruptedException {
Config config = new Config();
config.useSingleServer().setConnectionMinimumIdleSize(3).setConnectionPoolSize(3).setAddress(RedisRunner.getDefaultRedisServerBindAddressAndPort());
RedissonClient localRedisson = Redisson.create(config);
RMap<String, String> map = localRedisson.getMap("test");
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
long start = System.currentTimeMillis();
int iterations = 500_000;
for (int i = 0; i < iterations; i++) {
final int j = i;
executor.execute(new Runnable() {
@Override
public void run() {
map.put("" + j, "" + j);
}
});
}
executor.shutdown();
Assert.assertTrue(executor.awaitTermination(10, TimeUnit.MINUTES));
assertThat(map.size()).isEqualTo(iterations);
localRedisson.shutdown();
}
use of org.redisson.config.Config in project redisson by redisson.
the class RedissonTest method testClusterConfig.
@Test
public void testClusterConfig() throws IOException {
Config originalConfig = new Config();
originalConfig.useClusterServers().addNodeAddress("123.123.1.23:1902", "9.3.1.0:1902");
String t = originalConfig.toJSON();
Config c = Config.fromJSON(t);
System.out.println(t);
assertThat(c.toJSON()).isEqualTo(t);
}
Aggregations