use of com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyValuePair in project rocketmq-externals by apache.
the class RedisEventHandlerTest method test.
@Test
public void test() {
Config config = getConfig();
RedisEventHandler handler = new DefaultRedisEventHandler(config);
KVEntry entry = getBuilder();
KVEntry res = null;
Exception ex = null;
try {
res = handler.handleCommand(replId, offset, entry);
} catch (Exception e) {
e.printStackTrace();
ex = e;
}
Assert.assertEquals("c18cece63c7b16851a6f387f52dbbb9eee07e46f", res.getSourceId());
Assert.assertTrue(res.getOffset() == 3926872L);
Assert.assertNull(ex);
AuxField auxField = new AuxField("a", "b");
try {
res = handler.handleOtherEvent(replId, offset, auxField);
} catch (Exception e) {
e.printStackTrace();
ex = e;
}
Assert.assertNull(res);
Assert.assertNull(ex);
BatchedKeyValuePair pair = new BatchedKeyStringValueString();
pair.setKey("A".getBytes());
pair.setValue("B".getBytes());
try {
res = handler.handleBatchKVString(replId, offset, pair);
} catch (Exception e) {
e.printStackTrace();
ex = e;
}
Assert.assertNull(res);
Assert.assertNull(ex);
}
Aggregations