Package org.mokai

Examples of org.mokai.Action


        return;
      }

      // retrieve the action
      Action action = actions.get(index);

      // inject the Execution interface implementation (ie. an instance of this class)
      ActionsExecutor executor = new ActionsExecutor(producerTemplate, index + 1);
      ResourceInjector.inject(action, executor);

      // execute the message, notice that the execution could be stopped or new messages routed
      action.execute(message);

      // if the action stopped the execution ...
      if (executor.isStopped()) {
        return;
      }
View Full Code Here


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

      Action action = actionClass.newInstance();

      if (ExposableConfiguration.class.isInstance(action)) {
        ExposableConfiguration<?> exposableAction = (ExposableConfiguration<?>) action;

        setConfigurationFields(actionElement, exposableAction.getConfiguration());
View Full Code Here

  @Test
  public void testAddRemoveConfigurablePreProcessingAction() throws Exception {
    ConnectorService processorService = new MockConnectorService("test", Mockito.mock(Processor.class), resourceRegistry);

    Action configurableAction = Mockito.mock(Action.class,
        Mockito.withSettings().extraInterfaces(Configurable.class));

    processorService.addPreProcessingAction(configurableAction);
    processorService.removePreProcessingAction(configurableAction);
View Full Code Here

  @Test
  public void testAddRemoveConfigurablePostProcessingAction() throws Exception {
    ConnectorService processorService = new MockConnectorService("test", Mockito.mock(Processor.class), resourceRegistry);

    Action configurableAction = Mockito.mock(Action.class,
        Mockito.withSettings().extraInterfaces(Configurable.class));

    processorService.addPostProcessingAction(configurableAction);
    processorService.removePostProcessingAction(configurableAction);
View Full Code Here

  @Test
  public void testAddRemoveConfigurablePostReceivingAction() throws Exception {
    ConnectorService processorService = new MockConnectorService("test", Mockito.mock(Processor.class), resourceRegistry);

    Action configurableAction = Mockito.mock(Action.class,
        Mockito.withSettings().extraInterfaces(Configurable.class));

    processorService.addPostReceivingAction(configurableAction);
    processorService.removePostReceivingAction(configurableAction);
View Full Code Here

    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(0);

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

    Action action = new StopAction();
    processorService.addPreProcessingAction(action);

    processorService.start();

    simulateMessage(new Message(), "activemq:mokai-test");
View Full Code Here

    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(0);

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

    Action action1 = Mockito.mock(Action.class);
    Action action2 = new SplitterAction(5, true);
    Action action3 = Mockito.mock(Action.class);
    // duplicates the messages that arrive and generates 5 more as it wont stop the ones that arrived
    Action action4 = new SplitterAction(2, false);
    Action action5 = Mockito.mock(Action.class);

    processorService
      .addPreProcessingAction(action1)
      .addPreProcessingAction(action2)
      .addPreProcessingAction(action3)
View Full Code Here

    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(1);

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

    Action action = Mockito.mock(Action.class);
    Mockito.doThrow(new NullPointerException()).when(action).execute(Mockito.any(Message.class));

    processorService.addPreProcessingAction(action);

    processorService.start();
View Full Code Here

    MockEndpoint failedEndpoint = getFailedMessagesEndpoint(1);

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

    Action action = Mockito.mock(Action.class);
    Mockito.doThrow(new NullPointerException()).when(action).execute(Mockito.any(Message.class));

    processorService.addPostProcessingAction(action);

    processorService.start();
View Full Code Here

    // add a pre-processing action
    MockAction preProcessingAction = new MockAction();
    processorService.addPreProcessingAction(preProcessingAction);

    // add another pre-processing action that changes the message
    processorService.addPreProcessingAction(new Action() {

      @Override
      public void execute(Message message) throws Exception {
        Message smsMessage = (Message) message;
        smsMessage.setProperty("from", "1234");
      }

    });

    // add a post-processing action
    MockAction postProcessingAction = new MockAction();
    processorService.addPostProcessingAction(postProcessingAction);

    // add another post-processing action that changes the message
    processorService.addPostProcessingAction(new Action() {

      @Override
      public void execute(Message message) throws Exception {
        Message smsMessage = (Message) message;
        smsMessage.setProperty("to", "1111");
View Full Code Here

TOP

Related Classes of org.mokai.Action

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.