use of io.joynr.jeeintegration.messaging.JeeMessagingEndpoint in project joynr by bmwcarit.
the class JeeMessagingEndpointTest method testStatus.
@Test
public void testStatus() {
JeeMessagingEndpoint subject = createSubject().subject;
Response result = subject.status();
assertNotNull(result);
assertEquals(200, result.getStatus());
}
use of io.joynr.jeeintegration.messaging.JeeMessagingEndpoint in project joynr by bmwcarit.
the class JeeMessagingEndpointTest method callPostMethod.
private void callPostMethod(PostMethodCaller postMethodCaller) throws Exception {
SubjectData subjectData = createSubject();
JeeMessagingEndpoint subject = subjectData.subject;
byte[] payload = new byte[] { 1, 2, 3 };
UriInfo uriInfo = mock(UriInfo.class);
UriBuilder uriBuilder = mock(UriBuilder.class);
UriBuilder pathBuilder = mock(UriBuilder.class);
MutableMessage mutableMessage = new MutableMessage();
mutableMessage.setSender("testSender");
mutableMessage.setRecipient("testRecipient");
mutableMessage.setTtlAbsolute(true);
mutableMessage.setTtlMs(ExpiryDate.fromRelativeTtl(1000L).getValue());
mutableMessage.setPayload(payload);
when(uriBuilder.path("messages/" + mutableMessage.getId())).thenReturn(pathBuilder);
when(uriInfo.getBaseUriBuilder()).thenReturn(uriBuilder);
postMethodCaller.call(subject, "channel-1", mutableMessage.getImmutableMessage().getSerializedMessage(), uriInfo);
Mockito.verify(subjectData.messageReceiver).receive(Mockito.any());
}
use of io.joynr.jeeintegration.messaging.JeeMessagingEndpoint in project joynr by bmwcarit.
the class JeeMessagingEndpointTest method createSubject.
private SubjectData createSubject() {
SubjectData result = new SubjectData();
JoynrIntegrationBean joynrIntegrationBean = mock(JoynrIntegrationBean.class);
result.injector = mock(Injector.class);
when(joynrIntegrationBean.getJoynrInjector()).thenReturn(result.injector);
result.objectMapper = mock(ObjectMapper.class);
when(result.injector.getInstance(ObjectMapper.class)).thenReturn(result.objectMapper);
result.messageReceiver = mock(ServletMessageReceiver.class);
when(result.injector.getInstance(ServletMessageReceiver.class)).thenReturn(result.messageReceiver);
result.subject = new JeeMessagingEndpoint(joynrIntegrationBean);
return result;
}
Aggregations