本文整理汇总了Java中org.apache.camel.component.smpp.SmppConstants类的典型用法代码示例。如果您正苦于以下问题:Java SmppConstants类的具体用法?Java SmppConstants怎么用?Java SmppConstants使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SmppConstants类属于org.apache.camel.component.smpp包,在下文中一共展示了SmppConstants类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendSubmitSMInOut
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例2: sendSubmitSMInOnly
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例3: sendLongSubmitSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例4: sendSms
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
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);
}
}
示例5: execute
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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);
}
}
示例6: process
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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);
}
}
示例7: handleDeliverSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
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);
}
示例8: sendCancelSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例9: sendQuerySM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例10: sendReplaceSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例11: sendDataSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例12: sendSubmitMultiSM
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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));
}
示例13: executeLongBody
import org.apache.camel.component.smpp.SmppConstants; //导入依赖的package包/类
@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);
}
}