use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testDelParser.
@Test
public void testDelParser() {
String command = "del k1 k2 k3";
KVEntry builder = new DelParser().parse(parseCommand(command));
Assert.assertEquals("del", builder.getCommand());
Assert.assertEquals("k1", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(3, res.size());
Assert.assertEquals("k1", res.get(0));
Assert.assertEquals("k2", res.get(1));
Assert.assertEquals("k3", res.get(2));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testDecrParser.
@Test
public void testDecrParser() {
String command = "DECR key";
KVEntry builder = new DecrParser().parse(parseCommand(command));
Assert.assertEquals("DECR", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testPfCountParser.
@Test
public void testPfCountParser() {
String command = "PFCOUNT k1 k2";
KVEntry builder = new PfCountParser().parse(parseCommand(command));
Assert.assertEquals("PFCOUNT", builder.getCommand());
Assert.assertEquals("k1", builder.getKey());
List<String> res = (List<String>) builder.getValue();
Assert.assertEquals(2, res.size());
Assert.assertEquals("k1", res.get(0));
Assert.assertEquals("k2", res.get(1));
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ProcessorTest method test.
@Test
public void test() {
processor = getProcessor();
RedisEvent event = getRedisEvent();
Exception ex = null;
try {
processor.commit(event);
} catch (Exception e) {
e.printStackTrace();
ex = e;
}
Assert.assertNull(ex);
try {
KVEntry entry = processor.poll();
Assert.assertEquals("key", entry.getKey());
Assert.assertEquals("value", entry.getValue());
Assert.assertEquals("c18cece63c7b16851a6f387f52dbbb9eee07e46f", entry.getSourceId());
} catch (InterruptedException e) {
e.printStackTrace();
ex = e;
} catch (Exception e) {
e.printStackTrace();
}
Assert.assertNull(ex);
}
use of org.apache.rocketmq.connect.redis.pojo.KVEntry in project rocketmq-externals by apache.
the class ParserTest method testSetExParser.
@Test
public void testSetExParser() {
String command = "setex key 100 value";
KVEntry builder = new SetExParser().parse(parseCommand(command));
Assert.assertEquals("setex", builder.getCommand());
Assert.assertEquals("key", builder.getKey());
Assert.assertEquals("value", builder.getValue());
Assert.assertTrue(100 == builder.getParam(Options.REDIS_EX));
}
Aggregations