Search in sources :

Example 1 with BounceProxyStatus

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());
        }
    }
}
Also used : BounceProxyStatus(io.joynr.messaging.info.BounceProxyStatus) BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) Test(org.junit.Test)

Example 2 with BounceProxyStatus

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());
        }
    }
}
Also used : BounceProxyStatus(io.joynr.messaging.info.BounceProxyStatus) BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) Test(org.junit.Test)

Aggregations

BounceProxyRecord (io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)2 BounceProxyStatus (io.joynr.messaging.info.BounceProxyStatus)2 ControlledBounceProxyInformation (io.joynr.messaging.info.ControlledBounceProxyInformation)2 Test (org.junit.Test)2