Package org.mokai

Examples of org.mokai.Connector


public class ApplicationsTest extends AbstractTest {

  @Test
  public void shouldListApplications() throws Exception {
    Connector connector = mock(Connector.class);

    ConnectorService cs = mock(ConnectorService.class);
    when( cs.getId() ).thenReturn("test-application");
    when( cs.getConnector() ).thenReturn( connector );
    when( cs.getState() ).thenReturn( State.STARTED );
View Full Code Here


public class ConnectionsTest extends AbstractTest {

  @Test
  public void shouldListConnections() throws Exception {
    Connector connector = mock(Connector.class);

    ConnectorService cs = mock(ConnectorService.class);
    when( cs.getId() ).thenReturn("test-connection");
    when( cs.getConnector() ).thenReturn( connector );
    when( cs.getState() ).thenReturn( State.STARTED );
View Full Code Here

    Assert.assertEquals( response.getStatus(), Response.UNAUTHORIZED );
  }

  @Test
  public void shouldStopConnection() throws Exception {
    Connector connector = mock(Connector.class);

    ConnectorService cs = mock(ConnectorService.class);
    when( cs.getId() ).thenReturn("test-connection");
    when( cs.getConnector() ).thenReturn( connector );
    when( cs.getState() ).thenReturn( State.STARTED );
View Full Code Here

    Assert.assertEquals(endpointUri, "unroutable");
  }

  @Test
  public void shouldReturnUnroutableUriIfNoProcessors() throws Exception {
    Connector c1 = mock(Connector.class);
    Acceptor a1 = buildAcceptor(true);
    ConnectorService connectorService = buildConnectorService("test1", c1, a1);

    TestRouter router = new TestRouter(Collections.singletonList(connectorService));
View Full Code Here

    return getConnectors(connections);
  }

  private void registerConnector(AbstractCamelConnectorService connectorService, String namespace) {
    String objectName = namespace + ":id=" + connectorService.getId();
    Connector connector = connectorService.getConnector();

    try {
      Management.register( new ConnectorServiceMBean(connectorService), objectName);
    } catch (Exception e) {
      log.warn("Couldn't register JMX MBean '" + objectName + "': " + e.getMessage(), e);
View Full Code Here

    }
  }

  private void handleConnectorElement(final Element connectorElement) throws Exception {
    // build the processor connector
    final Connector connector = buildConnector(connectorElement, true);

    // build the acceptors
    final List<Acceptor> acceptors = buildAcceptors(connectorElement.element("acceptors"));

    // build the pre-processing actions
View Full Code Here

    if (connectorClass == null) {
      connectorClass = (Class<? extends Processor>) Class.forName(className);
    }

    Connector connector = connectorClass.newInstance();

    if (ExposableConfiguration.class.isInstance(connector)) {
      ExposableConfiguration<?> configurableConnector = (ExposableConfiguration<?>) connector;

      if (hasConfigElement) {
View Full Code Here

    Assert.assertNotNull(connector.getConnector());
    Assert.assertEquals(connector.getListConnectors().size(), 1);
    Assert.assertEquals(connector.getMapConnectors().size(), 1);

    Connector innerConnector = connector.getMapConnectors().get("test-1");
    Assert.assertNotNull(innerConnector);
    Assert.assertEquals(innerConnector.getClass(), MockConfigurableConnector.class);

    Assert.assertEquals(((MockConfigurableConnector) innerConnector).getConfig1(), "config1");
    Assert.assertEquals(((MockConfigurableConnector) innerConnector).getConfig2(), 2);
  }
View Full Code Here

    Assert.assertEquals("test", message.getDestination());
  }

  @Test
  public void testConnectorServiceState() throws Exception {
    Connector connector = Mockito.mock(Connector.class);
    ConnectorService processorService = new MockConnectorService("test", connector, resourceRegistry);
    Assert.assertEquals(State.STOPPED, processorService.getState());

    processorService.start();
    Assert.assertEquals(State.STARTED, processorService.getState());
View Full Code Here

    CamelRoutingEngine routingEngine = new CamelRoutingEngine();

    try {
      routingEngine.start();

      Connector connector = mock(Connector.class);

      // create a connector service
      ConnectorService cs1 = routingEngine.addConnection("test1", connector).withPriority(2000);
      cs1.start();
View Full Code Here

TOP

Related Classes of org.mokai.Connector

Copyright © 2018 www.massapicom. 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.