You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/16 22:42:12 UTC
[1/4] incubator-tinkerpop git commit: Add tests for IoRegistry.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/refactor-io 478a44d6f -> 4a7a2a521
Add tests for IoRegistry.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/267e1c00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/267e1c00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/267e1c00
Branch: refs/heads/refactor-io
Commit: 267e1c006e389bb99131669a0cdbfa869be5dd7f
Parents: 478a44d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 13:51:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 13:51:01 2015 -0400
----------------------------------------------------------------------
.../gremlin/structure/io/IoRegistry.java | 12 ++-
.../gremlin/structure/io/IoRegistryTest.java | 99 ++++++++++++++++++++
2 files changed, 106 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/267e1c00/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
index baf2668..ffbcc38 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistry.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
import org.javatuples.Pair;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -52,16 +53,16 @@ public class IoRegistry {
* @param serializer a serializer implementation
*/
public void register(final Class<? extends Io> ioClass, final Class clazz, final Object serializer) {
- if (registeredSerializers.containsKey(ioClass))
- registeredSerializers.get(ioClass).add(Pair.with(clazz, serializer));
- else
- registeredSerializers.put(ioClass, Arrays.asList(Pair.with(clazz, serializer)));
+ if (!registeredSerializers.containsKey(ioClass))
+ registeredSerializers.put(ioClass, new ArrayList<>());
+ registeredSerializers.get(ioClass).add(Pair.with(clazz, serializer));
}
/**
* Find a list of all the serializers registered to an {@link Io} class by the {@link Graph}.
*/
public List<Pair<Class,Object>> find(final Class<? extends Io> builderClass) {
+ if (!registeredSerializers.containsKey(builderClass)) return Collections.emptyList();
return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
.collect(Collectors.toList()));
}
@@ -71,8 +72,9 @@ public class IoRegistry {
* {@link Graph}.
*/
public <S> List<Pair<Class,S>> find(final Class<? extends Io> builderClass, final Class<S> serializerType) {
+ if (!registeredSerializers.containsKey(builderClass)) return Collections.emptyList();
return Collections.unmodifiableList(registeredSerializers.get(builderClass).stream()
- .filter(p -> p.getValue1().getClass().isAssignableFrom(serializerType))
+ .filter(p -> serializerType.isAssignableFrom(p.getValue1().getClass()))
.map(p -> Pair.with(p.getValue0(), (S) p.getValue1()))
.collect(Collectors.toList()));
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/267e1c00/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
new file mode 100644
index 0000000..61b4da4
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoRegistryTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.io;
+
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoIo;
+import org.javatuples.Pair;
+import org.junit.Test;
+
+import java.util.Date;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoRegistryTest {
+ @Test
+ public void shouldFindRegisteredClassesByIoImplementation() {
+ // note that this is a non-standard usage of IoRegistry strictly for testing purposes - refer to javadocs
+ // for proper usage
+ final IoRegistry registry = new IoRegistry();
+ registry.register(GryoIo.class, Long.class, "test");
+ registry.register(GryoIo.class, Integer.class, 1);
+ registry.register(GryoIo.class, String.class, 1L);
+ registry.register(GraphSONIo.class, Short.class, 100);
+
+ final List<Pair<Class, Object>> foundGryo = registry.find(GryoIo.class);
+ assertEquals(3, foundGryo.size());
+ assertEquals("test", foundGryo.get(0).getValue1());
+ assertEquals(String.class, foundGryo.get(2).getValue0());
+ assertEquals(1L, foundGryo.get(2).getValue1());
+ assertEquals(Long.class, foundGryo.get(0).getValue0());
+ assertEquals(1, foundGryo.get(1).getValue1());
+ assertEquals(Integer.class, foundGryo.get(1).getValue0());
+
+ final List<Pair<Class, Object>> foundGraphSON = registry.find(GraphSONIo.class);
+ assertEquals(1, foundGraphSON.size());
+ assertEquals(100, foundGraphSON.get(0).getValue1());
+ assertEquals(Short.class, foundGraphSON.get(0).getValue0());
+ }
+
+ @Test
+ public void shouldFindRegisteredClassesByIoImplementationAndSerializer() {
+ // note that this is a non-standard usage of IoRegistry strictly for testing purposes - refer to javadocs
+ // for proper usage
+ final IoRegistry registry = new IoRegistry();
+ registry.register(GryoIo.class, Long.class, "test");
+ registry.register(GryoIo.class, Integer.class, 1);
+ registry.register(GryoIo.class, String.class, 1L);
+ registry.register(GraphSONIo.class, Short.class, 100);
+
+ final List<Pair<Class, Number>> foundGryo = registry.find(GryoIo.class, Number.class);
+ assertEquals(2, foundGryo.size());
+ assertEquals(String.class, foundGryo.get(1).getValue0());
+ assertEquals(1L, foundGryo.get(1).getValue1());
+ assertEquals(1, foundGryo.get(0).getValue1());
+ assertEquals(Integer.class, foundGryo.get(0).getValue0());
+
+ final List<Pair<Class, Date>> foundGraphSON = registry.find(GraphSONIo.class, Date.class);
+ assertEquals(0, foundGraphSON.size());
+ }
+
+ @Test
+ public void shouldReturnEmptyListIfIoKeyNotPresentOnFindByImplementation() {
+ final IoRegistry registry = new IoRegistry();
+ assertEquals(0, registry.find(GryoIo.class).size());
+ }
+
+ @Test
+ public void shouldReturnEmptyListIfIoKeyNotPresentOnFindByImplementationAndSerializer() {
+ final IoRegistry registry = new IoRegistry();
+ assertEquals(0, registry.find(GryoIo.class, String.class).size());
+ }
+
+ @Test
+ public void shouldReturnEmptyListIfIoKeyPresentButNoSerializer() {
+ final IoRegistry registry = new IoRegistry();
+ registry.register(GryoIo.class, Long.class, String.class);
+ assertEquals(0, registry.find(GryoIo.class, Number.class).size());
+ }
+}
[3/4] incubator-tinkerpop git commit: Reduce the gryo serialization
size of ResponseMessage for Gremlin Server.
Posted by sp...@apache.org.
Reduce the gryo serialization size of ResponseMessage for Gremlin Server.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7bd47a85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7bd47a85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7bd47a85
Branch: refs/heads/refactor-io
Commit: 7bd47a85e615cd6ef91b968974c44a5a7c54b1fd
Parents: 0aea495
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 16:38:03 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 16:38:03 2015 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../driver/ser/GryoMessageSerializerV1d0.java | 50 ++++++++++----------
2 files changed, 27 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7bd47a85/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index db78b78..54cf4e8 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
TinkerPop 3.0.0.M9 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Decreased size of Gremlin Server `RequestMessage` and `ResponseMessage` serialization payloads and reduced object creation.
* `Graph.empty()` no longer required with the introduction of `ShellGraph` which is a placeholder for a graph class and computer.
* `VertexProperty.Cardinality` default is now vendor chosen. If the vendor has not preference, they should use `Cardinality.single`.
* `Messenger.receiveMessages()` no longer takes a `MessageScope` and thus, consistent behavior between message-passing and message-pulling systems.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7bd47a85/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
index 71cca0f..7fba9a1 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@ -178,15 +178,19 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
final byte[] payload = new byte[msg.readableBytes()];
msg.readBytes(payload);
try (final Input input = new Input(payload)) {
- final Map<String, Object> responseData = (Map<String, Object>) kryo.readClassAndObject(input);
- final Map<String, Object> status = (Map<String, Object>) responseData.get(SerTokens.TOKEN_STATUS);
- final Map<String, Object> result = (Map<String, Object>) responseData.get(SerTokens.TOKEN_RESULT);
- return ResponseMessage.build(UUID.fromString(responseData.get(SerTokens.TOKEN_REQUEST).toString()))
- .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
- .statusMessage(Optional.ofNullable((String) status.get(SerTokens.TOKEN_MESSAGE)).orElse(""))
- .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
- .result(result.get(SerTokens.TOKEN_DATA))
- .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
+ final UUID requestId = kryo.readObjectOrNull(input, UUID.class);
+ final int status = input.readShort();
+ final String statusMsg = input.readString();
+ final Map<String,Object> statusAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
+ final Object result = kryo.readClassAndObject(input);
+ final Map<String,Object> metaAttributes = (Map<String,Object>) kryo.readClassAndObject(input);
+
+ return ResponseMessage.build(requestId)
+ .code(ResponseStatusCode.getFromValue(status))
+ .statusMessage(statusMsg)
+ .statusAttributes(statusAttributes)
+ .result(result)
+ .responseMetaData(metaAttributes)
.create();
}
} catch (Exception ex) {
@@ -199,30 +203,28 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
public ByteBuf serializeResponseAsBinary(final ResponseMessage responseMessage, final ByteBufAllocator allocator) throws SerializationException {
ByteBuf encodedMessage = null;
try {
- final Map<String, Object> result = new HashMap<>();
- result.put(SerTokens.TOKEN_DATA, serializeToString ? serializeResultToString(responseMessage) : responseMessage.getResult().getData());
- result.put(SerTokens.TOKEN_META, responseMessage.getResult().getMeta());
-
- final Map<String, Object> status = new HashMap<>();
- status.put(SerTokens.TOKEN_MESSAGE, responseMessage.getStatus().getMessage());
- status.put(SerTokens.TOKEN_CODE, responseMessage.getStatus().getCode().getValue());
- status.put(SerTokens.TOKEN_ATTRIBUTES, responseMessage.getStatus().getAttributes());
-
- final Map<String, Object> message = new HashMap<>();
- message.put(SerTokens.TOKEN_STATUS, status);
- message.put(SerTokens.TOKEN_RESULT, result);
- message.put(SerTokens.TOKEN_REQUEST, responseMessage.getRequestId() != null ? responseMessage.getRequestId() : null);
-
final Kryo kryo = kryoThreadLocal.get();
try (final OutputStream baos = new ByteArrayOutputStream()) {
final Output output = new Output(baos);
- kryo.writeClassAndObject(output, message);
+
+ // request id - if present
+ kryo.writeObjectOrNull(output, responseMessage.getRequestId() != null ? responseMessage.getRequestId() : null, UUID.class);
+
+ // status
+ output.writeShort(responseMessage.getStatus().getCode().getValue());
+ output.writeString(responseMessage.getStatus().getMessage());
+ kryo.writeClassAndObject(output, responseMessage.getStatus().getAttributes());
+
+ // result
+ kryo.writeClassAndObject(output, serializeToString ? serializeResultToString(responseMessage) : responseMessage.getResult().getData());
+ kryo.writeClassAndObject(output, responseMessage.getResult().getMeta());
final long size = output.total();
if (size > Integer.MAX_VALUE)
throw new SerializationException(String.format("Message size of %s exceeds allocatable space", size));
encodedMessage = allocator.buffer((int) output.total());
+ System.out.println(size);
encodedMessage.writeBytes(output.toBytes());
}
[4/4] incubator-tinkerpop git commit: Merge remote-tracking branch
'origin/master' into refactor-io
Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into refactor-io
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4a7a2a52
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4a7a2a52
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4a7a2a52
Branch: refs/heads/refactor-io
Commit: 4a7a2a52139f817d83232ab845c236ef9a2a31c4
Parents: 267e1c0 7bd47a8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 16:38:51 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 16:38:51 2015 -0400
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../driver/ser/GryoMessageSerializerV1d0.java | 77 +++++++++++---------
.../ser/GryoMessageSerializerV1D0Test.java | 21 ++++++
3 files changed, 63 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4a7a2a52/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
[2/4] incubator-tinkerpop git commit: Reduce the size of
RequestMessage serialization a bit in Gryo.
Posted by sp...@apache.org.
Reduce the size of RequestMessage serialization a bit in Gryo.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/0aea4959
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/0aea4959
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/0aea4959
Branch: refs/heads/refactor-io
Commit: 0aea49591d08b7214f3ecce3ef0aef87b2af6dc2
Parents: f366285
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 16 15:54:48 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 16 15:54:48 2015 -0400
----------------------------------------------------------------------
.../driver/ser/GryoMessageSerializerV1d0.java | 27 +++++++++++---------
.../ser/GryoMessageSerializerV1D0Test.java | 21 +++++++++++++++
2 files changed, 36 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0aea4959/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
index 40e23bd..71cca0f 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1d0.java
@@ -242,11 +242,17 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
final byte[] payload = new byte[msg.readableBytes()];
msg.readBytes(payload);
try (final Input input = new Input(payload)) {
- final Map<String, Object> requestData = (Map<String, Object>) kryo.readClassAndObject(input);
- final RequestMessage.Builder builder = RequestMessage.build((String) requestData.get(SerTokens.TOKEN_OP))
- .overrideRequestId((UUID) requestData.get(SerTokens.TOKEN_REQUEST))
- .processor((String) requestData.get(SerTokens.TOKEN_PROCESSOR));
- final Map<String, Object> args = (Map<String, Object>) requestData.get(SerTokens.TOKEN_ARGS);
+ // by the time the message gets here, the mime length/type have been already read, so this part just
+ // needs to process the payload.
+ final UUID id = kryo.readObject(input, UUID.class);
+ final String processor = input.readString();
+ final String op = input.readString();
+
+ final RequestMessage.Builder builder = RequestMessage.build(op)
+ .overrideRequestId(id)
+ .processor(processor);
+
+ final Map<String, Object> args = kryo.readObject(input, HashMap.class);
args.forEach(builder::addArg);
return builder.create();
}
@@ -267,13 +273,10 @@ public class GryoMessageSerializerV1d0 implements MessageSerializer {
output.writeByte(mimeType.length());
output.write(mimeType.getBytes(UTF8));
- final Map<String, Object> request = new HashMap<>();
- request.put(SerTokens.TOKEN_REQUEST, requestMessage.getRequestId());
- request.put(SerTokens.TOKEN_PROCESSOR, requestMessage.getProcessor());
- request.put(SerTokens.TOKEN_OP, requestMessage.getOp());
- request.put(SerTokens.TOKEN_ARGS, requestMessage.getArgs());
-
- kryo.writeClassAndObject(output, request);
+ kryo.writeObject(output, requestMessage.getRequestId());
+ output.writeString(requestMessage.getProcessor());
+ output.writeString(requestMessage.getOp());
+ kryo.writeObject(output, requestMessage.getArgs());
final long size = output.total();
if (size > Integer.MAX_VALUE)
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0aea4959/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
index 978c8a2..20bc308 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
@@ -19,6 +19,7 @@
package org.apache.tinkerpop.gremlin.driver.ser;
import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
@@ -279,6 +280,26 @@ public class GryoMessageSerializerV1D0Test {
assertEquals("worked", deserialized.getStatus().getMessage());
}
+ @Test
+ public void serializeFullRequestMessage() throws Exception {
+ final UUID id = UUID.randomUUID();
+
+ final RequestMessage request = RequestMessage.build("try")
+ .overrideRequestId(id)
+ .processor("pro")
+ .addArg("test", "this")
+ .create();
+ final ByteBuf bb = binarySerializer.serializeRequestAsBinary(request, allocator);
+ final int mimeLen = bb.readByte();
+ bb.readBytes(new byte[mimeLen]);
+ final RequestMessage deserialized = binarySerializer.deserializeRequest(bb);
+
+ assertEquals(id, deserialized.getRequestId());
+ assertEquals("pro", deserialized.getProcessor());
+ assertEquals("try", deserialized.getOp());
+ assertEquals("this", deserialized.getArgs().get("test"));
+ }
+
private void assertCommon(final ResponseMessage response) {
assertEquals(requestId, response.getRequestId());
assertEquals(ResponseStatusCode.SUCCESS, response.getStatus().getCode());