Package org.mokai

Examples of org.mokai.Message


      return true;
    }

    @SuppressWarnings("rawtypes")
    private void produceMessage(HttpServletRequest request, boolean decodeParams) throws IOException {
      Message message = new Message();

      Enumeration paramNames = request.getParameterNames();
      while (paramNames.hasMoreElements()) {
        String paramName = (String) paramNames.nextElement();

        // check if there is a mapping for the key
        String key = paramName;
        if (configuration.getMapper().containsKey(key)) {
          key = configuration.getMapper().get(key);
        }

        String value = request.getParameter(paramName);
        if (decodeParams) {
          value = decodeParam(value, request.getCharacterEncoding());
        }

        message.setProperty(key, value);
      }

      messageProducer.produce(message);
    }
View Full Code Here


      Assert.assertEquals(responseCode, 200);

      Assert.assertEquals(1, messageProducer.messageCount());

      Message message = messageProducer.getMessage(0);
      Assert.assertNotNull(message.getReference());
      Assert.assertEquals(message.getProperty("to", String.class), to);
      Assert.assertEquals(message.getProperty("from", String.class), from);
      Assert.assertEquals(message.getProperty("text", String.class), originalText);
      Assert.assertEquals(message.getProperty("account", String.class), account);
      Assert.assertEquals(message.getProperty("password", String.class), password);

    } finally {
      connector.doStop();
      connector.destroy();
    }
View Full Code Here

      Assert.assertEquals(responseCode, 200);

      Assert.assertEquals(1, messageProducer.messageCount());

      Message message = messageProducer.getMessage(0);
      Assert.assertNotNull(message.getReference());
      Assert.assertEquals(message.getProperty("to", String.class), to);
      Assert.assertEquals(message.getProperty("from", String.class), from);
      Assert.assertEquals(message.getProperty("text", String.class), originalText);
      Assert.assertEquals(message.getProperty("account", String.class), account);
      Assert.assertEquals(message.getProperty("password", String.class), password);

    } finally {
      connector.doStop();
      connector.destroy();
    }
View Full Code Here

      Assert.assertEquals(responseCode, 200);

      Assert.assertEquals(1, messageProducer.messageCount());

      Message message = messageProducer.getMessage(0);
      Assert.assertNotNull(message);

    } finally {
      connector.doStop();
      connector.destroy();
View Full Code Here

          + to + "&from=" + from + "&text=" + text);
      client.executeMethod(getMethod);

      Assert.assertEquals(1, messageProducer.messageCount());

      Message message = (Message) messageProducer.getMessage(0);
      Assert.assertEquals(to, message.getProperty("to1", String.class));
      Assert.assertEquals(from, message.getProperty("from1", String.class));
      Assert.assertEquals(text, message.getProperty("text1", String.class));

    } finally {
      connector.doStop();
      connector.destroy();
    }
View Full Code Here

    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");

    Message message = new Message();
    message.setProperty("to", "3002175604");
    message.setProperty("from", "3542");
    message.setProperty("text", "test · script @áÁ");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(message);

    Assert.assertEquals(mockHandler.getReceivedMethod(), "GET");
    mockHandler.validateExpectedProperties("to=3002175604&from=3542&text=test · script @áÁ");
    Assert.assertTrue(message.getProperty("responseCode", Integer.class) == HttpStatus.SC_OK);
  }
View Full Code Here

    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/?to=3002175604");

    Message message = new Message();
    message.setProperty("from", "3542");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(message);

    mockHandler.validateExpectedProperties("to=3002175604&from=3542");
View Full Code Here

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("htp://invalidscheme/");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(new Message());
  }
View Full Code Here

    HttpConfiguration configuration = new HttpConfiguration();
    configuration.setUrl("http://" + getHost() + ":" + getPort() + "/");
    configuration.setMethod("POST");

    Message message = new Message();
    message.setProperty("to", "3002175604");
    message.setProperty("from", "3542");
    message.setProperty("text", "test · script @áÁ");

    HttpConnector connector = new HttpConnector(configuration);
    connector.process(message);

    Assert.assertEquals(mockHandler.getReceivedMethod(), "POST");
    mockHandler.validateExpectedProperties("to=3002175604&from=3542&text=test · script @áÁ");
    Assert.assertTrue(message.getProperty("responseCode", Integer.class) == HttpStatus.SC_OK);
  }
View Full Code Here

    this.endpoint = endpoint;
  }

  @Override
  public final void process(Exchange exchange) throws Exception {
    Message message = exchange.getIn().getBody(Message.class);
    ProducerTemplate producerTemplate = exchange.getContext().createProducerTemplate();

    // execute the actions recursively starting from the first one (index 0)
    ActionsExecutor executor = new ActionsExecutor(producerTemplate, 0);
    executor.route(message);
View Full Code Here

TOP

Related Classes of org.mokai.Message

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.