use of org.apache.rocketmq.connect.redis.pojo.KVEntry 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));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSRemParser.
@Test
public void testSRemParser() {
String command = "SREM key m1 m2";
KVEntry builder = new SRemParser().parse(parseCommand(command));
Assert.assertEquals("SREM", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("m1", res.get(0));
Assert.assertEquals("m2", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testHmSetParser.
@Test
public void testHmSetParser() {
String command = "hmset key f1 v1 f2 v2";
KVEntry builder = new HmSetParser().parse(parseCommand(command));
Assert.assertEquals("hmset", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Map<String, String> res = (Map<String, String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("v1", res.get("f1"));
Assert.assertEquals("v2", res.get("f2"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testLSetParser.
@Test
public void testLSetParser() {
String command = "LSet key 10 value";
KVEntry builder = new LSetParser().parse(parseCommand(command));
Assert.assertEquals("LSet", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertTrue(10L == builder.getParam(Options.REDIS_INDEX));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSwapDbParser.
@Test
public void testSwapDbParser() {
String command = "SWAPDB 0 1";
KVEntry builder = new SwapDbParser().parse(parseCommand(command));
Assert.assertEquals("SWAPDB", builder.getCommand());
Assert.assertEquals("0", builder.getKey());
Assert.assertEquals("1", builder.getValue());
}
Aggregations