use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class RemoteBounceProxyFacadeTest method testBounceProxyRejectsChannelCreation.
@Test
public void testBounceProxyRejectsChannelCreation() throws Exception {
setMockedHttpRequestHandlerResponse(HttpStatus.SC_NO_CONTENT, "http://www.joynX.de/channels", "X.Y");
ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create(serverUrl));
try {
bpFacade.createChannel(bpInfo, "channel-123", "trackingId-123");
Assert.fail();
} catch (JoynrProtocolException e) {
}
Mockito.verify(handler).handle(Mockito.argThat(new IsCreateChannelHttpRequest("channel-123", "trackingId-123")), Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class RemoteBounceProxyFacadeTest method testChannelCreationWhenServerIsUnreachable.
@Test
public void testChannelCreationWhenServerIsUnreachable() throws Exception {
try {
server.stop();
} catch (Exception e) {
// do nothing as we don't want tests to fail only because
// stopping of the server did not work
}
server.awaitTermination(1000);
try {
ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create(serverUrl));
bpFacade.createChannel(bpInfo, "channel-123", "trackingId-123");
Assert.fail();
} catch (Exception e) {
System.err.println(e);
}
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class RemoteBounceProxyFacadeTest method testBounceProxyReturnsNoLocation.
@Test
public void testBounceProxyReturnsNoLocation() throws Exception {
setMockedHttpRequestHandlerResponse(HttpStatus.SC_CREATED, null, "X.Y");
ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create(serverUrl));
try {
bpFacade.createChannel(bpInfo, "channel-123", "trackingId-123");
Assert.fail();
} catch (JoynrProtocolException e) {
}
Mockito.verify(handler).handle(Mockito.argThat(new IsCreateChannelHttpRequest("channel-123", "trackingId-123")), Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class MonitoringServiceImplTest method testUpdatePerformanceMeasures.
@Test
public void testUpdatePerformanceMeasures() {
Mockito.when(bpDirectoryMock.containsBounceProxy("X.Y")).thenReturn(true);
Mockito.when(bpDirectoryMock.getBounceProxy("X.Y")).thenReturn(new BounceProxyRecord(new ControlledBounceProxyInformation("X.Y", null)));
PerformanceMeasures performanceMeasures = new PerformanceMeasures();
performanceMeasures.addMeasure(Key.ACTIVE_LONGPOLL_COUNT, 5);
monitoringService.updatePerformanceMeasures("X.Y", performanceMeasures);
ArgumentCaptor<BounceProxyRecord> argument = ArgumentCaptor.forClass(BounceProxyRecord.class);
Mockito.verify(bpDirectoryMock).updateBounceProxy(argument.capture());
Assert.assertEquals("X.Y", argument.getValue().getBounceProxyId());
Assert.assertEquals(5, argument.getValue().getPerformanceMeasures().getMeasure(Key.ACTIVE_LONGPOLL_COUNT));
Assert.assertEquals(BounceProxyStatus.ACTIVE, argument.getValue().getStatus());
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class MonitoringServiceImplTest method testShutdownBounceProxy.
@Test
public void testShutdownBounceProxy() {
Mockito.when(bpDirectoryMock.containsBounceProxy("X.Y")).thenReturn(true);
Mockito.when(bpDirectoryMock.getBounceProxy("X.Y")).thenReturn(new BounceProxyRecord(new ControlledBounceProxyInformation("X.Y", null)));
monitoringService.updateStatus("X.Y", BounceProxyStatus.SHUTDOWN);
ArgumentCaptor<BounceProxyRecord> argument = ArgumentCaptor.forClass(BounceProxyRecord.class);
Mockito.verify(bpDirectoryMock).updateBounceProxy(argument.capture());
Assert.assertEquals("X.Y", argument.getValue().getBounceProxyId());
Assert.assertEquals(BounceProxyStatus.SHUTDOWN, argument.getValue().getStatus());
}
Aggregations