use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class RedisEventHandlerTest method testHash.
@Test
public void testHash() {
KVEntry builder = handlerTest(RDB_TYPE_HASH, () -> {
Map<byte[], byte[]> values = new HashMap<>();
values.put("key1".getBytes(), "value1".getBytes());
values.put("key2".getBytes(), "value2".getBytes());
return values;
});
Map<String, String> va = (Map<String, String>) builder.getValue();
Assert.assertNotNull(va);
Assert.assertEquals(2, va.size());
Assert.assertEquals("value1", va.get("key1"));
Assert.assertEquals("value2", va.get("key2"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class RedisEventHandlerTest method testStreamListPacks.
@Test
public void testStreamListPacks() {
KVEntry builder = handlerTest(RDB_TYPE_STREAM_LISTPACKS, () -> {
Stream stream = new Stream();
return stream;
});
Stream va = (Stream) builder.getValue();
Assert.assertNotNull(va);
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry 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"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry 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"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class RedisEventHandlerTest method testHashZipMap.
@Test
public void testHashZipMap() {
KVEntry builder = handlerTest(RDB_TYPE_HASH_ZIPMAP, () -> {
Map<byte[], byte[]> values = new HashMap<>();
values.put("key1".getBytes(), "value1".getBytes());
values.put("key2".getBytes(), "value2".getBytes());
return values;
});
Map<String, String> va = (Map<String, String>) builder.getValue();
Assert.assertNotNull(va);
Assert.assertEquals(2, va.size());
Assert.assertEquals("value1", va.get("key1"));
Assert.assertEquals("value2", va.get("key2"));
}
Aggregations