Examples of InputPort


Examples of javaflow.components.api.InputPort

    }

    @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);
        Assert.assertEquals(outs.next(), port1);
        Assert.assertEquals(outs.next(), port1);
    }
View Full Code Here

Examples of net.kuujo.vertigo.io.port.InputPort

  @Override
  public InputPort port(String name) {
    // Attempt to search for the port in the existing context. If the
    // port isn't an explicitly configured port then lazily create
    // and open the port. The lazy port will be empty.
    InputPort port = ports.get(name);
    if (port == null) {
      log.debug(String.format("%s - Lazily creating in port: %s", this, name));

      // Attempt to search for the port in the existing context. If the
      // port isn't an explicitly configured port then lazily create
      // and open the port. The lazy port will be empty.
      InputPortContext portContext = context.port(name);
      if (portContext == null) {
        portContext = DefaultInputPortContext.Builder.newBuilder()
            .setAddress(UUID.randomUUID().toString())
            .setName(name)
            .build();
        DefaultInputContext.Builder.newBuilder((DefaultInputContext) context).addPort(portContext);
      }
      port = new DefaultInputPort(vertx, context.port(name));
      if (started) {
        port.open();
      }
      ports.put(name, port);
    }
    return port;
  }
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.