use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class CassandraToolForm method getData.
private void getData() {
try {
String tName = this.dbOperations.getTableName(new Date());
String tbFam;
int option = 0;
if (this.rbLive.isSelected()) {
tbFam = Schema.FAMILY_SLOT_MESSAGES_TABLE;
} else if (this.rbArchive.isSelected()) {
tbFam = Schema.FAMILY_MESSAGES;
} else if (this.rbMsgId.isSelected()) {
tbFam = Schema.FAMILY_MES_ID;
option = 1;
} else {
tbFam = Schema.FAMILY_DLV_MES_ID;
option = 2;
}
String s1 = "SELECT * FROM \"" + tbFam + tName + "\";";
Session session = this.dbOperations.getSession();
PreparedStatement ps = session.prepare(s1);
BoundStatement boundStatement = new BoundStatement(ps);
ResultSet res = session.execute(boundStatement);
model.getDataVector().clear();
model.rowsRemoved(new TableModelEvent(model));
DateFormat df = new SimpleDateFormat("MM.dd HH:mm:ss");
if (option == 0) {
SortedMap<Long, ArrayList<SmsSet>> result = new TreeMap<Long, ArrayList<SmsSet>>();
for (Row row : res) {
SmsSet smsSet = this.dbOperations.createSms(row, null);
if (smsSet != null) {
ArrayList<SmsSet> al = result.get(smsSet.getSms(0).getMessageId());
if (al == null) {
al = new ArrayList<SmsSet>();
result.put(smsSet.getSms(0).getMessageId(), al);
}
al.add(smsSet);
}
}
for (ArrayList<SmsSet> al : result.values()) {
for (SmsSet smsSet : al) {
ListSelectionModel l = tResult.getSelectionModel();
Vector newRow = new Vector();
newRow.add(smsSet.getTargetId());
newRow.add(smsSet.getSms(0).getDbId());
String reportDate = df.format(this.dbOperations.c2_getTimeForDueSlot(smsSet.getSms(0).getDueSlot()));
newRow.add(smsSet.getSms(0).getDueSlot() + " - " + reportDate);
newRow.add(smsSet.getSms(0).getMessageId());
newRow.add(smsSet.getInSystem());
newRow.add(smsSet.getSms(0).getDeliveryCount());
newRow.add(smsSet.getStatus());
Date dt = smsSet.getSms(0).getValidityPeriod();
if (dt != null)
reportDate = df.format(dt);
else
reportDate = "";
newRow.add(reportDate);
dt = smsSet.getSms(0).getScheduleDeliveryTime();
if (dt != null)
reportDate = df.format(dt);
else
reportDate = "";
newRow.add(reportDate);
newRow.add(smsSet.getSms(0).getShortMessageText());
model.getDataVector().add(0, newRow);
model.newRowsAdded(new TableModelEvent(model));
}
}
} else if (option == 1) {
for (Row row : res) {
ListSelectionModel l = tResult.getSelectionModel();
Vector newRow = new Vector();
newRow.add(row.getString(Schema.COLUMN_ADDR_DST_DIGITS));
newRow.add(row.getUUID(Schema.COLUMN_ID));
newRow.add("");
newRow.add(row.getLong(Schema.COLUMN_MESSAGE_ID));
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
model.getDataVector().add(0, newRow);
model.newRowsAdded(new TableModelEvent(model));
}
} else {
for (Row row : res) {
ListSelectionModel l = tResult.getSelectionModel();
Vector newRow = new Vector();
newRow.add(row.getString(Schema.COLUMN_REMOTE_MESSAGE_ID));
newRow.add("");
newRow.add(row.getString(Schema.COLUMN_DEST_ID));
newRow.add(row.getLong(Schema.COLUMN_MESSAGE_ID));
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
newRow.add("");
model.getDataVector().add(0, newRow);
model.newRowsAdded(new TableModelEvent(model));
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(getJFrame(), "Can not get data from cassandra database:\n" + e.getMessage());
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class RxSmppServerSbb method onDeliverSmLocal.
private void onDeliverSmLocal(final RxSmppServerSbbUsage anSbbUsage, final SmsSetEvent event) {
try {
if (this.logger.isFineEnabled()) {
this.logger.fine("\nReceived Deliver SMS. event= " + event + "this=" + this);
}
SmsSet smsSet = event.getSmsSet();
this.addInitialMessageSet(smsSet);
try {
this.sendDeliverSm(smsSet);
} catch (SmscProcessingException e) {
String s = "SmscProcessingException when sending initial sendDeliverSm()=" + e.getMessage() + ", smsSet=" + smsSet;
logger.severe(s, e);
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, EventType.OUT_SMPP_ERROR, -1);
}
} catch (Throwable e1) {
anSbbUsage.incrementCounterErrorDeliverSm(ONE);
logger.severe("Exception in RxSmppServerSbb.onDeliverSm() when fetching records and issuing events: " + e1.getMessage(), e1);
markDeliveringIsEnded(true);
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class RxSmppServerSbb method handleResponse.
/**
* Processing of a positive delivery response to smpp destination.
*
* @param event
* @throws Exception
*/
private void handleResponse(BaseSmResp event) throws Exception {
long ts = System.currentTimeMillis();
if (isDeliveringEnded()) {
if (logger.isFineEnabled()) {
this.logger.fine("SMPP Response received when DeliveringEnded state: status=" + event.getCommandStatus());
}
}
if (isDeliveringEnded()) {
logger.info("RxSmppServerSbb.handleResponse(): received submit/deliver_sm_response but delivery process is already ended, dropping of a response");
return;
}
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("RxSmppServerSbb.handleResponse(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
int status = event.getCommandStatus();
if (status == 0) {
smscStatAggregator.updateMsgOutSentAll();
smscStatAggregator.updateMsgOutSentSmpp();
boolean destAddressLimitationEnabled = false;
EsmeManagement esmeManagement = EsmeManagement.getInstance();
Esme esme = esmeManagement.getEsmeByClusterName(smsSet.getDestClusterName());
if (esme != null) {
destAddressLimitationEnabled = esme.getDestAddrSendLimit() != 0;
}
int realID = -1;
Boolean sentListChanged = false;
SentItemsList list = null;
if (destAddressLimitationEnabled) {
list = retreiveSentChunks();
for (int i = 0; i < list.getSentList().size(); i++) {
if (list.getSentList().get(i).getRemoteSequenceNumber() == event.getSequenceNumber()) {
realID = list.getSentList().get(i).getLocalSequenceNumber();
list.getSentList().remove(i);
sentListChanged = true;
break;
}
}
} else {
realID = event.getSequenceNumber();
}
ConfirmMessageInSendingPool confirmMessageInSendingPool = null;
if (realID != -1)
confirmMessageInSendingPool = confirmMessageInSendingPool(realID);
if (realID == -1 || !confirmMessageInSendingPool.sequenceNumberFound) {
this.logger.severe("RxSmppServerSbb.handleResponse(): no sms in MessageInSendingPool: UnconfirmedCnt=" + this.getUnconfirmedMessageCountInSendingPool() + ", sequenceNumber=" + event.getSequenceNumber() + ", realID=" + realID + ", confirmMessageInSendingPool=" + confirmMessageInSendingPool);
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, "Received undefined SequenceNumber: " + event.getSequenceNumber() + ", SmsSet=" + smsSet, EventType.OUT_SMPP_ERROR, realID);
if (sentListChanged)
setSentChunks(list);
return;
}
Sms sms = confirmMessageInSendingPool.sms;
if (sms != null) {
sms.setTimestampC(System.currentTimeMillis());
}
if (destAddressLimitationEnabled) {
ChunkDataList dataList = retreivePendingChunks();
if (dataList != null && !dataList.getPendingList().isEmpty()) {
// so checking if has window
if (list.getSentList().size() < esme.getDestAddrSendLimit()) {
ChunkData current = dataList.getPendingList().remove(0);
setPendingChunks(dataList);
if (current != null) {
SentItem newItem = sendNextChunk(current, smsSet, esme);
SentItemsList sentChunks = retreiveSentChunks();
sentChunks.getSentList().add(newItem);
sentListChanged = true;
}
}
}
}
if (sentListChanged)
setSentChunks(list);
if (!confirmMessageInSendingPool.confirmed) {
this.generateCDR(sms, CdrGenerator.CDR_PARTIAL_ESME, CdrGenerator.CDR_SUCCESS_NO_REASON, true, false, event.getSequenceNumber());
String messageType = esme.getSmppSessionType() == Type.CLIENT ? CdrDetailedGenerator.CDR_MSG_TYPE_SUBMITSM : CdrDetailedGenerator.CDR_MSG_TYPE_DELIVERSM;
this.generateDetailedCDR(sms, EventType.OUT_SMPP_SENT, sms.getSmsSet().getStatus(), messageType, status, esme.getRemoteAddressAndPort(), event.getSequenceNumber());
return;
}
// firstly we store remote messageId if sms has a request to delivery receipt
String clusterName = smsSet.getDestClusterName();
String dlvMessageId = event.getMessageId();
sms.setDlvMessageId(dlvMessageId);
// if (MessageUtil.isDeliveryReceiptRequest(sms)) {
// SmsSetCache.getInstance().putDeliveredRemoteMsgIdValue(dlvMessageId, clusterName, sms.getMessageId(), 30);
// }
// current message is sent
// firstly sending of a positive response for transactional mode
sendTransactionalResponseSuccess(sms);
// mproc rules applying for delivery phase
this.applyMprocRulesOnSuccess(sms, ProcessingType.SMPP);
// Processing succeeded
sms.getSmsSet().setStatus(ErrorCode.SUCCESS);
this.postProcessSucceeded(sms, dlvMessageId, clusterName);
// success CDR generating
boolean isPartial = MessageUtil.isSmsNotLastSegment(sms);
this.generateCDR(sms, isPartial ? CdrGenerator.CDR_PARTIAL_ESME : CdrGenerator.CDR_SUCCESS_ESME, CdrGenerator.CDR_SUCCESS_NO_REASON, confirmMessageInSendingPool.splittedMessage, true, event.getSequenceNumber());
String messageType = null;
String remoteAddr = null;
if (esme != null) {
messageType = esme.getSmppSessionType() == Type.CLIENT ? CdrDetailedGenerator.CDR_MSG_TYPE_SUBMITSM : CdrDetailedGenerator.CDR_MSG_TYPE_DELIVERSM;
remoteAddr = esme.getRemoteAddressAndPort();
}
if (messageType == null) {
if (event.getCommandId() == SmppConstants.CMD_ID_DELIVER_SM_RESP) {
messageType = CdrDetailedGenerator.CDR_MSG_TYPE_DELIVERSM;
} else {
messageType = CdrDetailedGenerator.CDR_MSG_TYPE_SUBMITSM;
}
}
this.generateDetailedCDR(sms, EventType.OUT_SMPP_SENT, sms.getSmsSet().getStatus(), messageType, status, remoteAddr, event.getSequenceNumber());
// adding a success receipt if it is needed
this.generateSuccessReceipt(smsSet, sms);
if (this.getUnconfirmedMessageCountInSendingPool() == 0) {
// all sent messages are confirmed - we are sending new message set
TargetAddress lock = persistence.obtainSynchroObject(new TargetAddress(smsSet));
try {
synchronized (lock) {
// marking the message in cache as delivered
this.commitSendingPoolMsgCount();
ts = warnIfLong(logger, ts, "handleResponse/status=0/in-lock/commitSendingPoolMsgCount");
// now we are trying to sent other messages
if (this.getTotalUnsentMessageCount() > 0) {
try {
this.sendDeliverSm(smsSet);
ts = warnIfLong(logger, ts, "handleResponse/status=0/in-lock/sendDeliverSm");
return;
} catch (SmscProcessingException e) {
SbbStatsUtils.handleProcessingException(e, getDefaultSbbUsageParameterSet());
String s = "SmscProcessingException when sending next sendDeliverSm()=" + e.getMessage() + ", Message=" + sms;
logger.severe(s, e);
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, EventType.OUT_SMPP_ERROR, event.getSequenceNumber());
}
}
// no more messages to send - remove smsSet
smsSet.setStatus(ErrorCode.SUCCESS);
this.markDeliveringIsEnded(true);
}
} finally {
persistence.releaseSynchroObject(lock);
}
}
} else {
ErrorAction errorAction = ErrorAction.permanentFailure;
smsSet.setSmppCommandStatus(status);
if (status == SmppConstants.STATUS_THROTTLED || status == SmppConstants.STATUS_X_T_APPN || status == SmppConstants.STATUS_SYSERR || status == SmppConstants.STATUS_INVBNDSTS || status == SmppConstants.STATUS_MSGQFUL)
errorAction = ErrorAction.temporaryFailure;
logger.warning("RxSmppServerSbb.handleResponse(): error code response received: status=" + status + ", errorAction=" + errorAction + ", smsSet=" + smsSet);
this.onDeliveryError(smsSet, errorAction, ErrorCode.SC_SYSTEM_ERROR, event.getName() + " has a bad status: " + status, EventType.OUT_SMPP_REJECTED, event.getSequenceNumber());
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class RxSmppServerSbb method onRecoverablePduExceptionParentLocal.
private void onRecoverablePduExceptionParentLocal(final RxSmppServerSbbUsage anSbbUsage, final RecoverablePduException event) {
try {
if (isDeliveringEnded()) {
logger.info("RxSmppServerSbb.onRecoverablePduException(): received RecoverablePduException but delivery process is already ended, dropping of an event");
return;
}
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("RxSmppServerSbb.onRecoverablePduException(): In onDeliverSmResp CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
logger.severe(String.format("\nonRecoverablePduException : targetId=" + smsSet.getTargetId() + ", RecoverablePduException=" + event));
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, "RecoverablePduException: ", EventType.OUT_SMPP_ERROR, event.getPartialPdu().getSequenceNumber());
} catch (Throwable e1) {
anSbbUsage.incrementCounterErrorRecoverablePduExceptionParent(ONE);
logger.severe("Exception in RxSmppServerSbb.onRecoverablePduException() when fetching records and issuing events: " + e1.getMessage(), e1);
markDeliveringIsEnded(true);
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtTest method SuccessDelivery3Test.
/**
* MAP V1, 1 message, long message with 2 segments, GSM7
* no TC-BEGIN message because of MAP V1
* SRI response with MwdSet, but no ReportSMDeliveryStatusRequest because of MAP V1
*/
@Test(groups = { "Mt" })
public void SuccessDelivery3Test() throws Exception {
if (!this.cassandraDbInited)
return;
MAPServiceSmsProxy serviceSri = (MAPServiceSmsProxy) this.sriSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceMt = (MAPServiceSmsProxy) this.mtSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceRsds = (MAPServiceSmsProxy) this.rsdsSbb.mapProvider.getMAPServiceSms();
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
MProcManagement.getInstance("Test");
ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
SmsDef sd1 = new SmsDef();
lst.add(sd1);
StringBuilder sb = new StringBuilder();
for (int i1 = 0; i1 < 18; i1++) {
// msg len = 180
sb.append("0123456789");
}
String totalMsg = sb.toString();
int segmlen = MessageUtil.getMaxSegmentedMessageBytesLength(new DataCodingSchemeImpl(0));
String msga1 = totalMsg.substring(0, segmlen);
String msga2 = totalMsg.substring(segmlen);
sd1.msg = totalMsg;
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
UUID smsId = sms1.getDbId();
SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
MAPApplicationContextVersion acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertNull(serviceMt.getLastMAPDialogSms());
// SRI "MAP only V1 supported" response
DialogReject evt11 = new DialogReject(dlg, MAPRefuseReason.PotentialVersionIncompatibility, null, null);
this.sriSbb.onDialogReject(evt11, null);
dlg = serviceSri.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version1);
assertNull(serviceMt.getLastMAPDialogSms());
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
MAPTestEvent evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
// SRI response
IMSI imsi = new IMSIImpl(imsiDig);
ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, nnnDig);
LocationInfoWithLMSI locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
SendRoutingInfoForSMResponse evt1 = new SendRoutingInfoForSMResponseImpl(imsi, locationInfoWithLMSI, null, true);
evt1.setMAPDialog(dlg);
this.sriSbb.onSendRoutingInfoForSMResponse(evt1, null);
this.sriSbb.onDialogDelimiter(null, null);
dlg = serviceMt.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
lstEvt = dlg.getEventList();
// Empty TC-BEGIN for MAP V3
assertEquals(lstEvt.size(), 3);
// SRI "MAP only V1 supported" response
DialogReject evt12 = new DialogReject(dlg, MAPRefuseReason.PotentialVersionIncompatibility, null, null);
this.mtSbb.onDialogReject(evt12, null);
dlg = serviceMt.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version1);
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
ForwardShortMessageRequestImpl mtFsmReq = (ForwardShortMessageRequestImpl) evt.event;
assertTrue(mtFsmReq.getMoreMessagesToSend());
SM_RP_DA sm_RP_DA = mtFsmReq.getSM_RP_DA();
IMSI daImsi = sm_RP_DA.getIMSI();
assertEquals(daImsi.getData(), imsiDig);
SM_RP_OA sm_RP_OA = mtFsmReq.getSM_RP_OA();
AddressString scas = sm_RP_OA.getServiceCentreAddressOA();
assertEquals(scas.getAddress(), smscPropertiesManagement.getServiceCenterGt());
SmsSignalInfo ssi = mtFsmReq.getSM_RP_UI();
SmsDeliverTpdu tpdu = (SmsDeliverTpdu) ssi.decodeTpdu(false);
assertEquals(tpdu.getDataCodingScheme().getCode(), 0);
assertFalse(tpdu.getForwardedOrSpawned());
assertTrue(tpdu.getMoreMessagesToSend());
assertEquals(tpdu.getOriginatingAddress().getAddressValue(), origDig);
assertFalse(tpdu.getReplyPathExists());
assertEquals(tpdu.getSmsTpduType(), SmsTpduType.SMS_DELIVER);
assertFalse(tpdu.getStatusReportIndication());
assertTrue(tpdu.getUserDataHeaderIndicator());
UserData ud = tpdu.getUserData();
ud.decode();
UserDataHeader udh = ud.getDecodedUserDataHeader();
ConcatenatedShortMessagesIdentifier csm = udh.getConcatenatedShortMessagesIdentifier();
assertEquals(csm.getReference(), 1);
assertEquals(csm.getMesageSegmentCount(), 2);
assertEquals(csm.getMesageSegmentNumber(), 1);
String msg1 = ud.getDecodedMessage();
assertEquals(msg1, msga1);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
smsId = sms1.getDbId();
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
// Mt response 1
ForwardShortMessageResponseImpl evt2 = new ForwardShortMessageResponseImpl();
evt2.setMAPDialog(dlg);
DialogAccept daevt = new DialogAccept(dlg, null);
this.mtSbb.onDialogAccept(daevt, null);
this.mtSbb.onForwardShortMessageResponse(evt2, null);
DialogClose dcl = new DialogClose(dlg);
this.mtSbb.onDialogClose(dcl, null);
dlg = serviceMt.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version1);
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
mtFsmReq = (ForwardShortMessageRequestImpl) evt.event;
assertFalse(mtFsmReq.getMoreMessagesToSend());
sm_RP_DA = mtFsmReq.getSM_RP_DA();
daImsi = sm_RP_DA.getIMSI();
assertEquals(daImsi.getData(), imsiDig);
sm_RP_OA = mtFsmReq.getSM_RP_OA();
scas = sm_RP_OA.getServiceCentreAddressOA();
assertEquals(scas.getAddress(), smscPropertiesManagement.getServiceCenterGt());
ssi = mtFsmReq.getSM_RP_UI();
tpdu = (SmsDeliverTpdu) ssi.decodeTpdu(false);
assertEquals(tpdu.getDataCodingScheme().getCode(), 0);
assertFalse(tpdu.getForwardedOrSpawned());
assertFalse(tpdu.getMoreMessagesToSend());
assertEquals(tpdu.getOriginatingAddress().getAddressValue(), origDig);
assertFalse(tpdu.getReplyPathExists());
assertEquals(tpdu.getSmsTpduType(), SmsTpduType.SMS_DELIVER);
assertFalse(tpdu.getStatusReportIndication());
assertTrue(tpdu.getUserDataHeaderIndicator());
ud = tpdu.getUserData();
ud.decode();
udh = ud.getDecodedUserDataHeader();
csm = udh.getConcatenatedShortMessagesIdentifier();
assertEquals(csm.getReference(), 1);
assertEquals(csm.getMesageSegmentCount(), 2);
assertEquals(csm.getMesageSegmentNumber(), 2);
String msg2 = ud.getDecodedMessage();
assertEquals(msg2, msga2);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
smsId = sms1.getDbId();
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
// Mt response 2
evt2 = new ForwardShortMessageResponseImpl();
evt2.setMAPDialog(dlg);
daevt = new DialogAccept(dlg, null);
this.mtSbb.onDialogAccept(daevt, null);
this.mtSbb.onForwardShortMessageResponse(evt2, null);
dcl = new DialogClose(dlg);
this.mtSbb.onDialogClose(dcl, null);
dlg = serviceRsds.getLastMAPDialogSms();
assertNull(dlg);
dlg = serviceSri.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
dlg = serviceMt.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
smsId = sms1.getDbId();
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNotNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertNull(smsX);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
}
Aggregations