Search in sources :

Example 71 with KVEntry

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

the class ParserTest method testZPopMaxParser.

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

Example 72 with KVEntry

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

the class ParserTest method testLPushParser.

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

Example 73 with KVEntry

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

the class ParserTest method testXSetIdParser.

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

Example 74 with KVEntry

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

the class ParserTest method testRPushParser.

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

Example 75 with KVEntry

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

the class ParserTest method testXDelParser.

@Test
public void testXDelParser() {
    String command = "XDel key 1526569498055-0 1526569498055-1";
    KVEntry builder = new XDelParser().parse(parseCommand(command));
    Assert.assertEquals("XDel", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    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) XDelParser(org.apache.rocketmq.connect.redis.parser.XDelParser) 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