use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class RxSmppServerSbb method onPduRequestTimeoutLocal.
private void onPduRequestTimeoutLocal(final RxSmppServerSbbUsage anSbbUsage, final PduRequestTimeout event, final ActivityContextInterface aci) {
if (logger.isFineEnabled())
logger.fine("onPduRequestTimeout - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
if (rxSmppServerSbbLocalObject != null) {
ActivityContextInterface act = getSchedulerActivityContextInterface();
if (act != null) {
try {
act.attach(rxSmppServerSbbLocalObject);
PduRequestTimeout2 event2 = new PduRequestTimeout2(event.getPduRequest(), event.getSystemId());
firePduRequestTimeoutChild(event2, act, null);
} catch (IllegalStateException e) {
if (logger.isInfoEnabled())
logger.info("onPduRequestTimeout - 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 sendNextChunk.
private SentItem sendNextChunk(ChunkData currItem, SmsSet smsSet, Esme esme) throws SmscProcessingException {
try {
SmppTransaction smppServerTransaction = this.smppServerSessions.sendRequestPdu(esme, currItem.getPduRequest(), esme.getWindowWaitTimeout());
SentItem result = new SentItem(currItem.getLocalSequenceNumber(), currItem.getPduRequest().getSequenceNumber());
ActivityContextInterface smppTxaci = this.smppServerTransactionACIFactory.getActivityContextInterface(smppServerTransaction);
smppTxaci.attach(this.sbbContext.getSbbLocalObject());
return result;
} catch (Throwable e) {
String s = "SmscProcessingException when sending initial sendDeliverSm()=RxSmppServerSbb.sendDeliverSm(): Exception while trying to send DELIVERY Report for received SmsEvent=" + e.getMessage() + "smsSet: " + smsSet + ", smsSet=" + smsSet;
logger.severe(s, e);
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, EventType.OUT_SMPP_ERROR, currItem.getPduRequest().getSequenceNumber());
}
return null;
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxSmppServerSbbTest method testSubmitSm.
@Test(groups = { "TxSmppServer" })
public void testSubmitSm() throws Exception {
if (!this.cassandraDbInited)
return;
this.smppSess = new SmppSessionsProxy();
this.sbb.setSmppServerSessions(smppSess);
int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
ActivityContextInterface aci = new SmppTransactionProxy(esme);
SubmitSm event = new SubmitSm();
Date curDate = new Date();
this.fillSm(event, curDate, true);
event.setShortMessage(msgUcs2);
long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b1, 0);
assertEquals(b2, 0L);
TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Unicode);
this.sbb.onSubmitSm(event, aci);
b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
assertEquals(b1, 1);
SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
this.checkSmsSet(smsSet, curDate, true);
Sms sms = smsSet.getSms(0);
// msgUcs2
assertEquals(sms.getShortMessageText(), sMsg);
assertEquals(sms.getShortMessageBin(), udhCode);
assertEquals(this.smppSess.getReqList().size(), 0);
assertEquals(this.smppSess.getRespList().size(), 1);
PduResponse resp = this.smppSess.getRespList().get(0);
assertEquals(resp.getCommandStatus(), 0);
assertEquals(resp.getOptionalParameterCount(), 0);
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxSmppServerSbbTest method testSubmitSm_BadCodingSchema.
// @Test(groups = { "TxSmppServer" })
// public void testSubmitMulti_BadAddr() throws Exception {
//
// if (!this.cassandraDbInited)
// return;
//
// this.smppSess = new SmppSessionsProxy();
// this.sbb.setSmppServerSessions(smppSess);
//
// int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
// long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
// long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
// long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
// long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
// long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
//
// Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null,
// SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT,
// windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout,
// "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, -1, -1);
// ActivityContextInterface aci = new SmppTransactionProxy(esme);
//
// SubmitMulti event = new SubmitMulti();
// Date curDate = new Date();
// this.fillSm(event, curDate, true);
// event.setShortMessage(msgUcs2);
//
// Address destAddr = new Address();
// destAddr.setAddress("5555");
// destAddr.setTon(SmppConstants.TON_SUBSCRIBER);
// destAddr.setNpi(SmppConstants.NPI_E164);
// event.addDestAddresses(destAddr);
// Address destAddr2 = new Address();
// destAddr2.setAddress("5556");
// destAddr2.setTon(SmppConstants.TON_INTERNATIONAL);
// destAddr2.setNpi(SmppConstants.NPI_E164);
// event.addDestAddresses(destAddr2);
//
// long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
// PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
// int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
// long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
// assertEquals(b1, 0);
// assertEquals(b2, 0L);
// b1 = this.pers.checkSmsExists(dueSlot, ta2.getTargetId());
// b2 = this.pers.c2_getDueSlotForTargetId(psc, ta2.getTargetId());
// assertEquals(b1, 0);
// assertEquals(b2, 0L);
//
// TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Unicode);
// this.sbb.onSubmitMulti(event, aci);
//
// b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
// assertEquals(b1, 0);
// b1 = this.pers.checkSmsExists(dueSlot, ta2.getTargetId());
// assertEquals(b1, 1);
//
// SubmitMultiResp resp = (SubmitMultiResp)this.smppSess.getRespList().get(0);
// assertEquals(resp.getCommandStatus(), 0);
// assertEquals(resp.getOptionalParameterCount(), 0);
// assertEquals(resp.getUnsucessfulSmes().size(), 1);
// assertEquals(resp.getUnsucessfulSmes().get(0).getAddress().getAddress(), "5555");
// }
@Test(groups = { "TxSmppServer" })
public void testSubmitSm_BadCodingSchema() throws Exception {
if (!this.cassandraDbInited)
return;
this.smppSess = new SmppSessionsProxy();
this.sbb.setSmppServerSessions(smppSess);
int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
ActivityContextInterface aci = new SmppTransactionProxy(esme);
SubmitSm event = new SubmitSm();
Date curDate = new Date();
this.fillSm(event, curDate, true);
event.setShortMessage(msgUtf8);
DataCodingSchemeImpl dcss = new DataCodingSchemeImpl(DataCodingGroup.GeneralGroup, null, null, null, CharacterSet.GSM7, true);
// DataCodingGroup dataCodingGroup, DataCodingSchemaMessageClass
// messageClass,
// DataCodingSchemaIndicationType dataCodingSchemaIndicationType,
// Boolean setIndicationActive,
// CharacterSet characterSet, boolean isCompressed
event.setDataCoding((byte) 12);
long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b1, 0);
assertEquals(b2, 0L);
TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Utf8);
this.sbb.onSubmitSm(event, aci);
b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b2, 0);
assertEquals(this.smppSess.getReqList().size(), 0);
assertEquals(this.smppSess.getRespList().size(), 1);
PduResponse resp = this.smppSess.getRespList().get(0);
assertEquals(resp.getCommandStatus(), 260);
assertEquals(resp.getOptionalParameterCount(), 1);
Tlv tlvr = resp.getOptionalParameter(SmppConstants.TAG_ADD_STATUS_INFO);
String errMsg = tlvr.getValueAsString();
assertEquals(errMsg, "TxSmpp DataCoding scheme does not supported: 12 - Only GSM7, GSM8 and USC2 are supported");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method getStatusGETPasswordNullErrorTest.
@Test
public void getStatusGETPasswordNullErrorTest() {
System.out.println("getStatusGETErrorTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildGetMessageIdStatusRequest(METHOD_GET, URL_GET_MESSAGE_ID_STATUS, USER_DEFAULT, null, MESSAGE_ID, FORMAT_STRING);
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.assertEquals(resp.getStatus(), HttpServletResponse.SC_UNAUTHORIZED);
}
Aggregations