Search in sources :

Example 1 with LPushParser

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

the class ParserTest method testLPushParser.

@Test
public void testLPushParser() {
    String command = "LPUSH key v1 v2";
    KVEntry builder = new LPushParser().parse(parseCommand(command));
    Assert.assertEquals("LPUSH", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    List<String> res = (List<String>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals("v1", res.get(0));
    Assert.assertEquals("v2", res.get(1));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) List(java.util.List) LPushParser(org.apache.rocketmq.connect.redis.parser.LPushParser) RPopLPushParser(org.apache.rocketmq.connect.redis.parser.RPopLPushParser) BrPopLPushParser(org.apache.rocketmq.connect.redis.parser.BrPopLPushParser) Test(org.junit.Test)

Aggregations

List (java.util.List)1 BrPopLPushParser (org.apache.rocketmq.connect.redis.parser.BrPopLPushParser)1 LPushParser (org.apache.rocketmq.connect.redis.parser.LPushParser)1 RPopLPushParser (org.apache.rocketmq.connect.redis.parser.RPopLPushParser)1 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)1 Test (org.junit.Test)1