Search in sources :

Example 1 with GetSetCommand

use of com.moilioncircle.redis.replicator.cmd.impl.GetSetCommand in project rocketmq-externals by apache.

the class RedisEventHandlerTest method testNull.

@Test
public void testNull() {
    Config config = getConfig();
    RedisEventHandler handler = new DefaultRedisEventHandler(config);
    KVEntry res = null;
    Exception ex = null;
    // 测试increment下的rdb数据处理
    config.setSyncMod(SyncMod.LAST_OFFSET.name());
    KeyValuePair keyValuePair = new KeyStringValueString();
    keyValuePair.setKey("key".getBytes());
    keyValuePair.setValue("value".getBytes());
    try {
        res = handler.handleKVString(replId, offset, keyValuePair);
    } catch (Exception e) {
        e.printStackTrace();
        ex = e;
    }
    Assert.assertNull(res);
    Assert.assertNull(ex);
    // 测试未指定的command
    GetSetCommand command = new GetSetCommand();
    command.setKey("key".getBytes());
    command.setValue("value".getBytes());
    try {
        res = handler.handleCommand(replId, offset, command);
    } catch (Exception e) {
        ex = e;
    }
    Assert.assertNull(res);
    Assert.assertNull(ex);
}
Also used : RedisEventHandler(org.apache.rocketmq.connect.redis.handler.RedisEventHandler) DefaultRedisEventHandler(org.apache.rocketmq.connect.redis.handler.DefaultRedisEventHandler) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) BatchedKeyValuePair(com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyValuePair) KeyValuePair(com.moilioncircle.redis.replicator.rdb.datatype.KeyValuePair) Config(org.apache.rocketmq.connect.redis.common.Config) BatchedKeyStringValueString(com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString) KeyStringValueString(com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString) DefaultRedisEventHandler(org.apache.rocketmq.connect.redis.handler.DefaultRedisEventHandler) GetSetCommand(com.moilioncircle.redis.replicator.cmd.impl.GetSetCommand) Test(org.junit.Test)

Aggregations

GetSetCommand (com.moilioncircle.redis.replicator.cmd.impl.GetSetCommand)1 KeyStringValueString (com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString)1 KeyValuePair (com.moilioncircle.redis.replicator.rdb.datatype.KeyValuePair)1 BatchedKeyStringValueString (com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString)1 BatchedKeyValuePair (com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyValuePair)1 Config (org.apache.rocketmq.connect.redis.common.Config)1 DefaultRedisEventHandler (org.apache.rocketmq.connect.redis.handler.DefaultRedisEventHandler)1 RedisEventHandler (org.apache.rocketmq.connect.redis.handler.RedisEventHandler)1 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)1 Test (org.junit.Test)1