Package org.mokai

Examples of org.mokai.ConnectorService


      routingEngine.start();

      Connector connector = mock(Connector.class);

      // create and start an application
      ConnectorService connectorService = routingEngine.addApplication("test", connector);
      connectorService.start();

      // try to retrieve an existing application
      ConnectorService csTest = routingEngine.getApplication("test");
      Assert.assertEquals(connectorService, csTest);

      // try to retrieve an unexisting application
      csTest = routingEngine.getApplication("notexistent");
      Assert.assertNull(csTest);
View Full Code Here


    CamelRoutingEngine routingEngine = new CamelRoutingEngine();

    try {
      Connector connector = mock(Connector.class);

      ConnectorService cs1 = routingEngine.addApplication("test1", connector).withPriority(2000);
      ConnectorService cs2 = routingEngine.addApplication("test2", connector).withPriority(1000);
      ConnectorService cs3 = routingEngine.addApplication("test3", connector).withPriority(1500);

      List<ConnectorService> connectorServices = routingEngine.getApplications();

      Assert.assertNotNull(connectorServices);
      Assert.assertEquals(3, connectorServices.size());
View Full Code Here

  public void shouldFailToModifyReturnedApplications() throws Exception {
    CamelRoutingEngine routingEngine = new CamelRoutingEngine();

    try {
      Connector connector = mock(Connector.class);
      ConnectorService cs1 = routingEngine.addApplication("test", connector);

      Collection<ConnectorService> connectorServices = routingEngine.getApplications();
      Assert.assertEquals(connectorServices.size(), 1);

      // add another application to the returned collection
View Full Code Here

      routingEngine.setMessageStore(messageStore);
      routingEngine.start();

      // create the connection
      MockProcessor processor = new MockProcessor();
      ConnectorService connection = routingEngine.addConnection("1", processor);
      connection.addAcceptor(new MockAcceptor());
      connection.start();

      // create the application
      MockConnector receiver = new MockConnector();
      ConnectorService application = routingEngine.addApplication("1", receiver);
      application.start();

      // send the message
      receiver.produceMessage(new Message());

      // wait
View Full Code Here

      routingEngine.setMessageStore(messageStore);
      routingEngine.start();

      // create the application
      MockProcessor processor = new MockProcessor();
      ConnectorService application = routingEngine.addApplication("1", processor);
      application.addAcceptor(new MockAcceptor());
      application.start();

      // create the connection
      MockConnector receiver = new MockConnector();
      ConnectorService connection = routingEngine.addConnection("1", receiver);
      connection.start();

      // send the message
      receiver.produceMessage(new Message());

      // wait
View Full Code Here

      routingEngine.setMessageStore(messageStore);
      routingEngine.start();

      // create the processor
      MockProcessor processor = new MockProcessor();
      ConnectorService processorService = routingEngine.addConnection("1", processor);
      processorService.addAcceptor(new Acceptor() {

        @Override
        public boolean accepts(Message message) {
          return false;
        }

      });
      processorService.start();

      // send the message
      ProducerTemplate producer = routingEngine.getCamelContext().createProducerTemplate();
      producer.sendBody(UriConstants.CONNECTIONS_ROUTER, new Message());
View Full Code Here

      routingEngine.setMessageStore(messageStore);
      routingEngine.start();

      // create the processor
      MockProcessor processor = new MockProcessor();
      ConnectorService processorService = routingEngine.addConnection("1", processor);
      processorService.addAcceptor(new Acceptor() {

        @Override
        public boolean accepts(Message message) {
          return false;
        }

      });
      processorService.start();

      // send the message
      ProducerTemplate producer = routingEngine.getCamelContext().createProducerTemplate();
      producer.sendBody(UriConstants.APPLICATIONS_ROUTER, new Message());
View Full Code Here

      Processor applicationProcessor = mock(Processor.class);

      when(connectionProcessor.supports(any(Message.class))).thenReturn(true);
      when(applicationProcessor.supports(any(Message.class))).thenReturn(true);

      ConnectorService connectionService = routingEngine.addConnection("1", connectionProcessor);
      ConnectorService applicationService = routingEngine.addApplication("1", applicationProcessor);

      Acceptor acceptor = new Acceptor() {

        @Override
        public boolean accepts(Message message) {
          return true;
        }

      };

      connectionService.addAcceptor(acceptor);
      connectionService.start();

      applicationService.addAcceptor(acceptor);
      applicationService.start();

      // retry failed messages
      routingEngine.retryFailedMessages();

      // verify
View Full Code Here

TOP

Related Classes of org.mokai.ConnectorService

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.