Search in sources :

Example 86 with KVEntry

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

the class ParserTest method testPExpireAtParser.

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

Example 87 with KVEntry

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

the class ParserTest method testScriptParser.

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

Example 88 with KVEntry

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

the class ParserTest method testSMoveParser.

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

Example 89 with KVEntry

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

the class ParserTest method testHIncrByParser.

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

Example 90 with KVEntry

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

the class ParserTest method testHSetParser.

@Test
public void testHSetParser() {
    String command = "hset key field value";
    KVEntry builder = new HSetParser().parse(parseCommand(command));
    Assert.assertEquals("hset", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Map<String, String> res = (Map<String, String>) builder.getValue();
    Assert.assertEquals(1, res.size());
    Assert.assertEquals("value", res.get("field"));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Map(java.util.Map) 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