use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.
the class AutodecodingTest method autodecodingTest_B.
@Test
public void autodecodingTest_B() throws Exception {
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance("AutodecodingTest");
smscPropertiesManagement.setHttpDefaultSourceNpi(-2);
smscPropertiesManagement.setHttpDefaultSourceTon(-2);
byte[] udh = { 0x06, 0x05, 0x04, 0x13, 0x01, 0x13, 0x01 };
String udhStr = new String(udh, "iso-8859-1");
// alphanumerical
HttpUsersManagement httpUsersManagement = HttpUsersManagement.getInstance("AutodecodingTest");
try {
httpUsersManagement.destroyHttpUser("userId");
} catch (Exception e) {
}
httpUsersManagement.createHttpUser("userId", "password", 0);
HttpSendMessageIncomingData idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "wwwwww", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, "");
assertEquals(idata.getSender(), "wwwwww");
assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.ALFANUMERIC);
assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.UNKNOWN);
assertEquals(idata.getUdh(), null);
// international
idata = new HttpSendMessageIncomingData("userId", "password", "msg", null, null, null, "33334444", null, null, new String[] { "6666" }, smscPropertiesManagement, httpUsersManagement, udhStr);
assertEquals(idata.getSender(), "33334444");
assertEquals(idata.getSenderTon(), org.mobicents.smsc.slee.services.http.server.tx.enums.TON.INTERNATIONAL);
assertEquals(idata.getSenderNpi(), org.mobicents.smsc.slee.services.http.server.tx.enums.NPI.ISDN);
assertEquals(idata.udhToString(idata.getUdh()), "06 05 04 13 01 13 01 ");
}
use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.
the class DeliveryCommonSbbTest method tearDownClass.
@AfterMethod
public void tearDownClass() throws Exception {
System.out.println("tearDownClass");
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
if (smscPropertiesManagement != null) {
smscPropertiesManagement.setGenerateArchiveTable(new GenerateType(7));
smscPropertiesManagement.setGenerateCdr(new GenerateType(7));
smscPropertiesManagement.setVpProlong(120);
}
}
use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.
the class DeliveryCommonSbbTest method setUpClass.
@BeforeMethod
public void setUpClass() throws Exception {
System.out.println("setUpClass");
this.pers = new PersistenceRAInterfaceProxy();
this.cassandraDbInited = this.pers.testCassandraAccess();
if (!this.cassandraDbInited)
return;
this.pers.start();
MProcManagement.getInstance("TestDeliveryCommonSbb");
SmscPropertiesManagement.getInstance("TestDeliveryCommonSbb");
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
smscPropertiesManagement.setGenerateArchiveTable(new GenerateType(0));
smscPropertiesManagement.setGenerateCdr(new GenerateType(0));
// 15 min
smscPropertiesManagement.setVpProlong(15 * 60);
}
use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.
the class MtTest method SuccessError1ATest.
/**
* MAP V3, SRI error absentSubscriber + ISC -> RSDS
* *** ForwardAndStore mode
*/
@Test(groups = { "Mt" })
public void SuccessError1ATest() 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");
smscPropertiesManagement.setStoreAndForwordMode(StoreAndForwordMode.fast);
ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
SmsDef sd1 = new SmsDef();
sd1.stored = false;
sd1.storingAfterFailure = true;
lst.add(sd1);
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
pers.c2_checkProcessingSmsSet(smsSet);
UUID smsId = sms1.getDbId();
SmsProxy smsx1;
// smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// assertNull(smsx1);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
Sms smsX = sms1;
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();
assertNull(smsSet2.getStatus());
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);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
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);
// assertFalse(b1);
// TODO: ???? .........
smscPropertiesManagement.setStoreAndForwordMode(StoreAndForwordMode.normal);
}
use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.
the class MtTest method SuccessError4Test.
/**
* MAP V3, Mt error no memory -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError4Test() 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();
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
IMSI imsi = new IMSIImpl(imsiDig);
ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.restcomm.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, null);
evt1.setMAPDialog(dlg);
this.sriSbb.onSendRoutingInfoForSMResponse(evt1, null);
this.sriSbb.onDialogDelimiter(null, null);
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);
dlg = serviceMt.getLastMAPDialogSms();
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
// MT response - error
MAPErrorMessage mapErrorMessage = new MAPErrorMessageSMDeliveryFailureImpl(3, SMEnumeratedDeliveryFailureCause.memoryCapacityExceeded, null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.mtSbb.onErrorComponent(evt2, null);
this.mtSbb.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.MESSAGE_QUEUE_FULL);
// 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());
SmsSet smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.MESSAGE_QUEUE_FULL);
// assertEquals(smsSet2.getInSystem(), 1);
// 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());
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.memoryCapacityExceeded);
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);
// assertTrue(smsSet.isAlertingSupported());
}
Aggregations