Search in sources :

Example 1 with SetParser

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

the class ParserTest method testSetParser1.

@Test
public void testSetParser1() {
    String command = "set key value EX 100 NX";
    KVEntry builder = new SetParser().parse(parseCommand(command));
    Assert.assertEquals("set", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertTrue(100 == builder.getParam(Options.REDIS_EX));
    Assert.assertEquals(true, builder.getParam(Options.REDIS_NX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LSetParser(org.apache.rocketmq.connect.redis.parser.LSetParser) SetParser(org.apache.rocketmq.connect.redis.parser.SetParser) HmSetParser(org.apache.rocketmq.connect.redis.parser.HmSetParser) MSetParser(org.apache.rocketmq.connect.redis.parser.MSetParser) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Test(org.junit.Test)

Example 2 with SetParser

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

the class ParserTest method testSetParser2.

@Test
public void testSetParser2() {
    String command = "set key value EX 100";
    KVEntry builder = new SetParser().parse(parseCommand(command));
    Assert.assertEquals("set", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertTrue(100 == builder.getParam(Options.REDIS_EX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LSetParser(org.apache.rocketmq.connect.redis.parser.LSetParser) SetParser(org.apache.rocketmq.connect.redis.parser.SetParser) HmSetParser(org.apache.rocketmq.connect.redis.parser.HmSetParser) MSetParser(org.apache.rocketmq.connect.redis.parser.MSetParser) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Test(org.junit.Test)

Example 3 with SetParser

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

the class ParserTest method testSetParser4.

@Test
public void testSetParser4() {
    String command = "set key value PX 100 XX";
    KVEntry builder = new SetParser().parse(parseCommand(command));
    Assert.assertEquals("set", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertTrue(100L == builder.getParam(Options.REDIS_PX));
    Assert.assertEquals(true, builder.getParam(Options.REDIS_XX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LSetParser(org.apache.rocketmq.connect.redis.parser.LSetParser) SetParser(org.apache.rocketmq.connect.redis.parser.SetParser) HmSetParser(org.apache.rocketmq.connect.redis.parser.HmSetParser) MSetParser(org.apache.rocketmq.connect.redis.parser.MSetParser) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Test(org.junit.Test)

Example 4 with SetParser

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

the class ParserTest method testSetParser3.

@Test
public void testSetParser3() {
    String command = "set key value NX";
    KVEntry builder = new SetParser().parse(parseCommand(command));
    Assert.assertEquals("set", builder.getCommand());
    Assert.assertEquals("key", builder.getKey());
    Assert.assertEquals("value", builder.getValue());
    Assert.assertEquals(true, builder.getParam(Options.REDIS_NX));
}
Also used : KVEntry(org.apache.rocketmq.connect.redis.pojo.KVEntry) LSetParser(org.apache.rocketmq.connect.redis.parser.LSetParser) SetParser(org.apache.rocketmq.connect.redis.parser.SetParser) HmSetParser(org.apache.rocketmq.connect.redis.parser.HmSetParser) MSetParser(org.apache.rocketmq.connect.redis.parser.MSetParser) HSetParser(org.apache.rocketmq.connect.redis.parser.HSetParser) Test(org.junit.Test)

Aggregations

HSetParser (org.apache.rocketmq.connect.redis.parser.HSetParser)4 HmSetParser (org.apache.rocketmq.connect.redis.parser.HmSetParser)4 LSetParser (org.apache.rocketmq.connect.redis.parser.LSetParser)4 MSetParser (org.apache.rocketmq.connect.redis.parser.MSetParser)4 SetParser (org.apache.rocketmq.connect.redis.parser.SetParser)4 KVEntry (org.apache.rocketmq.connect.redis.pojo.KVEntry)4 Test (org.junit.Test)4