use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZInterStoreParser2.
@Test
public void testZInterStoreParser2() {
// ZINTERSTORE destination numkeys key [key ...] [weights weight] [aggregate SUM|MIN|MAX]
String command = "ZINTERSTORE destination 2 k1 k2 weights 100 80 aggregate SUM";
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"));
Assert.assertEquals("SUM", builder.getParam(Options.REDIS_AGGREGATE));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPublishParser.
@Test
public void testPublishParser() {
String command = "Publish channel message";
KVEntry builder = new PublishParser().parse(parseCommand(command));
Assert.assertEquals("Publish", builder.getCommand());
Assert.assertEquals("channel", builder.getKey());
Assert.assertEquals("message", builder.getValue());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZPopMinParser.
@Test
public void testZPopMinParser() {
String command = "ZPOPMIN key 100";
KVEntry builder = new ZPopMinParser().parse(parseCommand(command));
Assert.assertEquals("ZPOPMIN", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertTrue(100L == builder.getParam(Options.REDIS_COUNT));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testExpireParser.
@Test
public void testExpireParser() {
String command = "expire key 500";
KVEntry builder = new ExpireParser().parse(parseCommand(command));
Assert.assertEquals("expire", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertTrue(500L == builder.getParam(Options.EXPIRED_TIME));
Assert.assertEquals(ExpiredType.SECOND, builder.getParam(Options.EXPIRED_TYPE));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testZAddParser1.
@Test
public void testZAddParser1() {
// ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
String command = "ZADD key 100 m1 80 m2";
KVEntry builder = new ZAddParser().parse(parseCommand(command));
Assert.assertEquals("ZADD", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Map<String, String> res = (Map<String, String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("100", res.get("m1"));
Assert.assertEquals("80", res.get("m2"));
}
Aggregations