Search in sources :

Example 16 with KVEntry

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

the class ParserTest method testSAddParser.

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

Example 17 with KVEntry

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

the class ParserTest method testLRemParser.

@Test
public void testLRemParser() {
    String command = "LRem key 100 value";
    KVEntry builder = new LRemParser().parse(parseCommand(command));
    Assert.assertEquals("LRem", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertTrue(100L == builder.getParam(Options.REDIS_COUNT));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LRemParser(org.apache.rocketmq.connect.redis.parser.LRemParser) Test(org.junit.Test)

Example 18 with KVEntry

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

the class ParserTest method testMoveParser.

@Test
public void testMoveParser() {
    String command = "move key 1";
    KVEntry builder = new MoveParser().parse(parseCommand(command));
    Assert.assertEquals("move", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertTrue(1 == builder.getParam(Options.REDIS_DB_INDEX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) MoveParser(org.apache.rocketmq.connect.redis.parser.MoveParser) SMoveParser(org.apache.rocketmq.connect.redis.parser.SMoveParser) Test(org.junit.Test)

Example 19 with KVEntry

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

the class ParserTest method testSortParser.

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

Example 20 with KVEntry

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

the class ParserTest method testIncrParser.

@Test
public void testIncrParser() {
    String command = "INCR key";
    KVEntry builder = new IncrParser().parse(parseCommand(command));
    Assert.assertEquals("INCR", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
}
Also used : IncrParser(org.apache.rocketmq.connect.redis.parser.IncrParser) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) 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