Search in sources :

Example 91 with RedissonClient

use of org.redisson.api.RedissonClient in project redisson by redisson.

the class RedissonCodecTest method testAvro.

@Test
public void testAvro() throws IOException {
    AvroMapper am = new AvroMapper();
    AvroSchema schema = am.schemaFor(TestObject.class);
    Codec avroCodec = new AvroJacksonCodec(TestObject.class, schema);
    Config config = createConfig();
    config.setCodec(avroCodec);
    RedissonClient redisson = Redisson.create(config);
    RBucket<TestObject> b = redisson.getBucket("bucket");
    b.set(new TestObject("1", "2"));
    assertThat(b.get()).isEqualTo(new TestObject("1", "2"));
}
Also used : Codec(org.redisson.client.codec.Codec) JsonJacksonCodec(org.redisson.codec.JsonJacksonCodec) KryoCodec(org.redisson.codec.KryoCodec) MsgPackJacksonCodec(org.redisson.codec.MsgPackJacksonCodec) SnappyCodec(org.redisson.codec.SnappyCodec) JsonJacksonMapValueCodec(org.redisson.client.codec.JsonJacksonMapValueCodec) SerializationCodec(org.redisson.codec.SerializationCodec) LZ4Codec(org.redisson.codec.LZ4Codec) SmileJacksonCodec(org.redisson.codec.SmileJacksonCodec) CborJacksonCodec(org.redisson.codec.CborJacksonCodec) FstCodec(org.redisson.codec.FstCodec) AvroJacksonCodec(org.redisson.codec.AvroJacksonCodec) AvroSchema(com.fasterxml.jackson.dataformat.avro.AvroSchema) AvroJacksonCodec(org.redisson.codec.AvroJacksonCodec) RedissonClient(org.redisson.api.RedissonClient) Config(org.redisson.config.Config) AvroMapper(com.fasterxml.jackson.dataformat.avro.AvroMapper) Test(org.junit.Test)

Example 92 with RedissonClient

use of org.redisson.api.RedissonClient in project redisson by redisson.

the class RedissonCodecTest method testListOfStrings.

@Test
public void testListOfStrings() {
    Config config = createConfig();
    config.setCodec(new JsonJacksonCodec());
    RedissonClient redisson = Redisson.create(config);
    RMap<String, List<String>> map = redisson.getMap("list of strings", jsonListOfStringCodec);
    map.put("foo", new ArrayList<String>(Arrays.asList("bar")));
    RMap<String, List<String>> map2 = redisson.getMap("list of strings", jsonListOfStringCodec);
    assertThat(map2).isEqualTo(map);
    redisson.shutdown();
}
Also used : JsonJacksonCodec(org.redisson.codec.JsonJacksonCodec) RedissonClient(org.redisson.api.RedissonClient) Config(org.redisson.config.Config) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 93 with RedissonClient

use of org.redisson.api.RedissonClient in project redisson by redisson.

the class RedissonCodecTest method testJson.

@Test
public void testJson() {
    Config config = createConfig();
    config.setCodec(jsonCodec);
    RedissonClient redisson = Redisson.create(config);
    test(redisson);
}
Also used : RedissonClient(org.redisson.api.RedissonClient) Config(org.redisson.config.Config) Test(org.junit.Test)

Example 94 with RedissonClient

use of org.redisson.api.RedissonClient in project redisson by redisson.

the class RedissonCodecTest method testCbor.

@Test
public void testCbor() {
    Config config = createConfig();
    config.setCodec(cborCodec);
    RedissonClient redisson = Redisson.create(config);
    test(redisson);
}
Also used : RedissonClient(org.redisson.api.RedissonClient) Config(org.redisson.config.Config) Test(org.junit.Test)

Aggregations

RedissonClient (org.redisson.api.RedissonClient)94 Test (org.junit.Test)87 Config (org.redisson.config.Config)44 RedisProcess (org.redisson.RedisRunner.RedisProcess)23 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)22 CountDownLatch (java.util.concurrent.CountDownLatch)15 ExecutorService (java.util.concurrent.ExecutorService)12 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)10 RLock (org.redisson.api.RLock)10 IOException (java.io.IOException)9 ExecutionException (java.util.concurrent.ExecutionException)9 NotSerializableException (java.io.NotSerializableException)8 RemoteServiceAckTimeoutException (org.redisson.remote.RemoteServiceAckTimeoutException)8 RemoteServiceTimeoutException (org.redisson.remote.RemoteServiceTimeoutException)8 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 RemoteInvocationOptions (org.redisson.api.RemoteInvocationOptions)4 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)3 BasePatternStatusListener (org.redisson.api.listener.BasePatternStatusListener)3 SerializationCodec (org.redisson.codec.SerializationCodec)3