use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testLPopParser.
@Test
public void testLPopParser() {
String command = "LPOP key";
KVEntry builder = new LPopParser().parse(parseCommand(command));
Assert.assertEquals("LPOP", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testRPopLPushParser.
@Test
public void testRPopLPushParser() {
String command = "RPOPLPUSH source destination";
KVEntry builder = new RPopLPushParser().parse(parseCommand(command));
Assert.assertEquals("RPOPLPUSH", builder.getCommand());
Assert.assertEquals("source", builder.getKey());
Assert.assertEquals("destination", builder.getValue());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZRemRangeByRankParser.
@Test
public void testZRemRangeByRankParser() {
String command = "ZREMRANGEBYRANK key 0 10";
KVEntry builder = new ZRemRangeByRankParser().parse(parseCommand(command));
Assert.assertEquals("ZREMRANGEBYRANK", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("0", res.get(0));
Assert.assertEquals("10", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZInterStoreParser1.
@Test
public void testZInterStoreParser1() {
// ZINTERSTORE destination numkeys key [key ...] [weights weight] [aggregate SUM|MIN|MAX]
String command = "ZINTERSTORE destination 2 k1 k2 weights 100 80";
KVEntry builder = new ZInterStoreParser().parse(parseCommand(command));
Assert.assertEquals("ZINTERSTORE", builder.getCommand());
Assert.assertEquals("destination", builder.getKey());
Map<String, String> res = (Map<String, String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("100", res.get("k1"));
Assert.assertEquals("80", res.get("k2"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSelectParser.
@Test
public void testSelectParser() {
String command = "Select 1";
KVEntry builder = new SelectParser().parse(parseCommand(command));
Assert.assertEquals("Select", builder.getCommand());
Assert.assertEquals("1", builder.getKey());
Assert.assertTrue(1 == builder.getParam(Options.REDIS_DB_INDEX));
}
Aggregations