use of org.jsmpp.bean.DeliverSm in project camel by apache.
the class SmppEndpointTest method createOnAcceptDeliverSmWithExchangePattern.
@Test
public void createOnAcceptDeliverSmWithExchangePattern() throws Exception {
DeliverSm deliverSm = createMock(DeliverSm.class);
SmppMessage message = createMock(SmppMessage.class);
expect(binding.createSmppMessage(deliverSm)).andReturn(message);
message.setExchange(isA(Exchange.class));
replay(deliverSm, binding, message);
Exchange exchange = endpoint.createOnAcceptDeliverSmExchange(ExchangePattern.InOut, deliverSm);
verify(deliverSm, binding, message);
assertSame(binding, exchange.getProperty(Exchange.BINDING));
assertSame(message, exchange.getIn());
assertSame(ExchangePattern.InOut, exchange.getPattern());
}
use of org.jsmpp.bean.DeliverSm in project camel by apache.
the class SmppEndpointTest method createOnAcceptDeliverSmExchange.
@Test
public void createOnAcceptDeliverSmExchange() throws Exception {
DeliverSm deliverSm = createMock(DeliverSm.class);
SmppMessage message = createMock(SmppMessage.class);
expect(binding.createSmppMessage(deliverSm)).andReturn(message);
message.setExchange(isA(Exchange.class));
replay(deliverSm, binding, message);
Exchange exchange = endpoint.createOnAcceptDeliverSmExchange(deliverSm);
verify(deliverSm, binding, message);
assertSame(binding, exchange.getProperty(Exchange.BINDING));
assertSame(message, exchange.getIn());
assertSame(ExchangePattern.InOnly, exchange.getPattern());
}
use of org.jsmpp.bean.DeliverSm in project camel by apache.
the class SmppMessageTest method createBodyShouldNotMangle8bitDataCodingShortMessage.
@Test
public void createBodyShouldNotMangle8bitDataCodingShortMessage() {
final Set<String> encodings = Charset.availableCharsets().keySet();
final byte[] dataCodings = { (byte) 0x02, (byte) 0x04, (byte) 0xF6, (byte) 0xF4 };
byte[] body = { (byte) 0xFF, 'A', 'B', (byte) 0x00, (byte) 0xFF, (byte) 0x7F, 'C', (byte) 0xFF };
DeliverSm command = new DeliverSm();
SmppConfiguration config = new SmppConfiguration();
for (byte dataCoding : dataCodings) {
command.setDataCoding(dataCoding);
command.setShortMessage(body);
for (String encoding : encodings) {
config.setEncoding(encoding);
message = new SmppMessage(command, config);
assertArrayEquals(String.format("data coding=0x%02X; encoding=%s", dataCoding, encoding), body, (byte[]) message.createBody());
}
}
}
use of org.jsmpp.bean.DeliverSm in project camel by apache.
the class SmppMessageTest method createBodyShouldReturnTheShortMessageIfTheCommandIsAMessageRequest.
@Test
public void createBodyShouldReturnTheShortMessageIfTheCommandIsAMessageRequest() {
DeliverSm command = new DeliverSm();
command.setShortMessage("Hello SMPP world!".getBytes());
message = new SmppMessage(command, new SmppConfiguration());
assertEquals("Hello SMPP world!", message.createBody());
}
use of org.jsmpp.bean.DeliverSm in project camel by apache.
the class SmppBindingTest method createSmppMessageFromDeliveryReceiptWithoutShortMessageShouldNotThrowException.
@Test
public void createSmppMessageFromDeliveryReceiptWithoutShortMessageShouldNotThrowException() throws Exception {
DeliverSm deliverSm = new DeliverSm();
deliverSm.setSmscDeliveryReceipt();
deliverSm.setOptionalParameters(new OptionalParameter.Short((short) 0x2153, (short) 0));
try {
SmppMessage smppMessage = binding.createSmppMessage(deliverSm);
Map<Short, Object> optionalParameter = smppMessage.getHeader(SmppConstants.OPTIONAL_PARAMETER, Map.class);
assertEquals(Short.valueOf((short) 0), optionalParameter.get(Short.valueOf((short) 0x2153)));
} catch (Exception e) {
fail("Should not throw exception while creating smppMessage in absence of shortMessage");
}
}
Aggregations