Search in sources :

Example 11 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class InMemoryBounceProxyDirectory method addBounceProxy.

@Override
public void addBounceProxy(ControlledBounceProxyInformation bpInfo) {
    if (directory.containsKey(bpInfo.getId()))
        throw new IllegalArgumentException("Bounce proxy with ID '" + bpInfo.getId() + "' already added to the directory");
    BounceProxyRecord record = new BounceProxyRecord(bpInfo);
    record.setFreshness(timestampProvider.getCurrentTime());
    directory.put(bpInfo.getId(), record);
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Example 12 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class InMemoryBounceProxyDirectory method updateChannelAssignment.

@Override
public void updateChannelAssignment(String ccid, BounceProxyInformation bpInfo) {
    if (!directory.containsKey(bpInfo.getId()))
        throw new IllegalArgumentException("No bounce proxy with ID '" + bpInfo.getId() + "' available in the directory");
    BounceProxyRecord record = directory.get(bpInfo.getId());
    record.addAssignedChannel(ccid);
    record.setLastAssignedTimestamp(timestampProvider.getCurrentTime());
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Example 13 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class BounceProxyEntity method convertToBounceProxyRecord.

public BounceProxyRecord convertToBounceProxyRecord() {
    BounceProxyRecord bpRecord = new BounceProxyRecord(bpInfo.convertToBounceProxyInformation());
    for (ChannelEntity channelEntity : this.channels) {
        bpRecord.addAssignedChannel(channelEntity.getChannelId());
    }
    bpRecord.setFreshness(this.freshness);
    bpRecord.setLastAssignedTimestamp(this.lastAssignedTimestamp);
    bpRecord.setStatus(BounceProxyStatus.valueOf(this.status));
    return bpRecord;
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Example 14 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord in project joynr by bmwcarit.

the class MonitoringServiceImpl method updatePerformanceMeasures.

@Override
public void updatePerformanceMeasures(String bpId, PerformanceMeasures performanceMeasures) {
    BounceProxyRecord bounceProxyRecord = bounceProxyDirectory.getBounceProxy(bpId);
    bounceProxyRecord.setPerformanceMeasures(performanceMeasures);
    bounceProxyRecord.setStatus(BounceProxyStatus.ACTIVE);
    bounceProxyDirectory.updateBounceProxy(bounceProxyRecord);
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)

Example 15 with BounceProxyRecord

use of io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord 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)

Aggregations

BounceProxyRecord (io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)30 ControlledBounceProxyInformation (io.joynr.messaging.info.ControlledBounceProxyInformation)17 Test (org.junit.Test)16 LinkedList (java.util.LinkedList)6 BounceProxyInformation (io.joynr.messaging.info.BounceProxyInformation)4 BounceProxyStatusInformation (io.joynr.messaging.info.BounceProxyStatusInformation)4 Cache (net.sf.ehcache.Cache)3 Element (net.sf.ehcache.Element)3 BounceProxyEntity (io.joynr.messaging.bounceproxy.controller.directory.jdbc.entities.BounceProxyEntity)2 BounceProxyStatus (io.joynr.messaging.info.BounceProxyStatus)2 Channel (io.joynr.messaging.info.Channel)1 PerformanceMeasures (io.joynr.messaging.info.PerformanceMeasures)1 List (java.util.List)1 EntityManager (javax.persistence.EntityManager)1 EntityTransaction (javax.persistence.EntityTransaction)1