use of com.moilioncircle.redis.replicator.cmd.parser.ZUnionStoreParser in project rocketmq-externals by apache.
the class KryoEventSerializerTest method test.
@Test
public void test() {
Event e = new PreRdbSyncEvent();
Serializer<Event> serializer = new KryoEventSerializer();
System.out.println(serializer.read(serializer.write(e)));
KeyStringValueHash x = new KeyStringValueHash();
x.setKey("key".getBytes());
Map<byte[], byte[]> map1 = new ByteArrayMap();
map1.put("field1".getBytes(), "value1".getBytes());
map1.put("field2".getBytes(), "value2".getBytes());
x.setValue(map1);
KeyStringValueHash kv = (KeyStringValueHash) serializer.read(serializer.write(x));
ByteArrayMap map2 = (ByteArrayMap) kv.getValue();
assertNotNull(map2.get("field1".getBytes()));
ZUnionStoreParser parser = new ZUnionStoreParser();
ZUnionStoreCommand cmd = parser.parse(toObjectArray("zunionstore des 2 k1 k2 WEIGHTS 2 3 AGGREGATE min".split(" ")));
ZUnionStoreCommand cmd1 = (ZUnionStoreCommand) serializer.read(serializer.write(cmd));
for (byte[] bytes : cmd1.getKeys()) {
System.out.println(new String(bytes));
}
System.out.println(cmd1);
}
Aggregations