Search in sources :

Example 31 with KVEntry

use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.

the class ParserTest method testXAckParser.

@Test
public void testXAckParser() {
    String command = "XAck key group 1526569498055-0 1526569498055-1";
    KVEntry builder = new XAckParser().parse(parseCommand(command));
    Assert.assertEquals("XAck", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("group", builder.getParam(Options.REDIS_GROUP));
    List<String> res = (List<String>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("1526569498055-0", res.get(0));
    Assert.assertEquals("1526569498055-1", res.get(1));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) List(java.util.List) XAckParser(org.apache.rocketmq.connect.redis.parser.XAckParser) Test(org.junit.Test)

Example 32 with KVEntry

use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.

the class ParserTest method testZRemRangeByScoreParser.

@Test
public void testZRemRangeByScoreParser() {
    String command = "ZREMRANGEBYSCORE key 0 10";
    KVEntry builder = new ZRemRangeByScoreParser().parse(parseCommand(command));
    Assert.assertEquals("ZREMRANGEBYSCORE", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    List<String> res = (List<String>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("0", res.get(0));
    Assert.assertEquals("10", res.get(1));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) ZRemRangeByScoreParser(org.apache.rocketmq.connect.redis.parser.ZRemRangeByScoreParser) List(java.util.List) Test(org.junit.Test)

Example 33 with KVEntry

use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.

the class ParserTest method testRPopParser.

@Test
public void testRPopParser() {
    String command = "RPOP key";
    KVEntry builder = new RPopParser().parse(parseCommand(command));
    Assert.assertEquals("RPOP", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) RPopParser(org.apache.rocketmq.connect.redis.parser.RPopParser) Test(org.junit.Test)

Example 34 with KVEntry

use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.

the class ParserTest method testLPushXParser.

@Test
public void testLPushXParser() {
    String command = "LPUSHX key value";
    KVEntry builder = new LPushXParser().parse(parseCommand(command));
    Assert.assertEquals("LPUSHX", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LPushXParser(org.apache.rocketmq.connect.redis.parser.LPushXParser) Test(org.junit.Test)

Example 35 with KVEntry

use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.

the class ParserTest method testFlushDbParser.

@Test
public void testFlushDbParser() {
    String command = "FLUSHDB ASYNC";
    KVEntry builder = new FlushDbParser().parse(parseCommand(command));
    Assert.assertEquals("FLUSHDB", builder.getCommand());
    Assert.assertEquals("ASYNC", builder.getKey());
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) FlushDbParser(org.apache.rocketmq.connect.redis.parser.FlushDbParser) Test(org.junit.Test)

Aggregations

KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)118 Test (org.junit.Test)114 List (java.util.List)34 Map (java.util.Map)20 BatchedKeyStringValueString (com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyStringValueString)13 KeyStringValueString (com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueString)12 HashMap (java.util.HashMap)8 KeyStringValueList (com.moilioncircle.redis.replicator.rdb.datatype.KeyStringValueList)6 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)5 HSetParser (org.apache.rocketmq.connect.redis.parser.HSetParser)5 HmSetParser (org.apache.rocketmq.connect.redis.parser.HmSetParser)5 LSetParser (org.apache.rocketmq.connect.redis.parser.LSetParser)5 MSetParser (org.apache.rocketmq.connect.redis.parser.MSetParser)5 ZSetEntry (com.moilioncircle.redis.replicator.rdb.datatype.ZSetEntry)3 BatchedKeyValuePair (com.moilioncircle.redis.replicator.rdb.iterable.datatype.BatchedKeyValuePair)3 SourceDataEntry (io.openmessaging.connector.api.data.SourceDataEntry)3 IOException (java.io.IOException)3 Config (org.apache.rocketmq.connect.redis.common.Config)3 DefaultRedisEventHandler (org.apache.rocketmq.connect.redis.handler.DefaultRedisEventHandler)3