Search in sources :

Example 1 with EvalShaParser

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

the class ParserTest method testEvalShaParser.

@Test
public void testEvalShaParser() {
    String command = "EVAL sha1 2 k1 k2 arg1 arg2";
    KVEntry builder = new EvalShaParser().parse(parseCommand(command));
    Assert.assertEquals("EVAL", builder.getCommand());
    Assert.assertEquals("sha1", builder.getKey());
    List<List<String>> res = (List<List<String>>) builder.getValue();
    Assert.assertEquals(2, res.size());
    Assert.assertEquals(2, res.get(0).size());
    Assert.assertEquals(2, res.get(1).size());
    Assert.assertEquals("k1", res.get(0).get(0));
    Assert.assertEquals("k2", res.get(0).get(1));
    Assert.assertEquals("arg1", res.get(1).get(0));
    Assert.assertEquals("arg2", res.get(1).get(1));
}
Also used : EvalShaParser(org.apache.rocketmq.connect.redis.parser.EvalShaParser) KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) List(java.util.List) Test(org.junit.Test)

Aggregations

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