Java 类org.apache.camel.component.smpp.SmppConstants 实例源码

项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendSubmitSMInOut() throws Exception {
    result.expectedMessageCount(1);

    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setBody("Hello SMPP World!");

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    Exchange resultExchange = result.getExchanges().get(0);
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), resultExchange.getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals("Hello SMPP World!", resultExchange.getIn().getBody());
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.SUBMITTED));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.DELIVERED));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.DONE_DATE));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.SUBMIT_DATE));
    assertNull(resultExchange.getIn().getHeader(SmppConstants.ERROR));

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendSubmitSMInOnly() throws Exception {
    result.expectedMessageCount(1);

    Exchange exchange = start.createExchange(ExchangePattern.InOnly);
    exchange.getIn().setBody("Hello SMPP World!");

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    Exchange resultExchange = result.getExchanges().get(0);
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), resultExchange.getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals("Hello SMPP World!", resultExchange.getIn().getBody());
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.SUBMITTED));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.DELIVERED));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.DONE_DATE));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.SUBMIT_DATE));
    assertNull(resultExchange.getIn().getHeader(SmppConstants.ERROR));

    assertNotNull(exchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getIn().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendLongSubmitSM() throws Exception {
    result.expectedMessageCount(2);

    Exchange exchange = start.createExchange(ExchangePattern.InOnly);
    exchange.getIn().setBody("Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "); // 270 chars

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), result.getExchanges().get(0).getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), result.getExchanges().get(1).getIn().getHeader(SmppConstants.MESSAGE_TYPE));

    assertNotNull(exchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(2, exchange.getIn().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendSubmitSMInOut() throws Exception {
    result.expectedMessageCount(1);

    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setBody("Hello SMPP World!");

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    Exchange resultExchange = result.getExchanges().get(0);
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), resultExchange.getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals("Hello SMPP World!", resultExchange.getIn().getBody());
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.SUBMITTED));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.DELIVERED));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.DONE_DATE));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.SUBMIT_DATE));
    assertNull(resultExchange.getIn().getHeader(SmppConstants.ERROR));

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendSubmitSMInOnly() throws Exception {
    result.expectedMessageCount(1);

    Exchange exchange = start.createExchange(ExchangePattern.InOnly);
    exchange.getIn().setBody("Hello SMPP World!");

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    Exchange resultExchange = result.getExchanges().get(0);
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), resultExchange.getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals("Hello SMPP World!", resultExchange.getIn().getBody());
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.SUBMITTED));
    assertEquals(1, resultExchange.getIn().getHeader(SmppConstants.DELIVERED));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.DONE_DATE));
    assertNotNull(resultExchange.getIn().getHeader(SmppConstants.SUBMIT_DATE));
    assertNull(resultExchange.getIn().getHeader(SmppConstants.ERROR));

    assertNotNull(exchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(1, exchange.getIn().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendLongSubmitSM() throws Exception {
    result.expectedMessageCount(2);

    Exchange exchange = start.createExchange(ExchangePattern.InOnly);
    exchange.getIn().setBody("Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "); // 270 chars

    template.send(start, exchange);

    assertMockEndpointsSatisfied();
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), result.getExchanges().get(0).getIn().getHeader(SmppConstants.MESSAGE_TYPE));
    assertEquals(SmppMessageType.DeliveryReceipt.toString(), result.getExchanges().get(1).getIn().getHeader(SmppConstants.MESSAGE_TYPE));

    assertNotNull(exchange.getIn().getHeader(SmppConstants.ID));
    assertEquals(2, exchange.getIn().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:OLE-INST    文件:OleSms.java   
public void sendSms(String from, String to, String message) {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_NPI, NumberingPlanIndicator.ISDN.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR, from);
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.ISDN.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR, to);
    exchange.getIn().setHeader(SmppConstants.SCHEDULE_DELIVERY_TIME, new Date(1111111));
    exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, new Date(2222222));
    exchange.getIn().setHeader(SmppConstants.PROTOCOL_ID, (byte) 1);
    exchange.getIn().setHeader(SmppConstants.PRIORITY_FLAG, (byte) 2);
    exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS).value());
    exchange.getIn().setHeader(SmppConstants.REPLACE_IF_PRESENT_FLAG, ReplaceIfPresentFlag.REPLACE.value());
    exchange.getIn().setBody(message);

    try {
        command.execute(exchange);
    } catch (Exception e) {
        LOG.error("Exception while sending sms", e);
    }
}
项目:OLE-INST    文件:OleSMS_UT.java   
@Test
public void execute() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR_NPI, NumberingPlanIndicator.ISDN.value());
    exchange.getIn().setHeader(SmppConstants.SOURCE_ADDR, "1111111111");
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_TON, TypeOfNumber.INTERNATIONAL.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR_NPI, NumberingPlanIndicator.ISDN.value());
    exchange.getIn().setHeader(SmppConstants.DEST_ADDR, "2222222222");
    exchange.getIn().setHeader(SmppConstants.SCHEDULE_DELIVERY_TIME, new Date(1111111));
    exchange.getIn().setHeader(SmppConstants.VALIDITY_PERIOD, new Date(2222222));
    exchange.getIn().setHeader(SmppConstants.PROTOCOL_ID, (byte) 1);
    exchange.getIn().setHeader(SmppConstants.PRIORITY_FLAG, (byte) 2);
    exchange.getIn().setHeader(SmppConstants.REGISTERED_DELIVERY, new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS).value());
    exchange.getIn().setHeader(SmppConstants.REPLACE_IF_PRESENT_FLAG, ReplaceIfPresentFlag.REPLACE.value());
    exchange.getIn().setBody("short message body");

    try{
        command.execute(exchange);
    }catch(Exception e){
        assertTrue(false);
    }

}
项目:smsrouter    文件:SmppAddressing.java   
@Override
public void process(Exchange exchange) throws Exception {
    Message message = exchange.getIn();

    String messageType = message.getHeader(SmppConstants.MESSAGE_TYPE, String.class);
    if (messageType != null) {
        if(messageType.equals(SmppMessageType.DeliverSm.toString())) {
            handleDeliverSM(exchange);
        }
    } else {
        handleOutgoingMessage(exchange);
    }
}
项目:smsrouter    文件:SmppAddressing.java   
private void handleDeliverSM(Exchange exchange) throws CamelExchangeException {
    handleSmscAddress(exchange,
        SmppConstants.SOURCE_ADDR, SmppConstants.SOURCE_ADDR_TON,
        originHeaderName);

    handleSmscAddress(exchange,
        SmppConstants.DEST_ADDR, SmppConstants.DEST_ADDR_TON,
        destinationHeaderName);
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendCancelSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "CancelSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendQuerySM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "QuerySm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals((byte) 0, exchange.getOut().getHeader(SmppConstants.ERROR));
    assertNotNull(exchange.getOut().getHeader(SmppConstants.FINAL_DATE));
    assertEquals("DELIVERED", exchange.getOut().getHeader(SmppConstants.MESSAGE_STATE));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendReplaceSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "ReplaceSm");
    exchange.getIn().setBody("Hello Camel World!");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendDataSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");

    template.send(start, exchange);

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentSpringIntegrationTest.java   
@Test
public void sendSubmitMultiSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
    exchange.getIn().setBody("Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "); // 270 chars

    template.send(start, exchange);

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(2, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendCancelSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "CancelSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendQuerySM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "QuerySm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals((byte) 0, exchange.getOut().getHeader(SmppConstants.ERROR));
    assertNotNull(exchange.getOut().getHeader(SmppConstants.FINAL_DATE));
    assertEquals("DELIVERED", exchange.getOut().getHeader(SmppConstants.MESSAGE_STATE));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendReplaceSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "ReplaceSm");
    exchange.getIn().setBody("Hello Camel World!");
    exchange.getIn().setHeader(SmppConstants.ID, "1");

    template.send(start, exchange);

    assertEquals("1", exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendDataSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");

    template.send(start, exchange);

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
}
项目:Camel    文件:SmppComponentIntegrationTest.java   
@Test
public void sendSubmitMultiSM() throws Exception {
    Exchange exchange = start.createExchange(ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
    exchange.getIn().setBody("Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "
            + "Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! Hello SMPP World! "); // 270 chars

    template.send(start, exchange);

    assertNotNull(exchange.getOut().getHeader(SmppConstants.ID));
    assertEquals(2, exchange.getOut().getHeader(SmppConstants.SENT_MESSAGE_COUNT));
}
项目:OLE-INST    文件:OleSMS_UT.java   
@Test
public void executeLongBody() throws Exception {

    Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
    exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitSm");
    exchange.getIn().setHeader(SmppConstants.ID, "1");
    exchange.getIn().setBody("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901");

    try{
        command.execute(exchange);
    }catch(Exception e){
        assertTrue(false);
    }

}