use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testGetAssignableBounceProxiesForDirectoryWithUnassignableOnes.
@Test
public void testGetAssignableBounceProxiesForDirectoryWithUnassignableOnes() {
directory.addBounceProxy(new ControlledBounceProxyInformation("A1.B1", null));
directory.addBounceProxy(new ControlledBounceProxyInformation("A2.B2", null));
BounceProxyRecord bounceProxyRecord = directory.getBounceProxy("A2.B2");
bounceProxyRecord.setStatus(BounceProxyStatus.EXCLUDED);
directory.updateBounceProxy(bounceProxyRecord);
directory.addBounceProxy(new ControlledBounceProxyInformation("A3.B3", null));
List<BounceProxyRecord> bounceProxies = directory.getAssignableBounceProxies();
Assert.assertThat(bounceProxies, Matchers.hasItem(hasId("A1.B1")));
Assert.assertThat(bounceProxies, Matchers.hasItem(hasId("A3.B3")));
assertEquals(2, bounceProxies.size());
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testContainsBounceProxy.
@Test
public void testContainsBounceProxy() {
directory.addBounceProxy(new ControlledBounceProxyInformation("X.Y", null));
assertTrue(directory.containsBounceProxy("X.Y"));
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testUpdateChannelAssignmentOnNonExistingBounceProxy.
@Test
public void testUpdateChannelAssignmentOnNonExistingBounceProxy() {
directory.addBounceProxy(new ControlledBounceProxyInformation("A.B", null));
try {
directory.updateChannelAssignment("channel-123", new BounceProxyInformation("X.Y", null));
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class ChannelServiceImplTest method testCreateChannel.
@Test
public void testCreateChannel() throws JoynrProtocolException {
ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create("http://bpX.de"));
Mockito.when(channelAssignmentStrategyMock.calculateBounceProxy("channel-123")).thenReturn(bpInfo);
Mockito.when(bpMock.createChannel(bpInfo, "channel-123", "trackingId-xyz")).thenReturn(URI.create("http://bpX.de/channels/channel-123"));
Channel channel = channelService.createChannel("channel-123", "trackingId-xyz");
assertEquals("channel-123", channel.getChannelId());
assertEquals("X.Y", channel.getBounceProxy().getId());
assertEquals("http://bpX.de", channel.getBounceProxy().getLocation().toString());
assertEquals("http://bpX.de/channels/channel-123", channel.getLocation().toString());
Mockito.verify(channelDirectoryMock, Mockito.times(1)).addChannel(channel);
Mockito.verify(bpDirectoryMock).updateChannelAssignment("channel-123", bpInfo);
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class RemoteBounceProxyFacadeTest method testBounceProxyReturnsNoBounceProxyId.
@Test
public void testBounceProxyReturnsNoBounceProxyId() throws Exception {
setMockedHttpRequestHandlerResponse(HttpStatus.SC_CREATED, "http://www.joynX.de/channels", null);
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));
}
Aggregations