use of org.mobicents.smsc.slee.resources.persistence.SmsProxy in project smscgateway by RestComm.
the class MtTest method SuccessError2ATest.
/**
* MAP V3, SRI error absentSubscriber
* Validity period is expired -> no RSDS and next scheduling
* + receiptRequest
*/
@Test(groups = { "Mt" })
public void SuccessError2ATest() 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();
sd1.receiptRequest = true;
lst.add(sd1);
sd1.valididtyPeriodIsOver = true;
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);
assertNull(smsSet.getStatus());
assertEquals(smsSet.getInSystem(), 0);
assertNull(smsSet.getInSystemDate());
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
// now ano message delivery because of a message ValidityPeriod is expired
assertNull(dlg);
// MAPApplicationContextVersion acv = dlg.getApplicationContext().getApplicationContextVersion();
// assertEquals(acv, MAPApplicationContextVersion.version3);
// ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
// assertEquals(lstEvt.size(), 2);
// 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);
//
// assertNull(serviceRsds.getLastMAPDialogSms());
//
// // SRI response
// MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
// ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
// this.sriSbb.onErrorComponent(evt2, null);
// this.sriSbb.onDialogDelimiter(null, null);
//
// PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
// long l1 = 0;
// for (PreparedStatementCollection psc : pscc) {
// l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
// if (l1 != 0)
// break;
// }
// smsId = sms1.getDbId();
// smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
// assertNotNull(smsx1);
// smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
// assertNull(smsSetX);
// smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
// assertNull(smsX);
// assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
//
// for (PreparedStatementCollection psc : pscc) {
// l1 = this.pers.c2_getDueSlotForTargetId(psc, taR.getTargetId());
// if (l1 != 0)
// break;
// }
// // here we are checking of existence of failure receipt
// ArrayList<SmsSet> lst01 = pers.c2_getRecordList(l1);
// assertEquals(lst01.size(), 1);
// SmsSet smsSet2 = lst01.get(0);
// assertEquals(smsSet2.getSmsCount(), 1);
// Sms sms2 = smsSet2.getSms(0);
// UUID idReceipt = sms2.getDbId();
//
// dlg = serviceRsds.getLastMAPDialogSms();
// assertNull(dlg);
}
use of org.mobicents.smsc.slee.resources.persistence.SmsProxy in project smscgateway by RestComm.
the class MtTest method SuccessError3Test.
/**
* MAP V3, SRI error absentSubscriber -> RSDS -> new delivery attempt -> SRI error absentSubscriber -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError3Test() 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);
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);
assertNull(smsSet.getStatus());
assertEquals(smsSet.getInSystem(), 0);
assertNull(smsSet.getInSystemDate());
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
// SRI response
MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
ISDNAddressStringImpl storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
MWStatusImpl mwStatus = new MWStatusImpl(false, true, false, true);
InformServiceCentreRequestImpl evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
evt4.setMAPDialog(dlg);
this.sriSbb.onDialogDelimiter(null, null);
PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
long l1 = 0;
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
assertEquals(smsSet.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getInSystemDate(), curDate);
assertEquals(smsSet.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
dlg = serviceRsds.getLastMAPDialogSms();
// rsds response 2
ReportSMDeliveryStatusResponseImpl evt7 = new ReportSMDeliveryStatusResponseImpl(2, null, null);
evt7.setMAPDialog(dlg);
this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);
DialogClose dcl = new DialogClose(dlg);
this.rsdsSbb.onDialogClose(dcl, null);
// second delivery attempt **********************
ArrayList<SmsSet> lst1 = this.pers.c2_getRecordList(l1);
ArrayList<SmsSet> lst2 = this.pers.c2_sortRecordList(lst1);
smsSet = lst2.get(0);
// initial onSms message
event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.makeDlvIsNotInited();
this.sriSbb.onSms(event, null, null);
dlg = serviceSri.getLastMAPDialogSms();
// SRI response
mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
mwStatus = new MWStatusImpl(false, true, false, true);
evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
evt4.setMAPDialog(dlg);
this.sriSbb.onDialogDelimiter(null, null);
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
assertEquals(smsSet.getDueDelay(), 600);
this.testDateEq(new Date(new Date().getTime() + 600 * 1000), smsSet.getDueDate());
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, taR.getTargetId());
if (l1 != 0)
break;
}
assertEquals(l1, 0);
// we do no test here rsds response 2 - it is the same
}
use of org.mobicents.smsc.slee.resources.persistence.SmsProxy in project smscgateway by RestComm.
the class MtTest method SuccessDeliveryCTest.
/**
* MAP V3, 1 message, 1 segment, GSM7
* urdu alphabit
*/
@Test(groups = { "Mt" })
public void SuccessDeliveryCTest() 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();
sd1.dataCodingScheme = 0;
sd1.nationalAlphabet = 13;
// 0x29, 0x1B, 0x3E
String fullMsg = "(]";
sd1.msg = fullMsg;
lst.add(sd1);
SmsSet smsSet = prepareDatabase(lst);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
assertNotNull(smsSetX);
Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
// 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);
assertNull(serviceMt.getLastMAPDialogSms());
ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNumberingPlan(), org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
assertEquals(((GlobalTitle0100) dlg.getLocalAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNumberingPlan(), org.mobicents.protocols.ss7.indicator.NumberingPlan.ISDN_TELEPHONY);
assertEquals(((GlobalTitle0100) dlg.getRemoteAddress().getGlobalTitle()).getNatureOfAddress(), NatureOfAddress.INTERNATIONAL);
MAPTestEvent evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
assertEquals(sriReq.getMsisdn().getAddressNature(), AddressNature.international_number);
assertEquals(sriReq.getMsisdn().getNumberingPlan(), org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(sriReq.getServiceCentreAddress().getAddressNature(), AddressNature.international_number);
assertEquals(sriReq.getServiceCentreAddress().getNumberingPlan(), org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
assertTrue(sriReq.getSm_RP_PRI());
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
assertNotNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
// 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, null);
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();
assertEquals(lstEvt.size(), 2);
dlg = serviceMt.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
MtForwardShortMessageRequestImpl mtFsmReq = (MtForwardShortMessageRequestImpl) evt.event;
assertFalse(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());
assertEquals(scas.getAddressNature(), AddressNature.international_number);
assertEquals(scas.getNumberingPlan(), org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan.ISDN);
SmsSignalInfo ssi = mtFsmReq.getSM_RP_UI();
SmsDeliverTpdu tpdu = (SmsDeliverTpdu) ssi.decodeTpdu(false);
assertEquals(tpdu.getDataCodingScheme().getCode(), 0);
assertFalse(tpdu.getForwardedOrSpawned());
assertFalse(tpdu.getMoreMessagesToSend());
assertEquals(tpdu.getOriginatingAddress().getAddressValue(), origDig);
assertEquals(tpdu.getOriginatingAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
assertEquals(tpdu.getOriginatingAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
assertEquals(tpdu.getProtocolIdentifier().getCode(), 7);
assertFalse(tpdu.getReplyPathExists());
assertEquals(tpdu.getServiceCentreTimeStamp().getDay(), curDate.getDate());
// assertEquals(tpdu.getServiceCentreTimeStamp().getMinute(), curDate.getMinutes());
int mon1 = tpdu.getServiceCentreTimeStamp().getMonth();
int mon2 = curDate.getMonth() + 1;
assertEquals(mon1, mon2);
assertEquals(tpdu.getSmsTpduType(), SmsTpduType.SMS_DELIVER);
assertFalse(tpdu.getStatusReportIndication());
assertTrue(tpdu.getUserDataHeaderIndicator());
UserData ud = tpdu.getUserData();
ud.decode();
// assertNull(ud.getDecodedUserDataHeader());
String msg1 = ud.getDecodedMessage();
assertEquals(msg1, fullMsg);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
assertNotNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
UUID smsId = smsSet.getSms(0).getDbId();
SmsProxy smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx2);
// Mt response
MtForwardShortMessageResponseImpl evt2 = new MtForwardShortMessageResponseImpl(null, null);
evt2.setMAPDialog(dlg);
DialogAccept daevt = new DialogAccept(dlg, null);
this.mtSbb.onDialogAccept(daevt, null);
this.mtSbb.onMtForwardShortMessageResponse(evt2, null);
DialogClose dcl = new DialogClose(dlg);
this.mtSbb.onDialogClose(dcl, null);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId());
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertNull(smsX);
dlg = serviceSri.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
dlg = serviceMt.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
int b1 = this.pers.checkSmsExists(procDueSlot, smsSet.getTargetId());
smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNotNull(smsx2);
dlg = serviceRsds.getLastMAPDialogSms();
assertNull(dlg);
}
use of org.mobicents.smsc.slee.resources.persistence.SmsProxy in project smscgateway by RestComm.
the class MtTest method onDeliveryErrorTest.
/**
* onDeliveryError test
*/
@Test(groups = { "Mt" })
public void onDeliveryErrorTest() 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();
sd1.valididtyPeriodIsOver = true;
sd1.msg = "a1";
lst.add(sd1);
SmsDef sd2 = new SmsDef();
sd2.valididtyPeriodIsOver = true;
sd2.msg = "a2";
lst.add(sd2);
SmsDef sd3 = new SmsDef();
sd3.msg = "b1";
lst.add(sd3);
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
Sms sms2 = smsSet.getSms(1);
Sms sms3 = smsSet.getSms(2);
UUID smsId1 = sms1.getDbId();
UUID smsId2 = sms2.getDbId();
UUID smsId3 = sms3.getDbId();
SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId1);
SmsProxy smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId2);
SmsProxy smsx3 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId3);
assertNull(smsx1);
assertNull(smsx2);
assertNull(smsx3);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[1]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[2]);
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);
this.mtSbb.setTargetId(smsSet.getTargetId());
// SmsSet smsSet, ErrorAction errorAction, ErrorCode smStatus, String reason, boolean removeSmsSet
this.sriSbb.onDeliveryError(smsSet, ErrorAction.subscriberBusy, ErrorCode.ABSENT_SUBSCRIBER, "X error", true, null, false, ProcessingType.SS7_MT);
PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
long l1 = 0;
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId1);
smsx2 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId2);
smsx3 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId3);
assertNotNull(smsx1);
assertNotNull(smsx2);
assertNull(smsx3);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertNull(smsX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[1]);
assertNull(smsX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[2]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
}
use of org.mobicents.smsc.slee.resources.persistence.SmsProxy in project smscgateway by RestComm.
the class MtTest method SuccessError1Test.
/**
* MAP V3, SRI error absentSubscriber + ISC -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError1Test() 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);
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);
assertNull(smsSet.getStatus());
assertEquals(smsSet.getInSystem(), 0);
assertNull(smsSet.getInSystemDate());
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
// SmsSet smsSet2 = pers.obtainSmsSet(ta1);
SmsSet smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.SUCCESS);
assertEquals(smsSet2.getInSystem(), 0);
// this.testDateEq(smsSet2.getInSystemDate(), curDate);
assertEquals(smsSet2.getDueDelay(), 0);
assertNull(smsSet2.getDueDate());
assertFalse(smsSet2.isAlertingSupported());
// 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());
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);
assertNull(serviceRsds.getLastMAPDialogSms());
// SRI response
MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
ISDNAddressStringImpl storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
MWStatusImpl mwStatus = new MWStatusImpl(false, true, false, true);
InformServiceCentreRequestImpl evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
evt4.setMAPDialog(dlg);
this.sriSbb.onInformServiceCentreRequest(evt4, null);
this.sriSbb.onDialogDelimiter(null, null);
PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
long l1 = 0;
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
assertEquals(smsSet2.getInSystem(), 0);
// this.testDateEq(smsSet2.getInSystemDate(), curDate);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet2.getDueDate());
assertFalse(smsSet2.isAlertingSupported());
smsId = sms1.getDbId();
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertNull(smsX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertNotNull(smsX);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
dlg = serviceRsds.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
ReportSMDeliveryStatusRequestImpl rsdsReq = (ReportSMDeliveryStatusRequestImpl) evt.event;
assertEquals(rsdsReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(rsdsReq.getMsisdn().getAddress(), msdnDig);
assertEquals(rsdsReq.getSMDeliveryOutcome(), SMDeliveryOutcome.absentSubscriber);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
// rsds response 2
ReportSMDeliveryStatusResponseImpl evt7 = new ReportSMDeliveryStatusResponseImpl(2, null, null);
evt7.setMAPDialog(dlg);
this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);
DialogClose dcl = new DialogClose(dlg);
this.rsdsSbb.onDialogClose(dcl, null);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
assertEquals(smsSet2.getInSystem(), 0);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// TODO: alertingSupport field is not now filled (It can be filled in: this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);)
// assertTrue(smsSet2.isAlertingSupported());
// TODO: ???? .........
// boolean b1 = this.pers.checkSmsSetExists(taR);
// TODO: ???? .........
// assertFalse(b1);
}
Aggregations