use of org.apache.rocketmq.connect.redis.parser.ZInterStoreParser 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.parser.ZInterStoreParser 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));
}
Aggregations