Search in sources :

Example 41 with KVEntry

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

the class ParserTest method testExecParser.

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

Example 42 with KVEntry

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

the class ParserTest method testRenameParser.

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

Example 43 with KVEntry

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

the class ParserTest method testSetParser2.

@Test
public void testSetParser2() {
    String command = "set key value EX 100";
    KVEntry builder = new SetParser().parse(parseCommand(command));
    Assert.assertEquals("set", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertTrue(100 == builder.getParam(Options.REDIS_EX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LSetParser(org.apache.rocketmq.connect.redis.parser.LSetParser) SetParser(org.apache.rocketmq.connect.redis.parser.SetParser) HmSetParser(org.apache.rocketmq.connect.redis.parser.HmSetParser) MSetParser(org.apache.rocketmq.connect.redis.parser.MSetParser) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Test(org.junit.Test)

Example 44 with KVEntry

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

the class ParserTest method testZRemRangeByLexParser.

@Test
public void testZRemRangeByLexParser() {
    String command = "ZRemRangeByLex key 0 10";
    KVEntry builder = new ZRemRangeByLexParser().parse(parseCommand(command));
    Assert.assertEquals("ZRemRangeByLex", 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) List(java.util.List) ZRemRangeByLexParser(org.apache.rocketmq.connect.redis.parser.ZRemRangeByLexParser) Test(org.junit.Test)

Example 45 with KVEntry

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

the class ParserTest method testLTrimParser.

@Test
public void testLTrimParser() {
    String command = "LTrim key 0 -1";
    KVEntry builder = new LTrimParser().parse(parseCommand(command));
    Assert.assertEquals("LTrim", 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("-1", res.get(1));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LTrimParser(org.apache.rocketmq.connect.redis.parser.LTrimParser) List(java.util.List) 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