use of io.joynr.messaging.info.BounceProxyStatus in project joynr by bmwcarit.
the class BounceProxyEhcacheAdapterTest method testGetAssignableBounceProxies.
@Test
public void testGetAssignableBounceProxies() {
List<BounceProxyRecord> assignableBounceProxies = cache.getAssignableBounceProxies();
assertEquals(0, assignableBounceProxies.size());
ControlledBounceProxyInformation bpInfo1 = new ControlledBounceProxyInformation("bp1.0", URI.create("http://www.joynr1.de/bp1/"));
cache.addBounceProxy(bpInfo1);
assignableBounceProxies = cache.getAssignableBounceProxies();
assertEquals(1, assignableBounceProxies.size());
for (BounceProxyStatus status : BounceProxyStatus.values()) {
BounceProxyRecord bpRecord = new BounceProxyRecord(bpInfo1);
bpRecord.setStatus(status);
cache.updateBounceProxy(bpRecord);
assignableBounceProxies = cache.getAssignableBounceProxies();
if (status.isAssignable()) {
assertEquals(1, assignableBounceProxies.size());
} else {
assertEquals(0, assignableBounceProxies.size());
}
}
}
use of io.joynr.messaging.info.BounceProxyStatus in project joynr by bmwcarit.
the class DatabasesTest method testGetAssignableBounceProxies.
@Test
public void testGetAssignableBounceProxies() {
List<BounceProxyRecord> assignableBounceProxies = bounceProxyDb.getAssignableBounceProxies();
Assert.assertEquals(0, assignableBounceProxies.size());
ControlledBounceProxyInformation bpInfo1 = new ControlledBounceProxyInformation("bp1.0", URI.create("http://www.joynr1.de/bp1/"));
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(1000l);
bounceProxyDb.addBounceProxy(bpInfo1);
assignableBounceProxies = bounceProxyDb.getAssignableBounceProxies();
Assert.assertEquals(1, assignableBounceProxies.size());
for (BounceProxyStatus status : BounceProxyStatus.values()) {
BounceProxyRecord bpRecord = new BounceProxyRecord(bpInfo1);
bpRecord.setStatus(status);
Mockito.when(mockTimestampProvider.getCurrentTime()).thenReturn(2000l);
bounceProxyDb.updateBounceProxy(bpRecord);
assignableBounceProxies = bounceProxyDb.getAssignableBounceProxies();
if (status.isAssignable()) {
Assert.assertEquals(1, assignableBounceProxies.size());
} else {
Assert.assertEquals(0, assignableBounceProxies.size());
}
}
}
Aggregations