Search in sources :

Example 6 with Config

use of org.redisson.config.Config in project redisson by redisson.

the class RedissonTest method testElasticacheConnectionFail.

@Test(expected = RedisConnectionException.class)
public void testElasticacheConnectionFail() throws InterruptedException {
    Config config = new Config();
    config.useElasticacheServers().addNodeAddress("127.99.0.1:1111");
    Redisson.create(config);
    Thread.sleep(1500);
}
Also used : Config(org.redisson.config.Config) Test(org.junit.Test)

Example 7 with Config

use of org.redisson.config.Config in project redisson by redisson.

the class RedissonTest method testClusterConnectionFail.

@Test(expected = RedisConnectionException.class)
public void testClusterConnectionFail() throws InterruptedException {
    Config config = new Config();
    config.useClusterServers().addNodeAddress("127.99.0.1:1111");
    Redisson.create(config);
    Thread.sleep(1500);
}
Also used : Config(org.redisson.config.Config) Test(org.junit.Test)

Example 8 with Config

use of org.redisson.config.Config in project redisson by redisson.

the class RedissonTest method testSingleConfigYAML.

@Test
public void testSingleConfigYAML() throws IOException {
    RedissonClient r = BaseTest.createInstance();
    String t = r.getConfig().toYAML();
    Config c = Config.fromYAML(t);
    assertThat(c.toYAML()).isEqualTo(t);
}
Also used : RedissonClient(org.redisson.api.RedissonClient) Config(org.redisson.config.Config) Test(org.junit.Test)

Example 9 with Config

use of org.redisson.config.Config in project redisson by redisson.

the class RedissonTest method testMasterSlaveConfigJSON.

@Test
public void testMasterSlaveConfigJSON() throws IOException {
    Config c2 = new Config();
    c2.useMasterSlaveServers().setMasterAddress("123.1.1.1:1231").addSlaveAddress("82.12.47.12:1028");
    String t = c2.toJSON();
    Config c = Config.fromJSON(t);
    assertThat(c.toJSON()).isEqualTo(t);
}
Also used : Config(org.redisson.config.Config) Test(org.junit.Test)

Example 10 with Config

use of org.redisson.config.Config in project redisson by redisson.

the class RedissonTest method testMemoryCommand.

@Test(expected = RedisOutOfMemoryException.class)
public void testMemoryCommand() 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").fastPut("" + i, "" + i);
        }
    } finally {
        r.shutdown();
        p.stop();
    }
}
Also used : RedissonClient(org.redisson.api.RedissonClient) RedisProcess(org.redisson.RedisRunner.RedisProcess) Config(org.redisson.config.Config) Test(org.junit.Test)

Aggregations

Config (org.redisson.config.Config)68 Test (org.junit.Test)51 RedissonClient (org.redisson.api.RedissonClient)44 RedisProcess (org.redisson.RedisRunner.RedisProcess)17 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)13 IOException (java.io.IOException)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 RedissonNodeConfig (org.redisson.config.RedissonNodeConfig)4 HashMap (java.util.HashMap)3 ExecutorService (java.util.concurrent.ExecutorService)3 Before (org.junit.Before)3 SerializationCodec (org.redisson.codec.SerializationCodec)3 File (java.io.File)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 LifecycleException (org.apache.catalina.LifecycleException)2 BeforeClass (org.junit.BeforeClass)2 BaseTest.createConfig (org.redisson.BaseTest.createConfig)2 RLock (org.redisson.api.RLock)2 JsonJacksonCodec (org.redisson.codec.JsonJacksonCodec)2