Search in sources :

Example 6 with DataSm

use of org.jsmpp.bean.DataSm in project camel by apache.

the class MessageReceiverListenerImplTest method onAcceptDataSmSuccess.

@Test
public void onAcceptDataSmSuccess() throws Exception {
    SMPPSession session = createMock(SMPPSession.class);
    DataSm dataSm = createMock(DataSm.class);
    Exchange exchange = createMock(Exchange.class);
    OptionalParameter[] optionalParameters = new OptionalParameter[] {};
    expect(endpoint.createOnAcceptDataSm(dataSm, "1")).andReturn(exchange);
    processor.process(exchange);
    expect(exchange.getException()).andReturn(null);
    expect(dataSm.getOptionalParameters()).andReturn(optionalParameters);
    replay(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    DataSmResult result = listener.onAcceptDataSm(dataSm, session);
    verify(endpoint, processor, exceptionHandler, session, dataSm, exchange);
    assertEquals("1", result.getMessageId());
    assertSame(optionalParameters, result.getOptionalParameters());
}
Also used : Exchange(org.apache.camel.Exchange) OptionalParameter(org.jsmpp.bean.OptionalParameter) DataSm(org.jsmpp.bean.DataSm) DataSmResult(org.jsmpp.session.DataSmResult) SMPPSession(org.jsmpp.session.SMPPSession) Test(org.junit.Test)

Example 7 with DataSm

use of org.jsmpp.bean.DataSm in project camel by apache.

the class SmppEndpointTest method createOnAcceptDataSm.

@Test
public void createOnAcceptDataSm() throws Exception {
    DataSm dataSm = createMock(DataSm.class);
    SmppMessage message = createMock(SmppMessage.class);
    expect(binding.createSmppMessage(eq(dataSm), isA(String.class))).andReturn(message);
    message.setExchange(isA(Exchange.class));
    replay(dataSm, binding, message);
    Exchange exchange = endpoint.createOnAcceptDataSm(dataSm, "1");
    verify(dataSm, binding, message);
    assertSame(binding, exchange.getProperty(Exchange.BINDING));
    assertSame(message, exchange.getIn());
    assertSame(ExchangePattern.InOnly, exchange.getPattern());
}
Also used : Exchange(org.apache.camel.Exchange) DataSm(org.jsmpp.bean.DataSm) Test(org.junit.Test)

Example 8 with DataSm

use of org.jsmpp.bean.DataSm in project camel by apache.

the class SmppMessageTest method testSmppMessageDataSm.

@Test
public void testSmppMessageDataSm() {
    DataSm command = new DataSm();
    message = new SmppMessage(command, new SmppConfiguration());
    assertTrue(message.getCommand() instanceof DataSm);
    assertTrue(message.getHeaders().isEmpty());
    assertTrue(message.isDataSm());
}
Also used : DataSm(org.jsmpp.bean.DataSm) Test(org.junit.Test)

Aggregations

DataSm (org.jsmpp.bean.DataSm)8 Test (org.junit.Test)5 Exchange (org.apache.camel.Exchange)3 Message (org.apache.camel.Message)2 OptionalParameter (org.jsmpp.bean.OptionalParameter)2 DataSmResult (org.jsmpp.session.DataSmResult)2 ESMClass (org.jsmpp.bean.ESMClass)1 Byte (org.jsmpp.bean.OptionalParameter.Byte)1 COctetString (org.jsmpp.bean.OptionalParameter.COctetString)1 OctetString (org.jsmpp.bean.OptionalParameter.OctetString)1 Short (org.jsmpp.bean.OptionalParameter.Short)1 RegisteredDelivery (org.jsmpp.bean.RegisteredDelivery)1 SMPPSession (org.jsmpp.session.SMPPSession)1