use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPExpireAtParser.
@Test
public void testPExpireAtParser() {
String command = "PExpireAt key 3600";
KVEntry builder = new PExpireAtParser().parse(parseCommand(command));
Assert.assertEquals("PExpireAt", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertTrue(3600L == builder.getParam(Options.REDIS_PX_TIMESTAMP));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testScriptParser.
@Test
public void testScriptParser() {
String command = "Script";
KVEntry builder = new ScriptParser().parse(parseCommand(command));
Assert.assertEquals("Script", builder.getCommand());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSMoveParser.
@Test
public void testSMoveParser() {
String command = "SMOVE source destination member";
KVEntry builder = new SMoveParser().parse(parseCommand(command));
Assert.assertEquals("SMOVE", builder.getCommand());
Assert.assertEquals("source", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("destination", res.get(0));
Assert.assertEquals("member", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testHIncrByParser.
@Test
public void testHIncrByParser() {
String command = "HINCRBY key field 100";
KVEntry builder = new HIncrByParser().parse(parseCommand(command));
Assert.assertEquals("HINCRBY", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("field", builder.getValue());
Assert.assertTrue(100L == builder.getParam(Options.REDIS_INCREMENT));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testHSetParser.
@Test
public void testHSetParser() {
String command = "hset key field value";
KVEntry builder = new HSetParser().parse(parseCommand(command));
Assert.assertEquals("hset", 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"));
}
Aggregations