Package org.mokai

Examples of org.mokai.Message


        return;
      else if (packet.getCommandId() == SmppPacket.SUBMIT_SM) {

        SubmitSm submitSm = (SubmitSm) packet;

        Message message = new Message();
        message.setProperty("to", submitSm.getDestAddress().getAddress());
        message.setProperty("from", submitSm.getSourceAddress().getAddress());
        message.setProperty("text", submitSm.getShortMessage());
        message.setProperty("receiptDestination", context.getId());

        messageProducer.produce(message);

        try {
          responseSender.send( Response.OK.withMessageId(nextMessageId() + "") );
View Full Code Here


          }
        } else {
          log.debug(getLogHead() + "DeliverSM has no TLVTable!");
        }

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

        messageProducer.produce(message);
      } else {
        log.warn(getLogHead() + "received DeliverSM discardIncomingMessages is set ... ignoring message: " + deliverSm.toString());
      }
View Full Code Here

      String finalStatus = getDeliveryReceiptValue("stat", shortMessage);
      //String error = getDeliveryReceiptValue("err", shortMessage);

      // create the message
      Message message = new Message();

      message.setProperty("isDLR", true);

      String to = deliverSm.getDestination().getAddress();
      String from = deliverSm.getSource().getAddress();

      message.setProperty("to", to);
      message.setProperty("from", from);

      // set the id
      message.setProperty("messageId", id);

      // set the number of submitted and submit date
      message.setProperty("submitted", submitted);
      message.setProperty("submitDate", submitDate);

      // set the number of delivered
      message.setProperty("delivered", delivered);

      // set done date
      message.setProperty("doneDate", doneDate);

      // set final status
      message.setProperty("finalStatus", finalStatus);

      DeliveryReceipt deliveryReceipt = new DeliveryReceipt();
      deliveryReceipt.message = message;
      deliveryReceipt.deliverSm = deliverSm;
View Full Code Here

public class EmailToSmsActionTest {

  @Test
  public void shouldChangeMessageWithSmsTo() throws Exception {
    Message message = new Message()
      .setProperty("to", "german.escobarc@gmail.com")
      .setProperty("from", "test@localhost.com")
      .setProperty("subject", "574003222222")
      .setProperty("text", "This is a test");

    EmailToSmsAction action = new EmailToSmsAction();
    action.setSmsTo("573001222222");

    action.execute(message);

    Assert.assertEquals(message.getProperty("to", String.class), "573001222222");
    Assert.assertEquals(message.getProperty("emailTo", String.class), "german.escobarc@gmail.com");
    Assert.assertEquals(message.getProperty("from", String.class), "12345");
    Assert.assertEquals(message.getProperty("emailFrom", String.class), "test@localhost.com");
    Assert.assertEquals(message.getProperty("text", String.class), "574003222222 - This is a test");
  }
View Full Code Here

    Assert.assertEquals(message.getProperty("text", String.class), "574003222222 - This is a test");
  }

  @Test
  public void shouldChangeMessageWithUseSubjectAsTo() throws Exception {
    Message message = new Message()
      .setProperty("to", "german.escobarc@gmail.com")
      .setProperty("from", "test@localhost.com")
      .setProperty("subject", "574003222222")
      .setProperty("text", "This is a test");

    EmailToSmsAction action = new EmailToSmsAction();
    action.setUseSubjectAsTo(true);
    action.setSmsFrom("54321");

    action.execute(message);

    Assert.assertEquals(message.getProperty("to", String.class), "574003222222");
    Assert.assertEquals(message.getProperty("emailTo", String.class), "german.escobarc@gmail.com");
    Assert.assertEquals(message.getProperty("from", String.class), "54321");
    Assert.assertEquals(message.getProperty("emailFrom", String.class), "test@localhost.com");
    Assert.assertEquals(message.getProperty("text", String.class), "This is a test");
  }
View Full Code Here

    Assert.assertEquals(message.getProperty("text", String.class), "This is a test");
  }

  @Test
  public void shouldCutLongMessages() throws Exception {
    Message message = new Message()
      .setProperty("to", "german.escobarc@gmail.com")
      .setProperty("from", "test@localhost.com")
      .setProperty("subject", "574003222222")
      .setProperty("text", getText(201));

    EmailToSmsAction action = new EmailToSmsAction();
    action.setUseSubjectAsTo(true);
    action.setMaxTextLength(200);

    action.execute(message);

    Assert.assertEquals(message.getProperty("text", String.class).length(), 200);
  }
View Full Code Here

    Assert.assertEquals(message.getProperty("text", String.class).length(), 200);
  }

  @Test
  public void shouldNotCutIfTextLengthLessThanMaxTextLength() throws Exception {
    Message message = new Message()
      .setProperty("to", "german.escobarc@gmail.com")
      .setProperty("from", "test@localhost.com")
      .setProperty("subject", "574003222222")
      .setProperty("text", getText(199));

    EmailToSmsAction action = new EmailToSmsAction();
    action.setUseSubjectAsTo(true);
    action.setMaxTextLength(200);

    action.execute(message);

    Assert.assertEquals(message.getProperty("text", String.class).length(), 199);
  }
View Full Code Here

    testServer.register("/", mockHandler);

    HttpConfiguration configuration = new HttpConfiguration();

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

  }
View Full Code Here

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

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

    configuration.setBasicAuth(true);
    configuration.setUsername("german");
    configuration.setPassword("password");

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

    Header header = mockHandler.getHeader("Authorization");
    Assert.assertNotNull(header);
    Assert.assertNotNull(header.getValue());
    Assert.assertEquals(header.getValue(), "Basic Z2VybWFuOnBhc3N3b3Jk");
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.