Search in sources :

Example 1 with LinsertParser

use of org.apache.rocketmq.connect.redis.parser.LinsertParser in project rocketmq-externals by apache.

the class ParserTest method testLinsertParserBefore.

@Test
public void testLinsertParserBefore() {
    String command = "Linsert key BEFORE pivot value";
    KVEntry builder = new LinsertParser().parse(parseCommand(command));
    Assert.assertEquals("Linsert", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    List<String> res = (List<String>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("pivot", res.get(0));
    Assert.assertEquals("value", res.get(1));
    Assert.assertEquals(true, builder.getParam(Options.REDIS_BEFORE));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LinsertParser(org.apache.rocketmq.connect.redis.parser.LinsertParser) List(java.util.List) Test(org.junit.Test)

Example 2 with LinsertParser

use of org.apache.rocketmq.connect.redis.parser.LinsertParser in project rocketmq-externals by apache.

the class ParserTest method testLinsertParserAfter.

@Test
public void testLinsertParserAfter() {
    String command = "Linsert key AFTER pivot value";
    KVEntry builder = new LinsertParser().parse(parseCommand(command));
    Assert.assertEquals("Linsert", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    List<String> res = (List<String>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("pivot", res.get(0));
    Assert.assertEquals("value", res.get(1));
    Assert.assertEquals(true, builder.getParam(Options.REDIS_AFTER));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LinsertParser(org.apache.rocketmq.connect.redis.parser.LinsertParser) List(java.util.List) Test(org.junit.Test)

Aggregations

List (java.util.List)2 LinsertParser (org.apache.rocketmq.connect.redis.parser.LinsertParser)2 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)2 Test (org.junit.Test)2