GraphSONMessageSerializerV3d0 extends AbstractGraphSONMessageSerializerV2d0 implements MessageTextSerializer { @Override public ResponseMessage deserializeResponse(final String msg) throws SerializationException { try { return mapper.readValue(msg, ResponseMessage.class); } catch (Exception ex) { logger.warn(String.format("Response [%s] could not be deserialized by %s.", msg, GraphSONMessageSerializerV3d0.class.getName()), ex); throw new SerializationException(ex); } } GraphSONMessageSerializerV3d0(); @Deprecated  GraphSONMessageSerializerV3d0(final GraphSONMapper mapper);  GraphSONMessageSerializerV3d0(final GraphSONMapper.Builder mapperBuilder); @Override String[] mimeTypesSupported(); @Override ResponseMessage deserializeResponse(final String msg); @Override String serializeResponseAsString(final ResponseMessage responseMessage); @Override RequestMessage deserializeRequest(final String msg); @Override String serializeRequestAsString(final RequestMessage requestMessage);  }
@Test public void shouldSerializeFullResponseMessage() throws Exception { final UUID id = UUID.randomUUID(); final Map<String, Object> metaData = new HashMap<>(); metaData.put("test", "this"); metaData.put("one", 1); final Map<String, Object> attributes = new HashMap<>(); attributes.put("test", "that"); attributes.put("two", 2); final ResponseMessage response = ResponseMessage.build(id) .responseMetaData(metaData) .code(ResponseStatusCode.SUCCESS) .result("some-result") .statusAttributes(attributes) .statusMessage("worked") .create(); final ByteBuf bb = serializer.serializeResponseAsBinary(response, allocator); final ResponseMessage deserialized = serializer.deserializeResponse(bb); assertEquals(id, deserialized.getRequestId()); assertEquals("this", deserialized.getResult().getMeta().get("test")); assertEquals(1, deserialized.getResult().getMeta().get("one")); assertEquals("some-result", deserialized.getResult().getData()); assertEquals("that", deserialized.getStatus().getAttributes().get("test")); assertEquals(2, deserialized.getStatus().getAttributes().get("two")); assertEquals(ResponseStatusCode.SUCCESS.getValue(), deserialized.getStatus().getCode().getValue()); assertEquals("worked", deserialized.getStatus().getMessage()); }