Package org.mokai

Examples of org.mokai.Processor


  public void testConflictMonitorableProcessorStatus() throws Exception {
    // add failed validation
    MockEndpoint outboundEndpoint = getProcessedMessagesEndpoint(0);
    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(1);

    Processor processor =
      Mockito.mock(Processor.class, Mockito.withSettings().extraInterfaces(Monitorable.class));
    Mockito
      .doThrow(new NullPointerException())
      .when(processor).process(Mockito.any(Message.class));
    Mockito
View Full Code Here


  @Test
  public void testProcessorException() throws Exception {
    MockEndpoint outboundEndpoint = getProcessedMessagesEndpoint(0);
    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(1);

    AbstractCamelConnectorService processorService = new MockConnectorService("test", new Processor() {

      @Override
      public void process(Message message) {
        throw new NullPointerException();
      }
View Full Code Here

  @Test
  public void testProcessorExceptionAndRecovery() throws Exception {
    MockEndpoint outboundEndpoint = getProcessedMessagesEndpoint(1);
    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(0);

    ConnectorService processorService = new MockConnectorService("test", new Processor() {

      private int times = 0;

      @Override
      public void process(Message message) {
View Full Code Here

  }

  @Test
  public void testServiceableConnector() throws Exception {
    // mock Processor and Serviceable
    Processor processor = Mockito.mock(Processor.class, Mockito.withSettings().extraInterfaces(Serviceable.class));

    ConnectorService processorService = new MockConnectorService("test", processor, resourceRegistry);
    processorService.start();

    // verify
View Full Code Here

  }

  @Test(expectedExceptions=ExecutionException.class)
  public void shouldFailOnStartException() throws Exception {
    // mock Processor and Serviceable
    Processor processor = Mockito.mock(Processor.class, Mockito.withSettings().extraInterfaces(Serviceable.class));
    Mockito.doThrow(new NullPointerException()).when((Serviceable) processor).doStart();

    ConnectorService processorService = new MockConnectorService("test", processor, resourceRegistry);
    processorService.start();
  }
View Full Code Here

  }

  @Test(expectedExceptions=ExecutionException.class)
  public void shouldFailOnStopException() throws Exception {
    // mock Processor and Serviceable
    Processor processor = Mockito.mock(Processor.class, Mockito.withSettings().extraInterfaces(Serviceable.class));
    Mockito.doThrow(new NullPointerException()).when((Serviceable) processor).doStop();

    ConnectorService processorService = new MockConnectorService("test", processor, resourceRegistry);
    processorService.start();
View Full Code Here

  @Test
  public void testInjectResourceToAcceptor() throws Exception {
    // add he resource to the resource registry
    resourceRegistry.putResource(MessageStore.class, Mockito.mock(MessageStore.class));

    Processor processor = Mockito.mock(Processor.class);
    ConnectorService processorService = new MockConnectorService("test", processor, resourceRegistry);

    MockAcceptor acceptor = new MockAcceptor();
    processorService.addAcceptor(acceptor);
View Full Code Here

  @Test
  public void testInjectResourceToActions() throws Exception {
    // add he resource to the resource registry
    resourceRegistry.putResource(MessageStore.class, Mockito.mock(MessageStore.class));

    Processor processor = Mockito.mock(Processor.class);
    ConnectorService processorService = new MockConnectorService("test", processor, resourceRegistry);

    // test inject resource to pre-processing action
    MockAction action = new MockAction();
    processorService.addPreProcessingAction(action);
View Full Code Here

    if (retry == processors.size()) {
      throw new Exception("Message could not be processed: all of the processors failed.");
    }

    try {
      Processor processor = processors.get(index);
      processor.process(message);
    } catch (Exception e) {
      log.error("Processor " + index + " threw exception, trying with the next", e);

      // try with the next processor
      incrementIndex();
View Full Code Here

  @Test
  public void testStartRoutingEngineWithSlowConnectors() throws Exception {
    CamelRoutingEngine routingEngine = new CamelRoutingEngine();

    try {
      Processor connection = new MockServiceableConnector().withStartWaitTime(5000);
      Connector application = new MockServiceableConnector().withStartWaitTime(5000);

      routingEngine.addConnection("test", connection);
      routingEngine.addApplication("test", application);
View Full Code Here

TOP

Related Classes of org.mokai.Processor

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.