Search in sources :

Example 6 with SMPPSession

use of org.jsmpp.session.SMPPSession in project wso2-axis2-transports by wso2.

the class SMPPImplManager method start.

public void start() {
    inSession = new SMPPSession();
    try {
        inSession.connectAndBind(smppTransportInDetails.getHost(), smppTransportInDetails.getPort(), new BindParameter(BindType.BIND_RX, smppTransportInDetails.getSystemId(), smppTransportInDetails.getPassword(), smppTransportInDetails.getSystemType(), TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));
        SMPPListener listener = new SMPPListener(smsInManeger);
        inSession.setMessageReceiverListener(listener);
        stop = false;
        System.out.println(" [Axis2] bind and connect to " + smppTransportInDetails.getHost() + " : " + smppTransportInDetails.getPort() + " on SMPP Transport");
    } catch (IOException e) {
        log.error("Unable to conncet" + e);
    }
}
Also used : BindParameter(org.jsmpp.session.BindParameter) SMPPSession(org.jsmpp.session.SMPPSession) IOException(java.io.IOException)

Example 7 with SMPPSession

use of org.jsmpp.session.SMPPSession in project camel by apache.

the class SmppProducer method createSession.

private SMPPSession createSession() throws IOException {
    LOG.debug("Connecting to: {}...", getEndpoint().getConnectionString());
    SMPPSession session = createSMPPSession();
    session.setEnquireLinkTimer(this.configuration.getEnquireLinkTimer());
    session.setTransactionTimer(this.configuration.getTransactionTimer());
    session.addSessionStateListener(internalSessionStateListener);
    session.connectAndBind(this.configuration.getHost(), this.configuration.getPort(), new BindParameter(BindType.BIND_TX, this.configuration.getSystemId(), this.configuration.getPassword(), this.configuration.getSystemType(), TypeOfNumber.valueOf(configuration.getTypeOfNumber()), NumberingPlanIndicator.valueOf(configuration.getNumberingPlanIndicator()), ""));
    LOG.info("Connected to: {}", getEndpoint().getConnectionString());
    return session;
}
Also used : BindParameter(org.jsmpp.session.BindParameter) SMPPSession(org.jsmpp.session.SMPPSession)

Example 8 with SMPPSession

use of org.jsmpp.session.SMPPSession in project camel by apache.

the class SmppBindingTest method createSmppSubmitSmCommand.

@Test
public void createSmppSubmitSmCommand() {
    SMPPSession session = new SMPPSession();
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    SmppCommand command = binding.createSmppCommand(session, exchange);
    assertTrue(command instanceof SmppSubmitSmCommand);
}
Also used : Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) SMPPSession(org.jsmpp.session.SMPPSession) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 9 with SMPPSession

use of org.jsmpp.session.SMPPSession in project camel by apache.

the class SmppBindingTest method createSmppCancelSmCommand.

@Test
public void createSmppCancelSmCommand() {
    SMPPSession session = new SMPPSession();
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(SmppConstants.COMMAND, "CancelSm");
    SmppCommand command = binding.createSmppCommand(session, exchange);
    assertTrue(command instanceof SmppCancelSmCommand);
}
Also used : Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) SMPPSession(org.jsmpp.session.SMPPSession) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 10 with SMPPSession

use of org.jsmpp.session.SMPPSession 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)

Aggregations

SMPPSession (org.jsmpp.session.SMPPSession)15 Exchange (org.apache.camel.Exchange)8 DefaultExchange (org.apache.camel.impl.DefaultExchange)7 Test (org.junit.Test)7 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)6 BindParameter (org.jsmpp.session.BindParameter)4 IOException (java.io.IOException)3 OutboundMessageResponse (org.hisp.dhis.outboundmessage.OutboundMessageResponse)2 Date (java.util.Date)1 AxisFault (org.apache.axis2.AxisFault)1 OutboundMessage (org.hisp.dhis.outboundmessage.OutboundMessage)1 InvalidResponseException (org.jsmpp.InvalidResponseException)1 PDUException (org.jsmpp.PDUException)1 DataSm (org.jsmpp.bean.DataSm)1 OptionalParameter (org.jsmpp.bean.OptionalParameter)1 NegativeResponseException (org.jsmpp.extra.NegativeResponseException)1 ResponseTimeoutException (org.jsmpp.extra.ResponseTimeoutException)1 DataSmResult (org.jsmpp.session.DataSmResult)1 Before (org.junit.Before)1