use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testMSetNxParser.
@Test
public void testMSetNxParser() {
String command = "msetnx k1 v1 k2 v2";
KVEntry builder = new MSetNxParser().parse(parseCommand(command));
Assert.assertEquals("msetnx", builder.getCommand());
Assert.assertEquals("k1", builder.getKey());
Map<String, String> res = (Map<String, String>) builder.getValue();
Assert.assertEquals("v1", res.get("k1"));
Assert.assertEquals("v2", res.get("k2"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSetParser1.
@Test
public void testSetParser1() {
String command = "set key value EX 100 NX";
KVEntry builder = new SetParser().parse(parseCommand(command));
Assert.assertEquals("set", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertTrue(100 == builder.getParam(Options.REDIS_EX));
Assert.assertEquals(true, builder.getParam(Options.REDIS_NX));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testLinsertParserBefore.
@Test
public void testLinsertParserBefore() {
String command = "Linsert key BEFORE pivot value";
KVEntry builder = new LinsertParser().parse(parseCommand(command));
Assert.assertEquals("Linsert", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("pivot", res.get(0));
Assert.assertEquals("value", res.get(1));
Assert.assertEquals(true, builder.getParam(Options.REDIS_BEFORE));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZIncrByParser.
@Test
public void testZIncrByParser() {
String command = "ZINCRBY key 100 member";
KVEntry builder = new ZIncrByParser().parse(parseCommand(command));
Assert.assertEquals("ZINCRBY", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("member", builder.getValue());
Assert.assertTrue(100L == builder.getParam(Options.REDIS_INCREMENT));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testLinsertParserAfter.
@Test
public void testLinsertParserAfter() {
String command = "Linsert key AFTER pivot value";
KVEntry builder = new LinsertParser().parse(parseCommand(command));
Assert.assertEquals("Linsert", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("pivot", res.get(0));
Assert.assertEquals("value", res.get(1));
Assert.assertEquals(true, builder.getParam(Options.REDIS_AFTER));
}
Aggregations