use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class RoundRobinAssignmentTest method testAssignmentToUnassignedBounceProxySmallTimestamps.
@Test
public void testAssignmentToUnassignedBounceProxySmallTimestamps() {
LinkedList<BounceProxyRecord> bpList = new LinkedList<BounceProxyRecord>();
bpList.add(createBounceProxyRecordWithChannels("X1.Y1", 2, 2l));
bpList.add(createBounceProxyRecordWithChannels("X2.Y2", 3, 3l));
bpList.add(createBounceProxyRecord("X3.Y3"));
Mockito.when(directoryMock.getAssignableBounceProxies()).thenReturn(bpList);
BounceProxyInformation bounceProxy = assignmentStrategy.calculateBounceProxy("channel-123");
Assert.assertEquals("X3.Y3", 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 testAssignmentToUnassignedBounceProxy.
@Test
public void testAssignmentToUnassignedBounceProxy() {
LinkedList<BounceProxyRecord> bpList = new LinkedList<BounceProxyRecord>();
bpList.add(createBounceProxyRecordWithChannels("X1.Y1", 2, 23456456456l));
bpList.add(createBounceProxyRecordWithChannels("X2.Y2", 3, 19837453453l));
bpList.add(createBounceProxyRecord("X3.Y3"));
Mockito.when(directoryMock.getAssignableBounceProxies()).thenReturn(bpList);
BounceProxyInformation bounceProxy = assignmentStrategy.calculateBounceProxy("channel-123");
Assert.assertEquals("X3.Y3", 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 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.BounceProxyInformation in project joynr by bmwcarit.
the class SingleBounceProxyInformationProvider method setHostPath.
@Inject(optional = true)
public void setHostPath(@Named(MessagingPropertyKeys.PROPERTY_SERVLET_HOST_PATH) String hostPath, HttpServletRequest request) {
if (hostPath.endsWith("/")) {
hostPath = hostPath.substring(0, hostPath.length() - 1);
}
this.hostPath = hostPath;
String servletContext = request.getServletContext().getContextPath();
if (this.hostPath != null) {
log.info("Using bounceproxy URL {} from property {}", hostPath, MessagingPropertyKeys.PROPERTY_SERVLET_HOST_PATH);
bpInfo = new BounceProxyInformation(hostPath, URI.create(hostPath + servletContext));
}
}
use of io.joynr.messaging.info.BounceProxyInformation in project joynr by bmwcarit.
the class SingleBounceProxyInformationProvider method get.
@Override
public BounceProxyInformation get() {
if (bpInfo == null) {
log.info("No bounceproxy URL set from properties. Using bounceproxy URL {} created from request", hostPathFromRequest);
bpInfo = new BounceProxyInformation(hostPathFromRequest.getHost(), hostPathFromRequest);
}
return bpInfo;
}
Aggregations