use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testHSetNxParser.
@Test
public void testHSetNxParser() {
String command = "hsetnx key field value";
KVEntry builder = new HSetNxParser().parse(parseCommand(command));
Assert.assertEquals("hsetnx", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Map<String, String> res = (Map<String, String>) builder.getValue();
Assert.assertEquals(1, res.size());
Assert.assertEquals("value", res.get("field"));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPSetExParser.
@Test
public void testPSetExParser() {
String command = "PSETEX key 1000 value";
KVEntry builder = new PSetExParser().parse(parseCommand(command));
Assert.assertEquals("PSETEX", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertTrue(1000L == builder.getParam(Options.REDIS_PX));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testFlushAllParser.
@Test
public void testFlushAllParser() {
String command = "FLUSHALL ASYNC";
KVEntry builder = new FlushAllParser().parse(parseCommand(command));
Assert.assertEquals("FLUSHALL", builder.getCommand());
Assert.assertEquals("ASYNC", builder.getKey());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPfMergeParser.
@Test
public void testPfMergeParser() {
String command = "PFMERGE destkey sourcekey1 sourcekey2";
KVEntry builder = new PfMergeParser().parse(parseCommand(command));
Assert.assertEquals("PFMERGE", builder.getCommand());
Assert.assertEquals("destkey", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("sourcekey1", res.get(0));
Assert.assertEquals("sourcekey2", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testExpireAtParser.
@Test
public void testExpireAtParser() {
String command = "expireat 500";
KVEntry builder = new ExpireAtParser().parse(parseCommand(command));
Assert.assertEquals("expireat", builder.getCommand());
Assert.assertEquals("500", builder.getKey());
Assert.assertTrue(500 == builder.getParam(Options.REDIS_EX_TIMESTAMP));
}
Aggregations