Search in sources :

Example 51 with KVEntry

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

the class ParserTest method testIncrByParser.

@Test
public void testIncrByParser() {
    String command = "INCRBY key 100";
    KVEntry builder = new IncrByParser().parse(parseCommand(command));
    Assert.assertEquals("INCRBY", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertTrue(100L == builder.getParam(Options.REDIS_INCREMENT));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) ZIncrByParser(org.apache.rocketmq.connect.redis.parser.ZIncrByParser) HIncrByParser(org.apache.rocketmq.connect.redis.parser.HIncrByParser) IncrByParser(org.apache.rocketmq.connect.redis.parser.IncrByParser) Test(org.junit.Test)

Example 52 with KVEntry

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

the class ParserTest method testPfAddParser.

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

Example 53 with KVEntry

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

the class ParserTest method testMultiParser.

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

Example 54 with KVEntry

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

the class ParserTest method testUnLinkParser.

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

Example 55 with KVEntry

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

the class ParserTest method testPersistParser.

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