Search in sources :

Example 1 with ZSetEntry

use of com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry in project rocketmq-externals by apache.

the class RedisEventHandlerTest method testZSet2.

@Test
public void testZSet2() {
    KVEntry builder = handlerTest(RDB_TYPE_ZSET_2, () -> {
        Set<ZSetEntry> values = new HashSet<>();
        values.add(new ZSetEntry("key1".getBytes(), 100));
        values.add(new ZSetEntry("key2".getBytes(), 80));
        return values;
    });
    Map<String, Double> va = (Map<String, Double>) builder.getValue();
    Assert.assertNotNull(va);
    Assert.assertEquals(2, va.size());
    Assert.assertTrue(100 == va.get("key1"));
    Assert.assertTrue(80 == va.get("key2"));
}
Also used : ZSetEntry(com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) BatchedKeyStringValueString(com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString) KeyStringValueString(com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with ZSetEntry

use of com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry in project rocketmq-externals by apache.

the class RedisEventHandlerTest method testZSetZipList.

@Test
public void testZSetZipList() {
    KVEntry builder = handlerTest(RDB_TYPE_ZSET_ZIPLIST, () -> {
        Set<ZSetEntry> values = new HashSet<>();
        values.add(new ZSetEntry("v1".getBytes(), 100));
        values.add(new ZSetEntry("v2".getBytes(), 80));
        return values;
    });
    Map<String, Double> va = (Map<String, Double>) builder.getValue();
    Assert.assertNotNull(va);
    Assert.assertEquals(2, va.size());
    Assert.assertTrue(100 == va.get("v1"));
    Assert.assertTrue(80 == va.get("v2"));
}
Also used : ZSetEntry(com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) BatchedKeyStringValueString(com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString) KeyStringValueString(com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with ZSetEntry

use of com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry in project rocketmq-externals by apache.

the class RedisEventHandlerTest method testZSET.

@Test
public void testZSET() {
    KVEntry builder = handlerTest(RDB_TYPE_ZSET, () -> {
        Set<ZSetEntry> values = new HashSet<>();
        values.add(new ZSetEntry("key1".getBytes(), 100));
        values.add(new ZSetEntry("key2".getBytes(), 80));
        return values;
    });
    Map<String, Double> va = (Map<String, Double>) builder.getValue();
    Assert.assertNotNull(va);
    Assert.assertEquals(2, va.size());
    Assert.assertTrue(100 == va.get("key1"));
    Assert.assertTrue(80 == va.get("key2"));
}
Also used : ZSetEntry(com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) BatchedKeyStringValueString(com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString) KeyStringValueString(com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

KeyStringValueString (com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString)3 ZSetEntry (com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry)3 BatchedKeyStringValueString (com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)3 Test (org.junit.Test)3