Search in sources :

Example 6 with ObjectTargetMsg

use of abs.backend.java.lib.net.msg.ObjectTargetMsg in project abstools by abstools.

the class NodeImplTest method processObjectTargetMsgNotOnNode.

@Test
public void processObjectTargetMsgNotOnNode() {
    ObjectTargetMsg msg = createMock(ObjectTargetMsg.class);
    expect(msg.getTarget()).andReturn(object);
    expect(currentRouter.getNextNode(msg)).andReturn(otherNode);
    expect(arc.getQueue()).andReturn(queue);
    queue.enqueue(msg);
    expectLastCall();
    replay(msg);
    replay(currentRouter);
    replay(arc);
    replay(queue);
    currentNode.processMsg(msg);
    verify(msg);
    verify(currentRouter);
    verify(arc);
    verify(queue);
}
Also used : ObjectTargetMsg(abs.backend.java.lib.net.msg.ObjectTargetMsg) Test(org.junit.Test)

Example 7 with ObjectTargetMsg

use of abs.backend.java.lib.net.msg.ObjectTargetMsg in project abstools by abstools.

the class DefaultRouter method getNextNode.

@Override
public NetNode getNextNode(Msg m) {
    if (m instanceof ObjectTargetMsg) {
        ObjectTargetMsg om = (ObjectTargetMsg) m;
        ABSObject target = om.getTarget();
        if (routeForObject.containsKey(target)) {
            return routeForObject.get(target).getNextNode();
        } else {
            return node.defaultRoute();
        }
    } else if (m instanceof ObjectMsg) {
        ObjectMsg om = (ObjectMsg) m;
        NetCOG target = om.getCOG();
        if (routeForCOG.containsKey(target)) {
            return routeForCOG.get(target).getNextNode();
        } else {
            return node.defaultRoute();
        }
    } else {
        return node.defaultRoute();
    }
}
Also used : ObjectTargetMsg(abs.backend.java.lib.net.msg.ObjectTargetMsg) ABSObject(abs.backend.java.lib.runtime.ABSObject) ObjectMsg(abs.backend.java.lib.net.msg.ObjectMsg)

Aggregations

ObjectTargetMsg (abs.backend.java.lib.net.msg.ObjectTargetMsg)7 Test (org.junit.Test)5 ObjectMsg (abs.backend.java.lib.net.msg.ObjectMsg)2 ABSObject (abs.backend.java.lib.runtime.ABSObject)2 COGMsg (abs.backend.java.lib.net.msg.COGMsg)1