Search in sources :

Example 36 with KVEntry

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

the class ParserTest method testSInterStoreParser.

@Test
public void testSInterStoreParser() {
    String command = "SINTERSTORE destination k1 k2";
    KVEntry builder = new SInterStoreParser().parse(parseCommand(command));
    Assert.assertEquals("SINTERSTORE", builder.getCommand());
    Assert.assertEquals("destination", 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) SInterStoreParser(org.apache.rocketmq.connect.redis.parser.SInterStoreParser) List(java.util.List) Test(org.junit.Test)

Example 37 with KVEntry

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

the class ParserTest method testZRemParser.

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

Example 38 with KVEntry

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

the class ParserTest method testGetsetParser.

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

Example 39 with KVEntry

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

the class ParserTest method testDecrByParser.

@Test
public void testDecrByParser() {
    String command = "DECRBY key 100";
    KVEntry builder = new DecrByParser().parse(parseCommand(command));
    Assert.assertEquals("DECRBY", 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) DecrByParser(org.apache.rocketmq.connect.redis.parser.DecrByParser) Test(org.junit.Test)

Example 40 with KVEntry

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

the class ParserTest method testSetNxParser.

@Test
public void testSetNxParser() {
    String command = "SETNX a b";
    KVEntry builder = new SetNxParser().parse(parseCommand(command));
    Assert.assertEquals("SETNX", builder.getCommand());
    Assert.assertEquals("a", builder.getKey());
    Assert.assertEquals("b", builder.getValue());
}
Also used : SetNxParser(org.apache.rocketmq.connect.redis.parser.SetNxParser) MSetNxParser(org.apache.rocketmq.connect.redis.parser.MSetNxParser) HSetNxParser(org.apache.rocketmq.connect.redis.parser.HSetNxParser) 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