use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testHDelParser.
@Test
public void testHDelParser() {
String command = "HDEL key f1 f2 f3";
KVEntry builder = new HDelParser().parse(parseCommand(command));
Assert.assertEquals("HDEL", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(3, res.size());
Assert.assertEquals("f1", res.get(0));
Assert.assertEquals("f2", res.get(1));
Assert.assertEquals("f3", res.get(2));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPExpireParser.
@Test
public void testPExpireParser() {
String command = "PExpire key 3600";
KVEntry builder = new PExpireParser().parse(parseCommand(command));
Assert.assertEquals("PExpire", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertTrue(3600L == builder.getParam(Options.REDIS_PX));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSetBitParser.
@Test
public void testSetBitParser() {
String command = "SetBit key 100 value";
KVEntry builder = new SetBitParser().parse(parseCommand(command));
Assert.assertEquals("SetBit", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertTrue(100L == builder.getParam(Options.REDIS_OFFSET));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testXClaimParser2.
@Test
public void testXClaimParser2() {
// XCLAIM key group consumer min-idle-time ID [ID ...] [IDLE ms] [TIME ms-unix-time] [RETRYCOUNT count] [force]
String command = "XCLAIM mystream mygroup Alice 3600000 1526569498055-0 1526569498055-1 IDLE 100 TIME 3000 RETRYCOUNT 10 force";
KVEntry builder = new XClaimParser().parse(parseCommand(command));
Assert.assertEquals("XCLAIM", builder.getCommand());
Assert.assertEquals("mystream", builder.getKey());
Assert.assertEquals("mygroup", builder.getParam(Options.REDIS_GROUP));
Assert.assertEquals("Alice", builder.getParam(Options.REDIS_CONSUMER));
Assert.assertTrue(3600000L == builder.getParam(Options.REDIS_MIN_IDLE_TIME));
Assert.assertTrue(100L == builder.getParam(Options.REDIS_IDLE));
Assert.assertTrue(3000L == builder.getParam(Options.REDIS_TIME));
Assert.assertTrue(10 == builder.getParam(Options.REDIS_RETRYCOUNT));
Assert.assertEquals(true, builder.getParam(Options.REDIS_FORCE));
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("1526569498055-0", res.get(0));
Assert.assertEquals("1526569498055-1", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSetParser3.
@Test
public void testSetParser3() {
String command = "set key value NX";
KVEntry builder = new SetParser().parse(parseCommand(command));
Assert.assertEquals("set", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertEquals(true, builder.getParam(Options.REDIS_NX));
}
Aggregations