Package org.mokai

Examples of org.mokai.Message


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

      receiver.doStop();

      Message message = messageProducer.getMessage(0);
      Assert.assertNotNull(message);
      Assert.assertEquals(message.getProperty("recipients", String.class), "test@localhost.com");
      Assert.assertEquals(message.getProperty("to", String.class), "test@localhost.com");
      Assert.assertEquals(message.getProperty("cc", String.class), "");
      Assert.assertEquals(message.getProperty("bcc", String.class), "");
      Assert.assertEquals(message.getProperty("from", String.class), "from@localhost.com");
      Assert.assertEquals(message.getProperty("subject", String.class), subject);
      Assert.assertEquals(message.getProperty("text", String.class), body);

      // check that email is still there
      Assert.assertEquals(greenMail.getReceivedMessages().length, 1);

    } finally {
View Full Code Here


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

      receiver.doStop();

      Message message = messageProducer.getMessage(0);
      Assert.assertNotNull(message);
      Assert.assertEquals(message.getProperty("text", String.class), body);
    } finally {
      greenMail.stop();
    }
  }
View Full Code Here

   * @param exchange
   * @return an Apache Camel endpoint URI.
   */
  @RecipientList
  public final String route(Exchange exchange) {
    Message message = exchange.getIn().getBody(Message.class);

    long startTime = new Date().getTime();
    String route =  route(message);
    long endTime = new Date().getTime();

View Full Code Here

      messageConverter = new RabbitMqMessageConverter();
    }

    @Override
    public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
      Message message = messageConverter.fromByteArray(properties, body);
      log.debug("received message: {}", message.getProperty("body"));
      messageProducer.produce(message);
      long deliveryTag = envelope.getDeliveryTag();
      channel.basicAck(deliveryTag, false);
      log.debug("message acknowledge {}", deliveryTag);
    }
View Full Code Here

  @Test
  public void shouldSupportValidEmails() throws Exception {
    MailProcessor processor = new MailProcessor();

    Assert.assertTrue(processor.supports(new Message().setProperty("to", "info@example.com")));
    Assert.assertTrue(processor.supports(new Message().setProperty("to", "info@49.98.23.3")));
    Assert.assertTrue(processor.supports(new Message().setProperty("to", "info@localhost")));
    Assert.assertTrue(processor.supports(new Message().setProperty("to", "german.escobar@exampletest.com.co")));
    Assert.assertTrue(processor.supports(new Message().setProperty("to", "german_escobar@example-test.com")));
  }
View Full Code Here

  @Test
  public void shouldNotSupportInvalidEmails() throws Exception {
    MailProcessor processor = new MailProcessor();

    Assert.assertFalse(processor.supports(new Message().setProperty("to", "invalid")));
    Assert.assertFalse(processor.supports(new Message().setProperty("to", "@invalid.com")));
  }
View Full Code Here

    MailProcessorConfig configuration = new MailProcessorConfig();
    configuration.setPort(2000);
    configuration.setAuth(false);
    MailProcessor processor = new MailProcessor(configuration);

    Message message = new Message();
    message.setProperty("to", "german.escobarc@gmail.com");
    message.setProperty("text", "This is a test");

    processor.process(message);

    Assert.assertTrue(server.getReceivedEmailSize() == 1);
View Full Code Here

    MailProcessorConfig configuration = new MailProcessorConfig();
    configuration.setPort(2000);
    configuration.setAuth(false);
    MailProcessor processor = new MailProcessor(configuration);

    Message message = new Message();
    message.setProperty("to", "german.escobarc@gmail.com");
    message.setProperty("from", "test@localhost");
    message.setProperty("subject", "This is the subject");
    message.setProperty("text", "This is a test");

    processor.process(message);

    Assert.assertTrue(server.getReceivedEmailSize() == 1);
View Full Code Here

    SubmitSMResp response = (SubmitSMResp) connection.sendRequest(submitSM);
    Assert.assertNotNull(response);
    Assert.assertTrue(response.getMessageId() != null);

    Assert.assertEquals(messageProducer.messageCount(), 1);
    Message message = messageProducer.getMessage(0);
    Assert.assertNotNull(message);
    Assert.assertEquals(message.getProperty("to", String.class), "573001111111");
    Assert.assertEquals(message.getProperty("from", String.class), "3542");
    Assert.assertEquals(message.getProperty("text", String.class), "This is a test");

    connection.unbind();
    connection.closeLink();

    connector.doStop();
View Full Code Here

    // send deliver_sm
    new Thread(new Runnable() {

      @Override
      public void run() {
        Message message = new Message();
        message.setProperty("to", "1111");
        message.setProperty("from", "2222");
        message.setProperty("text", "This is a test");

        try {
          connector.process(message);
        } catch (Exception e) {
          e.printStackTrace();
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.