use of org.apache.rocketmq.connect.redis.parser.XClaimParser 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.parser.XClaimParser in project rocketmq-externals by apache.
the class ParserTest method testXClaimParser1.
@Test
public void testXClaimParser1() {
// 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";
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));
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));
}
Aggregations