Examples of InputPorts


Examples of javaflow.components.api.InputPorts

public class InputPortRoundRobinIteratorTest {

    @Test
    public void iteratorRunsPortsInRoundRobinStyle() {
        InputPorts ports = mock(InputPorts.class);
        InputPort port1 = mock(InputPort.class);
        InputPort port2 = mock(InputPort.class);
        when(ports.size()).thenReturn(2);
        when(ports.port(0)).thenReturn(port1);
        when(ports.port(1)).thenReturn(port2);
        when(port1.isClosed()).thenReturn(false);
        when(port2.isClosed()).thenReturn(false);

        Iterator<InputPort> outs = new InputPortRoundRobinIterator(ports);
        Assert.assertTrue(outs.hasNext());
View Full Code Here

Examples of javaflow.components.api.InputPorts

        inOrder.verify(port2).receive();
    }

    @Test
    public void noPortsHasNextIsFalse() {
        InputPorts ports = mock(InputPorts.class);
        when(ports.size()).thenReturn(0);

        Iterator<InputPort> outs = new InputPortRoundRobinIterator(ports);
        Assert.assertFalse(outs.hasNext());
    }
View Full Code Here

Examples of javaflow.components.api.InputPorts

        Assert.assertFalse(outs.hasNext());
    }

    @Test
    public void iteratorSkipsClosedPorts() {
        InputPorts ports = mock(InputPorts.class);
        InputPort port1 = mock(InputPort.class, "port #1");
        InputPort port2 = mock(InputPort.class, "port #2");
        InputPort port3 = mock(InputPort.class, "port #3");
        when(ports.size()).thenReturn(3);
        when(ports.port(0)).thenReturn(port1);
        when(ports.port(1)).thenReturn(port2);
        when(ports.port(2)).thenReturn(port3);

        when(port1.isClosed()).thenReturn(false);
        when(port2.isClosed()).thenReturn(true);
        when(port3.isClosed()).thenReturn(false);
View Full Code Here

Examples of javaflow.components.api.InputPorts

        inOrder.verify(port3).receive();
    }

    @Test
    public void hasNoNextIfAllPortsAreClosed() {
        InputPorts ports = mock(InputPorts.class);
        InputPort port1 = mock(InputPort.class, "port #1");
        InputPort port2 = mock(InputPort.class, "port #2");
        when(ports.size()).thenReturn(2);
        when(ports.port(0)).thenReturn(port1);
        when(ports.port(1)).thenReturn(port2);

        when(port1.isClosed()).thenReturn(true);
        when(port2.isClosed()).thenReturn(true);

        Iterator<InputPort> outs = new InputPortRoundRobinIterator(ports);
View Full Code Here

Examples of javaflow.components.api.InputPorts

        Assert.assertFalse(outs.hasNext());
    }

    @Test
    public void nextWillReturnFirstPortIfAllAreClosed() {
        InputPorts ports = mock(InputPorts.class);
        InputPort port1 = mock(InputPort.class, "port #1");
        InputPort port2 = mock(InputPort.class, "port #2");
        when(ports.size()).thenReturn(2);
        when(ports.port(0)).thenReturn(port1);
        when(ports.port(1)).thenReturn(port2);

        when(port1.isClosed()).thenReturn(true);
        when(port2.isClosed()).thenReturn(true);

        Iterator<InputPort> outs = new InputPortRoundRobinIterator(ports);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.