use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class DatabasesTest method testGetBounceProxyStatusInformation.
@Test
public void testGetBounceProxyStatusInformation() {
ControlledBounceProxyInformation bpInfo1 = new ControlledBounceProxyInformation("bp1.0", URI.create("http://www.joynr1.de/bp1/"));
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(1000l);
bounceProxyDb.addBounceProxy(bpInfo1);
List<BounceProxyStatusInformation> bpList = bounceProxyDb.getBounceProxyStatusInformation();
Assert.assertEquals(1, bpList.size());
BounceProxyStatusInformation bpInfo = bpList.get(0);
Assert.assertEquals("bp1.0", bpInfo.getBounceProxyId());
Assert.assertEquals(1000l, bpInfo.getFreshness().getTime());
Assert.assertEquals(BounceProxyStatus.ALIVE, bpInfo.getStatus());
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class BounceProxyRecordTest method testCreation.
@Test
public void testCreation() {
ControlledBounceProxyInformation info = new ControlledBounceProxyInformation("X.Y", URI.create("http://www.testuri.com/test"));
BounceProxyRecord record = new BounceProxyRecord(info);
assertEquals(info, record.getInfo());
assertEquals(0, record.getNumberOfAssignedChannels());
assertEquals(BounceProxyRecord.ASSIGNMENT_TIMESTAMP_NEVER, record.getLastAssignedTimestamp());
assertEquals(BounceProxyStatus.ALIVE, record.getStatus());
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class ChannelServiceImpl method createChannel.
/*
* (non-Javadoc)
*
* @see
* io.joynr.messaging.service.ChannelServiceDelegate#createChannel(java.
* lang.String, java.lang.String)
*/
@Override
public Channel createChannel(String ccid, String trackingId) {
try {
// The controller has to assign the channel to a bounce proxy
// instance.
ControlledBounceProxyInformation bpInfo = strategy.calculateBounceProxy(ccid);
URI channelLocation = bpFacade.createChannel(bpInfo, ccid, trackingId);
Channel channel = new Channel(bpInfo, ccid, channelLocation);
channelDirectory.addChannel(channel);
bounceProxyDirectory.updateChannelAssignment(ccid, bpInfo);
return channel;
} catch (Exception e) {
log.error("Could not create channel on bounce proxy: channel {}, error: {}", ccid, e.getMessage());
throw new JoynrRuntimeException("Error creating channel on bounce proxy", e);
}
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testUpdateFreshness.
@Test
public void testUpdateFreshness() {
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(150l);
directory.addBounceProxy(new ControlledBounceProxyInformation("X.Y", URI.create("http://www.location.de")));
assertEquals(150, directory.getBounceProxy("X.Y").getFreshness().getTime());
}
use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.
the class InMemoryBounceProxyDirectoryTest method testUpdateBounceProxyPerformance.
@Test
public void testUpdateBounceProxyPerformance() {
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(100l);
directory.addBounceProxy(new ControlledBounceProxyInformation("X.Y", URI.create("http://www.location.de")));
BounceProxyRecord bounceProxyRecord = directory.getBounceProxy("X.Y");
PerformanceMeasures performanceMeasures = new PerformanceMeasures();
performanceMeasures.addMeasure(Key.ACTIVE_LONGPOLL_COUNT, 5);
performanceMeasures.addMeasure(Key.ASSIGNED_CHANNELS_COUNT, 13);
bounceProxyRecord.setPerformanceMeasures(performanceMeasures);
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(200l);
directory.updateBounceProxy(bounceProxyRecord);
PerformanceMeasures result = directory.getBounceProxy("X.Y").getPerformanceMeasures();
assertEquals(5, result.getMeasure(Key.ACTIVE_LONGPOLL_COUNT));
assertEquals(13, result.getMeasure(Key.ASSIGNED_CHANNELS_COUNT));
assertEquals(200, directory.getBounceProxy("X.Y").getFreshness().getTime());
}
Aggregations