use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MoSbbTest method testMo1_Gsm7.
@Test(groups = { "Mo" })
public void testMo1_Gsm7() throws Exception {
if (!this.cassandraDbInited)
return;
// this.clearDatabase();
// SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
// this.sbb.setSmppServerSessions(smppServerSessions);
AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
sm_RP_OA.setMsisdn(msisdn);
AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
// 11==60min
ValidityPeriod validityPeriod = new ValidityPeriodImpl(11);
DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(0);
UserDataHeader decodedUserDataHeader = new UserDataHeaderImpl();
UserDataHeaderElement informationElement = new ConcatenatedShortMessagesIdentifierImpl(false, 55, 3, 1);
decodedUserDataHeader.addInformationElement(informationElement);
UserData userData = new UserDataImpl(new String("0123456789"), dataCodingScheme, decodedUserDataHeader, null);
// userData.encode();
// String decodedMessage, DataCodingScheme dataCodingScheme, UserDataHeader decodedUserDataHeader, Charset gsm8Charset
SmsTpdu tpdu = new SmsSubmitTpduImpl(false, true, false, 150, destinationAddress, protocolIdentifier, validityPeriod, userData);
// boolean rejectDuplicates, boolean replyPathExists, boolean statusReportRequest, int messageReference,
// AddressField destinationAddress, ProtocolIdentifier protocolIdentifier, ValidityPeriod validityPeriod, UserData userData
// tpdu.encodeData();
SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(tpdu, null);
MoForwardShortMessageRequest event = new MoForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI, null, null);
// ActivityContextInterface aci = new SmppTransactionProxy(esme);
// Date curDate = new Date();
// this.fillSm(event, curDate, true);
// event.setShortMessage(msg);
long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b1, 0);
assertEquals(b2, 0L);
MAPProviderProxy proxy = new MAPProviderProxy();
MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
event.setMAPDialog(dialog);
Date curDate = new Date();
this.sbb.onMoForwardShortMessageRequest(event, null);
b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
dueSlot = b2;
b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
assertEquals(b1, 1);
assertEquals(b2, dueSlot);
assertEquals(dialog.getResponseCount(), 1);
assertEquals(dialog.getErrorList().size(), 0);
SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
assertEquals(smsSet.getDestAddr(), "5555");
assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
assertEquals(smsSet.getInSystem(), 0);
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getStatus());
assertFalse(smsSet.isAlertingSupported());
Sms sms = smsSet.getSms(0);
assertNotNull(sms);
assertEquals(sms.getSourceAddr(), "4444");
assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
assertEquals(sms.getMoMessageRef(), 150);
assertEquals(sms.getDataCoding(), 0);
assertNull(sms.getOrigEsmeName());
assertNull(sms.getOrigSystemId());
assertNull(sms.getServiceType());
assertEquals(sms.getEsmClass() & 0xFF, 195);
assertEquals(sms.getRegisteredDelivery(), 0);
assertEquals(sms.getProtocolId(), 12);
assertEquals(sms.getPriority(), 0);
assertEquals(sms.getReplaceIfPresent(), 0);
assertEquals(sms.getDefaultMsgId(), 0);
assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
assertNull(sms.getScheduleDeliveryTime());
assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 1));
assertEquals(sms.getDeliveryCount(), 0);
// assertDateEq(smsSet.getDueDate(), new Date(curDate.getTime() + 1 * 60 * 1000));
assertEquals(sms.getShortMessageText(), "0123456789");
assertEquals(sms.getShortMessageBin(), decodedUserDataHeader.getEncodedData());
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MoSbbTest method testMo4_MProc.
@Test(groups = { "Mo" })
public void testMo4_MProc() throws Exception {
if (!this.cassandraDbInited)
return;
MProcManagement mProcManagement = MProcManagement.getInstance();
SmscManagement smscManagement = SmscManagement.getInstance("Test");
SmppManagement smppManagement = SmppManagement.getInstance("Test");
smscManagement.setSmppManagement(smppManagement);
mProcManagement.setSmscManagement(smscManagement);
smscManagement.registerRuleFactory(new MProcRuleFactoryDefault());
smscManagement.start();
try {
mProcManagement.destroyMProcRule(1);
} catch (Exception e) {
}
try {
mProcManagement.destroyMProcRule(2);
} catch (Exception e) {
}
mProcManagement.createMProcRule(1, MProcRuleFactoryDefault.RULE_CLASS_NAME, "desttonmask 1 destnpimask 1 originatingmask SS7_MO networkidmask 0 adddestdigprefix 47 makecopy true");
mProcManagement.createMProcRule(2, MProcRuleFactoryDefault.RULE_CLASS_NAME, "networkidmask 0 newnetworkid 5 newdestton 2 makecopy true");
// TODO: ***** make proper mproc rules testing
// MProcManagement.getInstance().createMProcRule(1, 1, 1, "-1", "SS7_MO", 0, -1, -1, -1, "47", true);
// MProcManagement.getInstance().createMProcRule(2, -1, -1, "-1", null, 0, 5, 2, -1, "-1", true);
// destTonMask, destNpiMask, destDigMask, originatingMask, networkIdMask, newNetworkId, newDestTon, newDestNpi, addDestDigPrefix, makeCopy
// TODO: ***** make proper mproc rules testing
SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
// this.sbb.setSmppServerSessions(smppServerSessions);
AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
sm_RP_OA.setMsisdn(msisdn);
AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(8);
UserData userData = new UserDataImpl(new String("UCS2 USC2 USC2"), dataCodingScheme, null, null);
SmsTpdu tpdu = new SmsSubmitTpduImpl(false, false, false, 150, destinationAddress, protocolIdentifier, null, userData);
SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(tpdu, null);
ForwardShortMessageRequest event = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI, false);
long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b1, 0);
assertEquals(b2, 0L);
MAPProviderProxy proxy = new MAPProviderProxy();
MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
event.setMAPDialog(dialog);
Date curDate = new Date();
MAPApplicationContext act = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
dialog.setApplicationContext(act);
this.sbb.onForwardShortMessageRequest(event, null);
TargetAddress tax1 = new TargetAddress(1, 1, "475555", 0);
TargetAddress tax2 = new TargetAddress(2, 1, "475555", 5);
// int addrTon, int addrNpi, String addr, int networkId
b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
dueSlot = b2;
b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
assertEquals(b1, 1);
assertEquals(b2, dueSlot);
b2 = this.pers.c2_getDueSlotForTargetId(psc, tax1.getTargetId());
long dueSlot2 = b2;
b1 = this.pers.checkSmsExists(dueSlot, tax1.getTargetId());
assertEquals(b1, 1);
assertEquals(b2, dueSlot2);
long dueSlot3 = b2;
b1 = this.pers.checkSmsExists(dueSlot, tax1.getTargetId());
assertEquals(b1, 1);
assertEquals(b2, dueSlot3);
assertEquals(dialog.getResponseCount(), 1);
assertEquals(dialog.getErrorList().size(), 0);
SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
SmsSet smsSet2 = this.pers.c2_getRecordListForTargeId(dueSlot2, tax1.getTargetId());
SmsSet smsSet3 = this.pers.c2_getRecordListForTargeId(dueSlot3, tax2.getTargetId());
assertEquals(smsSet.getDestAddr(), "5555");
assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
assertEquals(smsSet.getNetworkId(), 0);
assertEquals(smsSet2.getDestAddr(), "475555");
assertEquals(smsSet2.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(smsSet2.getDestAddrNpi(), SmppConstants.NPI_E164);
assertEquals(smsSet2.getNetworkId(), 0);
assertEquals(smsSet3.getDestAddr(), "475555");
assertEquals(smsSet3.getDestAddrTon(), SmppConstants.TON_NATIONAL);
assertEquals(smsSet3.getDestAddrNpi(), SmppConstants.NPI_E164);
assertEquals(smsSet3.getNetworkId(), 5);
Sms sms = smsSet.getSms(0);
assertNotNull(sms);
assertEquals(sms.getSourceAddr(), "4444");
assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
assertEquals(sms.getMoMessageRef(), 150);
assertEquals(sms.getDataCoding(), 8);
assertNull(sms.getOrigEsmeName());
assertNull(sms.getOrigSystemId());
assertNull(sms.getServiceType());
assertEquals(sms.getEsmClass() & 0xFF, 3);
assertEquals(sms.getRegisteredDelivery(), 0);
assertEquals(sms.getProtocolId(), 12);
assertEquals(sms.getPriority(), 0);
assertEquals(sms.getReplaceIfPresent(), 0);
assertEquals(sms.getDefaultMsgId(), 0);
assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
assertNull(sms.getScheduleDeliveryTime());
assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
assertEquals(sms.getDeliveryCount(), 0);
assertEquals(sms.getShortMessageText(), "UCS2 USC2 USC2");
assertNull(sms.getShortMessageBin());
sms = smsSet2.getSms(0);
assertNotNull(sms);
assertEquals(sms.getSourceAddr(), "4444");
assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
assertEquals(sms.getMoMessageRef(), 150);
assertEquals(sms.getDataCoding(), 8);
assertNull(sms.getOrigEsmeName());
assertNull(sms.getOrigSystemId());
assertNull(sms.getServiceType());
assertEquals(sms.getEsmClass() & 0xFF, 3);
assertEquals(sms.getRegisteredDelivery(), 0);
assertEquals(sms.getProtocolId(), 12);
assertEquals(sms.getPriority(), 0);
assertEquals(sms.getReplaceIfPresent(), 0);
assertEquals(sms.getDefaultMsgId(), 0);
assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
assertNull(sms.getScheduleDeliveryTime());
assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
assertEquals(sms.getDeliveryCount(), 0);
assertEquals(sms.getShortMessageText(), "UCS2 USC2 USC2");
assertNull(sms.getShortMessageBin());
sms = smsSet3.getSms(0);
assertNotNull(sms);
assertEquals(sms.getSourceAddr(), "4444");
assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
assertEquals(sms.getMoMessageRef(), 150);
assertEquals(sms.getDataCoding(), 8);
assertNull(sms.getOrigEsmeName());
assertNull(sms.getOrigSystemId());
assertNull(sms.getServiceType());
assertEquals(sms.getEsmClass() & 0xFF, 3);
assertEquals(sms.getRegisteredDelivery(), 0);
assertEquals(sms.getProtocolId(), 12);
assertEquals(sms.getPriority(), 0);
assertEquals(sms.getReplaceIfPresent(), 0);
assertEquals(sms.getDefaultMsgId(), 0);
assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
assertNull(sms.getScheduleDeliveryTime());
assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
assertEquals(sms.getDeliveryCount(), 0);
assertEquals(sms.getShortMessageText(), "UCS2 USC2 USC2");
assertNull(sms.getShortMessageBin());
try {
MProcManagement.getInstance().destroyMProcRule(1);
MProcManagement.getInstance().destroyMProcRule(2);
// MProcManagement.getInstance().destroyMProcRule(3);
} catch (Exception e) {
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MoSbbTest method testMo2_Gsm7.
@Test(groups = { "Mo" })
public void testMo2_Gsm7() throws Exception {
if (!this.cassandraDbInited)
return;
// this.clearDatabase();
// SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
// this.sbb.setSmppServerSessions(smppServerSessions);
AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
sm_RP_OA.setMsisdn(msisdn);
AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
// 3 hours: 1 for delay + 2 different timezone
Date valDate = MessageUtil.addHours(new Date(), 3);
int tzo = -valDate.getTimezoneOffset();
AbsoluteTimeStamp absoluteFormatValue = new AbsoluteTimeStampImpl(valDate.getYear(), valDate.getMonth(), valDate.getDate(), valDate.getHours(), valDate.getMinutes(), valDate.getSeconds(), tzo / 15 + 4 * 2);
// int year, int month, int day, int hour, int minute, int second, int timeZone
ValidityPeriod validityPeriod = new ValidityPeriodImpl(absoluteFormatValue);
DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(0);
UserData userData = new UserDataImpl(new String("0123456789"), dataCodingScheme, null, null);
// userData.encode();
// String decodedMessage, DataCodingScheme dataCodingScheme, UserDataHeader decodedUserDataHeader, Charset gsm8Charset
SmsTpdu tpdu = new SmsSubmitTpduImpl(true, true, false, 150, destinationAddress, protocolIdentifier, validityPeriod, userData);
// boolean rejectDuplicates, boolean replyPathExists, boolean statusReportRequest, int messageReference,
// AddressField destinationAddress, ProtocolIdentifier protocolIdentifier, ValidityPeriod validityPeriod, UserData userData
// tpdu.encodeData();
SmsSignalInfo sm_RP_UI = new SmsSignalInfoImpl(tpdu, null);
ForwardShortMessageRequest event = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI, false);
// ActivityContextInterface aci = new SmppTransactionProxy(esme);
// Date curDate = new Date();
// this.fillSm(event, curDate, true);
// event.setShortMessage(msg);
long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
assertEquals(b1, 0);
assertEquals(b2, 0L);
MAPProviderProxy proxy = new MAPProviderProxy();
MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
event.setMAPDialog(dialog);
Date curDate = new Date();
MAPApplicationContext act = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
dialog.setApplicationContext(act);
this.sbb.onForwardShortMessageRequest(event, null);
b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
dueSlot = b2;
b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
assertEquals(b1, 1);
assertEquals(b2, dueSlot);
assertEquals(dialog.getResponseCount(), 1);
assertEquals(dialog.getErrorList().size(), 0);
SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
assertEquals(smsSet.getDestAddr(), "5555");
assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
assertEquals(smsSet.getInSystem(), 0);
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getStatus());
assertFalse(smsSet.isAlertingSupported());
Sms sms = smsSet.getSms(0);
assertNotNull(sms);
assertEquals(sms.getSourceAddr(), "4444");
assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
assertEquals(sms.getMoMessageRef(), 150);
assertEquals(sms.getDataCoding(), 0);
assertNull(sms.getOrigEsmeName());
assertNull(sms.getOrigSystemId());
assertNull(sms.getServiceType());
assertEquals(sms.getEsmClass() & 0xFF, 131);
assertEquals(sms.getRegisteredDelivery(), 0);
assertEquals(sms.getProtocolId(), 12);
assertEquals(sms.getPriority(), 0);
assertEquals(sms.getReplaceIfPresent(), 2);
assertEquals(sms.getDefaultMsgId(), 0);
assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
assertNull(sms.getScheduleDeliveryTime());
assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 1));
assertEquals(sms.getDeliveryCount(), 0);
// assertDateEq(smsSet.getDueDate(), new Date(curDate.getTime() + 1 * 60 * 1000));
// assertEquals(new String(sms.getShortMessage()), "0123456789");
assertEquals(sms.getShortMessageText(), "0123456789");
assertNull(sms.getShortMessageBin());
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtDatabaseCassandraTest method prepareDatabase.
// @Test(groups = { "Mt" })
// public void SuccessDeliveryTest() throws Exception {
//
// if (!this.cassandraDbInited)
// return;
//
// SmsSet smsSet = prepareDatabase();
//
// assertEquals(smsSet.getSmsCount(), 2);
// Sms sms1 = smsSet.getSms(0);
// assertEquals(sms1.getMessageId(), 1);
// Sms sms2 = smsSet.getSms(1);
// assertEquals(sms2.getMessageId(), 2);
// Sms sms3 = smsSet.getSms(2);
// assertNull(sms3);
//
// // fetchSchedulableSms()
// long dueSlot = procDueSot;
// PreparedStatementCollection_C3 psc = this.pers.getStatementCollection(new Date());
// int b1 = this.pers.checkSmsExists(dueSlot, ta1);
// long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
// assertEquals(b1, 2);
// assertEquals(b2, dueSlot);
//
// // startMessageDelivery()
// Sms smsa1 = smsSet.getSms(0);
// Sms smsx1 = pers.obtainLiveSms(procDueSot, sms1.getSmsSet().getTargetId(), sms1.getDbId());
// assertEquals(smsa1.getDeliveryCount(), 0);
// assertEquals(smsx1.getDeliveryCount(), 0);
// this.sbb.startMessageDelivery(smsa1);
// smsx1 = pers.obtainLiveSms(procDueSot, smsa1.getSmsSet().getTargetId(), smsa1.getDbId());
// assertEquals(smsa1.getDeliveryCount(), 1);
// assertEquals(smsx1.getDeliveryCount(), 1);
// // archiveMessageAsDelivered(Sms sms);
// // assertEquals(smsSet.getSmsCount(), 2);
// this.sbb.archiveMessageAsDelivered(smsa1);
// // smsSet.removeFirstSms();
// // assertEquals(smsSet.getSmsCount(), 1);
// smsx1 = pers.obtainLiveSms(sms1.getDbId());
// Sms smsx2 = pers.obtainLiveSms(sms2.getDbId());
// assertNull(smsx1);
// assertEquals(smsx2.getDeliveryCount(), 0);
// SmsProxy smsp1 = pers.obtainArchiveSms(sms1.getDbId());
// SmsProxy smsp2 = pers.obtainArchiveSms(sms2.getDbId());
// assertEquals(smsp1.sms.getDeliveryCount(), 1);
// assertEquals(smsp1.smStatus, 0);
// assertNull(smsp2);
//
// Sms smsa2 = smsSet.getSms(1);
// assertEquals(smsa2.getMessageId(), 2);
// assertNotNull(smsa2);
// this.sbb.startMessageDelivery(smsa2);
// this.sbb.archiveMessageAsDelivered(smsa2);
// // smsSet.removeFirstSms();
// smsx1 = pers.obtainLiveSms(sms1.getDbId());
// smsx2 = pers.obtainLiveSms(sms2.getDbId());
// assertNull(smsx1);
// assertNull(smsx2);
// smsp1 = pers.obtainArchiveSms(sms1.getDbId());
// smsp2 = pers.obtainArchiveSms(sms2.getDbId());
// assertEquals(smsp1.sms.getDeliveryCount(), 1);
// assertEquals(smsp1.smStatus, 0);
// assertEquals(smsp2.sms.getDeliveryCount(), 1);
// assertEquals(smsp2.smStatus, 0);
//
// b1 = pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// this.sbb.freeSmsSetSucceded(smsSet);
// b1 = pers.checkSmsSetExists(ta1);
// assertFalse(b1);
// assertEquals(smsSet.getInSystem(), 0);
// }
//
// @Test(groups = { "Mt" })
// public void FreeSmsSetWhenSmsExistsTest() throws Exception {
//
// if (!this.cassandraDbInited)
// return;
//
// SmsSet smsSet = prepareDatabase();
//
// boolean b1 = pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// SmsSet smsSetX = pers.obtainSmsSet(ta1);
// assertEquals(smsSetX.getInSystem(), 2);
//
// this.sbb.freeSmsSetSucceded(smsSet);
//
// b1 = pers.checkSmsSetExists(ta1);
// assertTrue(b1);
// smsSetX = pers.obtainSmsSet(ta1);
// assertEquals(smsSetX.getInSystem(), 0);
// assertEquals(smsSet.getInSystem(), 0);
// }
//
// @Test(groups = { "Mt" })
// public void FreeSmsSetFailuredTest() throws Exception {
//
// if (!this.cassandraDbInited)
// return;
//
// SmsSet smsSet = prepareDatabase();
// Sms sms1 = smsSet.getSms(0);
// Sms sms2 = smsSet.getSms(1);
//
// Sms sms = smsSet.getSms(0);
// this.sbb.startMessageDelivery(sms);
//
// // this.sbb.freeSmsSetFailured(smsSet, ErrorCode.ABSENT_SUBSCRIBER);
// //
// // boolean b1 = pers.checkSmsSetExists(ta1);
// // assertFalse(b1);
// //
// // Sms smsx1 = pers.obtainLiveSms(sms1.getDbId());
// // Sms smsx2 = pers.obtainLiveSms(sms2.getDbId());
// // assertNull(smsx1);
// // assertNull(smsx2);
// //
// // SmsProxy smsp1 = pers.obtainArchiveSms(sms1.getDbId());
// // SmsProxy smsp2 = pers.obtainArchiveSms(sms2.getDbId());
// //
// // assertEquals(smsp1.sms.getMessageId(), 1);
// // assertEquals(smsp2.sms.getMessageId(), 2);
// // assertEquals(smsp1.sms.getDeliveryCount(), 1);
// // assertEquals(smsp2.sms.getDeliveryCount(), 0);
// // assertEquals(smsp1.smStatus, 8);
// // assertEquals(smsp2.smStatus, 8);
// }
//
// @Test(groups = { "Mt" })
// public void RescheduleSmsSetTest() throws Exception {
//
// if (!this.cassandraDbInited)
// return;
// SmscPropertiesManagement.getInstance("Test");
//
// SmsSet smsSet = prepareDatabase();
// Sms sms1 = smsSet.getSms(0);
// Sms sms2 = smsSet.getSms(1);
//
// Sms sms = smsSet.getSms(0);
// this.sbb.startMessageDelivery(sms);
//
// // this.sbb.rescheduleSmsSet(smsSet, ErrorCode.ABSENT_SUBSCRIBER, true);
// //
// // boolean b1 = pers.checkSmsSetExists(ta1);
// // assertTrue(b1);
// //
// // SmsSet smsSetx = pers.obtainSmsSet(ta1);
// // assertEquals(smsSetx.getInSystem(), 1);
// // assertEquals(smsSetx.getDueDelay(), 300);
// // assertEquals(smsSetx.getStatus().getCode(), 8);
// // assertTrue(smsSetx.isAlertingSupported());
// //
// // this.sbb.rescheduleSmsSet(smsSet, ErrorCode.ABSENT_SUBSCRIBER,
// // false);
// //
// // b1 = pers.checkSmsSetExists(ta1);
// // assertTrue(b1);
// //
// // smsSetx = pers.obtainSmsSet(ta1);
// // assertEquals(smsSetx.getInSystem(), 1);
// // assertEquals(smsSetx.getDueDelay(), 600);
// // assertEquals(smsSetx.getStatus().getCode(), 8);
// // assertFalse(smsSetx.isAlertingSupported());
// }
private SmsSet prepareDatabase() throws PersistenceException {
SmsSet smsSet = createEmptySmsSet(ta1);
Sms sms = this.prepareSms(smsSet, 1);
this.pers.c2_scheduleMessage_ReschedDueSlot(sms, false, true);
sms = this.prepareSms(smsSet, 2);
this.pers.c2_scheduleMessage_ReschedDueSlot(sms, false, true);
procDueSot = sms.getDueSlot();
ArrayList<SmsSet> lst1 = this.pers.c2_getRecordList(sms.getDueSlot());
ArrayList<SmsSet> lst2 = this.pers.c2_sortRecordList(lst1);
SmsSet res = lst2.get(0);
curDate = new Date();
return res;
// SmsSet smsSet = this.pers.obtainSmsSet(ta1);
//
// Sms sms = this.prepareSms(smsSet, 1);
// this.pers.createLiveSms(sms);
// sms = this.prepareSms(smsSet, 2);
// this.pers.createLiveSms(sms);
//
// SmsSet res = this.pers.obtainSmsSet(ta1);
// this.pers.fetchSchedulableSms(res);
// curDate = new Date();
// this.pers.setDeliveryStart(smsSet, curDate);
// return res;
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtDatabaseCassandraTest method createEmptySmsSet.
private SmsSet createEmptySmsSet(TargetAddress ta) {
SmsSet smsSet = new SmsSet();
smsSet.setDestAddr(ta1.getAddr());
smsSet.setDestAddrNpi(ta1.getAddrNpi());
smsSet.setDestAddrTon(ta1.getAddrTon());
return smsSet;
}
Aggregations