use of joynr.OneWayRequest in project joynr by bmwcarit.
the class OneWayRequestDeserializer method deserialize.
/* (non-Javadoc)
* @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser,
* com.fasterxml.jackson.databind.DeserializationContext)
*/
@Override
public OneWayRequest deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode node = jp.getCodec().readTree(jp);
String methodName = node.get("methodName").asText();
ParamsAndParamDatatypesHolder paramsAndParamDatatypes = DeserializerUtils.deserializeParams(objectMapper, node, logger);
return new OneWayRequest(methodName, paramsAndParamDatatypes.params, paramsAndParamDatatypes.paramDatatypes);
}
use of joynr.OneWayRequest in project joynr by bmwcarit.
the class SerializationTest method serializeAndDeserializeOneWayTest.
@Test
public void serializeAndDeserializeOneWayTest() throws Exception {
GpsLocation gpsLocation = new GpsLocation(1.0d, 2.0d, 0d, GpsFixEnum.MODE2D, 0d, 0d, 0d, 0d, 0l, 0l, 0);
OneWayRequest oneway = new OneWayRequest("methodName", new Object[] { gpsLocation }, new Class<?>[] { GpsLocation.class });
String valueAsString = objectMapper.writeValueAsString(oneway);
LOG.debug(valueAsString);
OneWayRequest oneway2 = objectMapper.readValue(valueAsString, OneWayRequest.class);
assertEquals(oneway, oneway2);
}
use of joynr.OneWayRequest in project joynr by bmwcarit.
the class DispatcherImplTest method testHandleOneWayRequest.
@Test
public void testHandleOneWayRequest() throws Exception {
OneWayRequest request = new OneWayRequest("method", new Object[0], new Class<?>[0]);
String toParticipantId = "toParticipantId";
MessagingQos messagingQos = new MessagingQos(1000L);
MutableMessage joynrMessage = messageFactory.createOneWayRequest("fromParticipantId", toParticipantId, request, messagingQos);
fixture.messageArrived(joynrMessage.getImmutableMessage());
verify(requestReplyManagerMock).handleOneWayRequest(toParticipantId, request, joynrMessage.getTtlMs());
verify(messageSenderMock, never()).sendMessage(any(MutableMessage.class));
}
use of joynr.OneWayRequest in project joynr by bmwcarit.
the class RequestInterpreterTest method setup.
@Before
public void setup() {
RequestCallerFactory requestCallerFactory = new RequestCallerFactory();
requestCaller = requestCallerFactory.create(new DefaulttestProvider());
subject = new RequestInterpreter(joynrMessageScope, joynrMessageCreatorProvider, joynrMessageContextProvider);
request = new OneWayRequest("getTestAttribute", new Object[0], new Class[0]);
request.setCreatorUserId("creator");
Mockito.when(joynrMessageCreatorProvider.get()).thenReturn(joynrMessageCreator);
Mockito.when(joynrMessageContextProvider.get()).thenReturn(joynrMessageContext);
}
Aggregations