use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendMessageGETStringIncorrectNpiTest.
@Test
public void sendMessageGETStringIncorrectNpiTest() throws Exception {
System.out.println("sendMessageGETStringIncorrectNpiTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, URLEncoder.encode(MESSAGE_DEFAULT, "UTF-8"), FORMAT_STRING, ENCODING_GSM7, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_INCORRECT, TO_ONE);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_STRING, false, 1), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendMessageGETStringIncorrectTonTest.
@Test
public void sendMessageGETStringIncorrectTonTest() throws Exception {
System.out.println("sendMessageGETStringIncorrectTonTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, URLEncoder.encode(MESSAGE_DEFAULT, "UTF-8"), FORMAT_STRING, ENCODING_GSM7, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_INCORRECT, SENDER_NPI_DEFAULT, TO_ONE);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_STRING, false, 1), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method alphanumericToAddressTest_POST.
@Test
public void alphanumericToAddressTest_POST() {
System.out.println("alphanumericToAddressTest_POST");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_POST, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, MESSAGE_DEFAULT, FORMAT_JSON, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_ONE_ALPHANUMERIC);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpPost(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_JSON, false), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendMessagePOSTJsonToMultipleSuccessTest.
@Test
public void sendMessagePOSTJsonToMultipleSuccessTest() {
System.out.println("sendMessagePOSTJsonSuccessTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_POST, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, MESSAGE_DEFAULT, FORMAT_JSON, ENCODING_GSM7, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_MULTIPLE);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpPost(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_JSON, true, 3), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class HrSriClientSbb method sendSRI.
private void sendSRI(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, CorrelationIdValue correlationIdValue) {
// Send out SRI
MAPDialogSms mapDialogSms = null;
try {
// 1. Create Dialog first and add the SRI request to it
mapDialogSms = this.setupRoutingInfoForSMRequestIndication(destinationAddress, ton, npi, mapApplicationContext, correlationIdValue.getNetworkId());
// 2. Create the ACI and attach this SBB
ActivityContextInterface sriDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
sriDialogACI.attach(this.sbbContext.getSbbLocalObject());
// 3. Finally send the request
mapDialogSms.send();
} catch (MAPException e) {
if (mapDialogSms != null) {
mapDialogSms.release();
}
String reason = "Home routing: HrSriClientSbb: MAPException when sending SRI from sendSRI(): " + e.toString();
this.logger.severe(reason, e);
this.returnSriFailure(correlationIdValue, null, reason);
}
}
Aggregations