use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class AbstractChannelSetUpTest method createChannel.
protected Channel createChannel(String bpId, String baseUrl, String ccid) {
BounceProxyInformation bounceProxy = new BounceProxyInformation(bpId, URI.create(baseUrl));
Channel channel = new Channel(bounceProxy, ccid, URI.create(baseUrl + "/channels/" + ccid));
return channel;
}
use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class RoundRobinAssignmentTest method testAssignmentWithSingleBounceProxy.
@Test
public void testAssignmentWithSingleBounceProxy() {
LinkedList<BounceProxyRecord> bpList = new LinkedList<BounceProxyRecord>();
bpList.add(createBounceProxyRecord("X.Y"));
Mockito.when(directoryMock.getAssignableBounceProxies()).thenReturn(bpList);
BounceProxyInformation bounceProxy = assignmentStrategy.calculateBounceProxy("channel-123");
Assert.assertEquals("X.Y", bounceProxy.getId());
Mockito.verify(directoryMock, Mockito.never()).updateChannelAssignment("channel-123", bounceProxy);
}
use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class RoundRobinAssignmentTest method testAssignmentToBounceProxyWithSmallestTimestamp.
@Test
public void testAssignmentToBounceProxyWithSmallestTimestamp() {
LinkedList<BounceProxyRecord> bpList = new LinkedList<BounceProxyRecord>();
bpList.add(createBounceProxyRecordWithChannels("X1.Y1", 2, 3));
bpList.add(createBounceProxyRecordWithChannels("X2.Y2", 3, 2));
bpList.add(createBounceProxyRecordWithChannels("X3.Y3", 1, 5));
Mockito.when(directoryMock.getAssignableBounceProxies()).thenReturn(bpList);
BounceProxyInformation bounceProxy = assignmentStrategy.calculateBounceProxy("channel-123");
Assert.assertEquals("X2.Y2", bounceProxy.getId());
Mockito.verify(directoryMock, Mockito.never()).updateChannelAssignment("channel-123", bounceProxy);
}
use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testUpdateChannelAssignmentOnEmptyDirectory.
@Test
public void testUpdateChannelAssignmentOnEmptyDirectory() {
try {
directory.updateChannelAssignment("channel-123", new BounceProxyInformation("X.Y", null));
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testUpdateChannelAssignment.
@Test
public void testUpdateChannelAssignment() {
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(100l);
directory.addBounceProxy(new ControlledBounceProxyInformation("X.Y", null));
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(200l);
directory.updateChannelAssignment("channel-123", new BounceProxyInformation("X.Y", null));
BounceProxyRecord bounceProxy = directory.getBounceProxy("X.Y");
assertNotNull(bounceProxy);
assertEquals(1, bounceProxy.getNumberOfAssignedChannels());
assertEquals(200, bounceProxy.getLastAssignedTimestamp());
}
Aggregations