use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSmppServerSbb method onSubmitSmRespLocal.
private void onSubmitSmRespLocal(final RxSmppServerSbbUsage anSbbUsage, final SubmitSmResp event, final ActivityContextInterface aci) {
if (logger.isFineEnabled())
logger.fine("onSubmitSmResp - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
if (rxSmppServerSbbLocalObject != null) {
ActivityContextInterface act = getSchedulerActivityContextInterface();
if (act != null) {
try {
act.attach(rxSmppServerSbbLocalObject);
fireSubmitSmRespChild(event, act, null);
} catch (IllegalStateException e) {
if (logger.isInfoEnabled())
logger.info("onSubmitSmRespLocal - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
}
}
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSmppServerSbb method onSendPduStatusLocal.
private void onSendPduStatusLocal(final SendPduStatus event, final ActivityContextInterface aci) {
if (logger.isFineEnabled())
logger.fine("onSendPduStatusParent - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
if (rxSmppServerSbbLocalObject != null) {
ActivityContextInterface act = getSchedulerActivityContextInterface();
if (act != null) {
try {
act.attach(rxSmppServerSbbLocalObject);
SendPduStatus2 event2 = new SendPduStatus2(event.getException(), event.getRequest(), event.getResponse(), event.getSystemId(), event.isSuccess());
SmsSet smsSet = getSmsSet();
Pdu pduEvent = event.getRequest();
if (event.getResponse() != null)
pduEvent = event.getResponse();
EsmeManagement esmeManagement = EsmeManagement.getInstance();
Boolean destAddressLimitationEnabled = false;
if (esmeManagement != null && smsSet != null) {
Esme esme = esmeManagement.getEsmeByName(smsSet.getDestEsmeName());
if (esme != null) {
destAddressLimitationEnabled = esme.getDestAddrSendLimit() != 0;
}
}
int realID = -1;
SentItemsList list = null;
if (destAddressLimitationEnabled) {
list = retreiveSentChunks();
for (int i = 0; i < list.getSentList().size(); i++) {
if (list.getSentList().get(i).getRemoteSequenceNumber() == pduEvent.getSequenceNumber()) {
realID = list.getSentList().get(i).getLocalSequenceNumber();
break;
}
}
} else {
realID = pduEvent.getSequenceNumber();
}
ConfirmMessageInSendingPool confirmMessageInSendingPool = null;
if (realID != -1)
confirmMessageInSendingPool = getMessageInSendingPoolBySeqNumber(realID);
fireSendPduStatusChild(event2, act, null);
} catch (IllegalStateException e) {
if (logger.isInfoEnabled())
logger.info("onSendPduStatus - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
}
}
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSmppServerSbb method onDeliverSmRespLocal.
private void onDeliverSmRespLocal(final RxSmppServerSbbUsage anSbbUsage, final DeliverSmResp event, final ActivityContextInterface aci) {
if (logger.isFineEnabled())
logger.fine("onDeliverSmResp - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
if (rxSmppServerSbbLocalObject != null) {
ActivityContextInterface act = getSchedulerActivityContextInterface();
if (act != null) {
try {
act.attach(rxSmppServerSbbLocalObject);
fireDeliverSmRespChild(event, act, null);
} catch (IllegalStateException e) {
if (logger.isInfoEnabled())
logger.info("onDeliverSmResp - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
}
}
}
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendArabicMessageGETStringSuccessTest.
@Test
public void sendArabicMessageGETStringSuccessTest() throws UnsupportedEncodingException {
System.out.println("sendArabicMessageGETStringSuccessTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
String urlEncoded = null;
urlEncoded = URLEncoder.encode(MSG_ARABIC, "UTF-8");
MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, urlEncoded, FORMAT_STRING, ENCODING_UCS2, 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.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_STRING, true, 3), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendArabicMessagePOSTSuccessStringTest.
@Test
public void sendArabicMessagePOSTSuccessStringTest() throws UnsupportedEncodingException {
System.out.println("sendArabicMessagePOSTSuccessTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
String urlEncoded = null;
urlEncoded = URLEncoder.encode(MSG_ARABIC, "UTF-8");
MockHttpServletRequest request = buildSendMessageRequest(METHOD_POST, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, urlEncoded, FORMAT_STRING, ENCODING_UCS2, 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_STRING, true, 3), "Response is not valid");
}
Aggregations