Search in sources :

Example 6 with BounceProxyInformation

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;
}
Also used : Channel(io.joynr.messaging.info.Channel) BounceProxyInformation(io.joynr.messaging.info.BounceProxyInformation)

Example 7 with BounceProxyInformation

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

Example 8 with BounceProxyInformation

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

Example 9 with BounceProxyInformation

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) {
    }
}
Also used : BounceProxyInformation(io.joynr.messaging.info.BounceProxyInformation) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) Test(org.junit.Test)

Example 10 with BounceProxyInformation

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

Aggregations

BounceProxyInformation (io.joynr.messaging.info.BounceProxyInformation)10 ControlledBounceProxyInformation (io.joynr.messaging.info.ControlledBounceProxyInformation)7 Test (org.junit.Test)7 BounceProxyRecord (io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)4 LinkedList (java.util.LinkedList)4 Inject (com.google.inject.Inject)1 Channel (io.joynr.messaging.info.Channel)1