use of org.apache.rocketmq.connect.redis.parser.ZAddParser in project rocketmq-externals by apache.
the class ParserTest method testZAddParser2.
@Test
public void testZAddParser2() {
// ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
String command = "ZADD key NX CH INCR 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"));
Assert.assertEquals(true, builder.getParam(Options.REDIS_NX));
Assert.assertEquals(true, builder.getParam(Options.REDIS_CH));
Assert.assertEquals(true, builder.getParam(Options.REDIS_INCR));
}
use of org.apache.rocketmq.connect.redis.parser.ZAddParser in project rocketmq-externals by apache.
the class ParserTest method testZAddParser3.
@Test
public void testZAddParser3() {
// ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
String command = "ZADD key XX CH INCR 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"));
Assert.assertEquals(true, builder.getParam(Options.REDIS_XX));
Assert.assertEquals(true, builder.getParam(Options.REDIS_CH));
Assert.assertEquals(true, builder.getParam(Options.REDIS_INCR));
}
use of org.apache.rocketmq.connect.redis.parser.ZAddParser 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