use of org.jsmpp.session.BindParameter in project camel by apache.
the class SmppConsumer method createSession.
private SMPPSession createSession() throws IOException {
SMPPSession session = createSMPPSession();
session.setEnquireLinkTimer(configuration.getEnquireLinkTimer());
session.setTransactionTimer(configuration.getTransactionTimer());
session.addSessionStateListener(internalSessionStateListener);
session.setMessageReceiverListener(messageReceiverListener);
session.connectAndBind(this.configuration.getHost(), this.configuration.getPort(), new BindParameter(BindType.BIND_RX, this.configuration.getSystemId(), this.configuration.getPassword(), this.configuration.getSystemType(), TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, configuration.getAddressRange()));
return session;
}
use of org.jsmpp.session.BindParameter in project camel by apache.
the class SmppProducerLazySessionCreationTest method processShouldCreateTheSmppSession.
@Test
public void processShouldCreateTheSmppSession() throws Exception {
expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775").times(2);
//expectation
session.setEnquireLinkTimer(5000);
//expectation
session.setTransactionTimer(10000);
session.addSessionStateListener(isA(SessionStateListener.class));
expect(session.connectAndBind("localhost", new Integer(2775), new BindParameter(BindType.BIND_TX, "smppclient", "password", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, ""))).andReturn("1");
expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
expect(endpoint.isSingleton()).andReturn(true);
SmppBinding binding = createMock(SmppBinding.class);
Exchange exchange = createMock(Exchange.class);
Message in = createMock(Message.class);
SmppCommand command = createMock(SmppCommand.class);
expect(endpoint.getBinding()).andReturn(binding);
expect(binding.createSmppCommand(session, exchange)).andReturn(command);
expect(exchange.getIn()).andReturn(in);
expect(in.getHeader("CamelSmppSystemId", String.class)).andReturn(null);
expect(in.getHeader("CamelSmppPassword", String.class)).andReturn(null);
command.execute(exchange);
replay(session, endpoint, binding, exchange, in, command);
producer.doStart();
producer.process(exchange);
verify(session, endpoint, binding, exchange, in, command);
}
use of org.jsmpp.session.BindParameter in project camel by apache.
the class SmppProducerLazySessionCreationTest method processShouldCreateTheSmppSessionWithTheSystemIdAndPasswordFromTheExchange.
@Test
public void processShouldCreateTheSmppSessionWithTheSystemIdAndPasswordFromTheExchange() throws Exception {
expect(endpoint.getConnectionString()).andReturn("smpp://localhost:2775").times(2);
//expectation
session.setEnquireLinkTimer(5000);
//expectation
session.setTransactionTimer(10000);
session.addSessionStateListener(isA(SessionStateListener.class));
expect(session.connectAndBind("localhost", new Integer(2775), new BindParameter(BindType.BIND_TX, "smppclient2", "password2", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, ""))).andReturn("1");
expect(endpoint.getConnectionString()).andReturn("smpp://localhost:2775");
SmppBinding binding = createMock(SmppBinding.class);
Exchange exchange = createMock(Exchange.class);
Message in = createMock(Message.class);
SmppCommand command = createMock(SmppCommand.class);
expect(endpoint.getBinding()).andReturn(binding);
expect(endpoint.isSingleton()).andReturn(true);
expect(binding.createSmppCommand(session, exchange)).andReturn(command);
expect(exchange.getIn()).andReturn(in);
expect(in.getHeader("CamelSmppSystemId", String.class)).andReturn("smppclient2");
expect(in.getHeader("CamelSmppPassword", String.class)).andReturn("password2");
command.execute(exchange);
replay(session, endpoint, binding, exchange, in, command);
producer.doStart();
producer.process(exchange);
verify(session, endpoint, binding, exchange, in, command);
}
use of org.jsmpp.session.BindParameter in project camel by apache.
the class SmppProducerTest method doStartExpectations.
private void doStartExpectations() throws IOException {
expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775").times(2);
//expectation
session.setEnquireLinkTimer(5000);
//expectation
session.setTransactionTimer(10000);
session.addSessionStateListener(isA(SessionStateListener.class));
expect(session.connectAndBind("localhost", new Integer(2775), new BindParameter(BindType.BIND_TX, "smppclient", "password", "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, ""))).andReturn("1");
expect(endpoint.getConnectionString()).andReturn("smpp://smppclient@localhost:2775");
expect(endpoint.isSingleton()).andReturn(true);
}
use of org.jsmpp.session.BindParameter 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;
}
Aggregations