Search in sources :

Example 21 with SmscPropertiesManagement

use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.

the class AutodecodingTest method autodecodingTest_A.

@Test
public void autodecodingTest_A() throws Exception {
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance("AutodecodingTest");
    smscPropertiesManagement.setHttpDefaultSourceNpi(-1);
    smscPropertiesManagement.setHttpDefaultSourceTon(-1);
    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, "");
    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);
    // national
    idata = new HttpSendMessageIncomingData("userId", "password", "www", 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.NATIONAL);
    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 ");
}
Also used : HttpSendMessageIncomingData(org.mobicents.smsc.slee.services.http.server.tx.data.HttpSendMessageIncomingData) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) HttpUsersManagement(org.mobicents.smsc.domain.HttpUsersManagement) Test(org.testng.annotations.Test)

Example 22 with SmscPropertiesManagement

use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.

the class SchedulerResourceAdaptor method fetchSchedulable.

protected OneWaySmsSetCollection fetchSchedulable(int maxRecordCount) throws PersistenceException {
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
    // if (smscPropertiesManagement.getDatabaseType() == DatabaseType.Cassandra_1) {
    // List<SmsSet> res0 = dbOperations_C1.fetchSchedulableSmsSets(maxRecordCount, this.tracer);
    // OneWaySmsSetCollection res = new OneWaySmsSetCollection();
    // res.setListSmsSet(res0);
    // return res;
    // } else {
    long processedDueSlot = dbOperations_C2.c2_getCurrentDueSlot();
    long possibleDueSlot = dbOperations_C2.c2_getIntimeDueSlot();
    if (processedDueSlot >= possibleDueSlot) {
        return new OneWaySmsSetCollection();
    }
    processedDueSlot++;
    if (!dbOperations_C2.c2_checkDueSlotNotWriting(processedDueSlot)) {
        return new OneWaySmsSetCollection();
    }
    ArrayList<SmsSet> lstS = dbOperations_C2.c2_getRecordList(processedDueSlot);
    ArrayList<SmsSet> lst = dbOperations_C2.c2_sortRecordList(lstS);
    OneWaySmsSetCollection res = new OneWaySmsSetCollection();
    res.setListSmsSet(lst);
    dbOperations_C2.c2_setCurrentDueSlot(processedDueSlot);
    return res;
// }
}
Also used : SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) SmsSet(org.mobicents.smsc.library.SmsSet)

Example 23 with SmscPropertiesManagement

use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.

the class MtTest method setUpMethod.

@BeforeMethod
public void setUpMethod() throws Exception {
    System.out.println("setUpMethod");
    SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance("Test");
    smscPropertiesManagement.setServiceCenterGt("1111");
    smscPropertiesManagement.setServiceCenterSsn(8);
    smscPropertiesManagement.setHlrSsn(6);
    smscPropertiesManagement.setMscSsn(8);
    MapVersionCache mvc = MapVersionCache.getInstance("test");
    mvc.forceClear();
    this.pers = new PersistenceRAInterfaceProxy();
    this.cassandraDbInited = this.pers.testCassandraAccess();
    if (!this.cassandraDbInited)
        return;
    this.pers.start();
    this.mtSbb = new MtSbbProxy(this.pers);
    this.rsdsSbb = new RsdsSbbProxy(this.pers);
    this.sriSbb = new SriSbbProxy(this.pers, this.mtSbb, this.rsdsSbb);
    this.mtSbb.setSriSbbProxy(this.sriSbb);
    this.mtSbb.setRsdsSbbProxy(rsdsSbb);
    SmsSetCache.getInstance().clearProcessingSmsSet();
    SmscPropertiesManagement.getInstance().setSmscStopped(false);
    SmscPropertiesManagement.getInstance().setStoreAndForwordMode(StoreAndForwordMode.normal);
}
Also used : MapVersionCache(org.mobicents.smsc.domain.MapVersionCache) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) PersistenceRAInterfaceProxy(org.mobicents.smsc.slee.resources.persistence.PersistenceRAInterfaceProxy) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 24 with SmscPropertiesManagement

use of org.mobicents.smsc.domain.SmscPropertiesManagement 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);
}
Also used : SmsDeliverTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsDeliverTpdu) SendRoutingInfoForSMRequest(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMRequest) LocationInfoWithLMSI(org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) DialogReject(org.mobicents.slee.resource.map.events.DialogReject) IMSIImpl(org.mobicents.protocols.ss7.map.primitives.IMSIImpl) UserData(org.mobicents.protocols.ss7.map.api.smstpdu.UserData) ArrayList(java.util.ArrayList) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) SM_RP_OA(org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) DataCodingSchemeImpl(org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) SendRoutingInfoForSMResponse(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) MAPApplicationContextVersion(org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion) SendRoutingInfoForSMResponseImpl(org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) DialogAccept(org.mobicents.slee.resource.map.events.DialogAccept) SmsSignalInfo(org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) IMSI(org.mobicents.protocols.ss7.map.api.primitives.IMSI) UUID(java.util.UUID) UserDataHeader(org.mobicents.protocols.ss7.map.api.smstpdu.UserDataHeader) MtForwardShortMessageRequestImpl(org.mobicents.protocols.ss7.map.service.sms.MtForwardShortMessageRequestImpl) ForwardShortMessageRequestImpl(org.mobicents.protocols.ss7.map.service.sms.ForwardShortMessageRequestImpl) ConcatenatedShortMessagesIdentifier(org.mobicents.protocols.ss7.map.api.smstpdu.ConcatenatedShortMessagesIdentifier) ForwardShortMessageResponseImpl(org.mobicents.protocols.ss7.map.service.sms.ForwardShortMessageResponseImpl) MtForwardShortMessageResponseImpl(org.mobicents.protocols.ss7.map.service.sms.MtForwardShortMessageResponseImpl) LocationInfoWithLMSIImpl(org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) MAPTestEvent(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) DialogClose(org.mobicents.slee.resource.map.events.DialogClose) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) Sms(org.mobicents.smsc.library.Sms) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA) Test(org.testng.annotations.Test)

Example 25 with SmscPropertiesManagement

use of org.mobicents.smsc.domain.SmscPropertiesManagement in project smscgateway by RestComm.

the class MtTest method MapVersionNegotiationTest.

/**
 * MAP V3 -> MAP V3 -> MAP V1 (Reject - Alternative ANC)
 */
@Test(groups = { "Mt" })
public void MapVersionNegotiationTest() 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);
    // initial onSms message
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    this.sriSbb.onSms(event, null, null);
    MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    // 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);
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    dlg = serviceMt.getLastMAPDialogSms();
    MAPApplicationContextVersion vers = dlg.getApplicationContext().getApplicationContextVersion();
    assertEquals(vers, MAPApplicationContextVersion.version3);
    ApplicationContextNameImpl acn = new ApplicationContextNameImpl();
    acn.setOid(new long[] { 0, 4, 0, 0, 1, 0, 25, 2 });
    DialogReject evt5 = new DialogReject(dlg, MAPRefuseReason.ApplicationContextNotSupported, acn, null);
    this.mtSbb.onDialogReject(evt5, null);
    assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    dlg = serviceMt.getLastMAPDialogSms();
    vers = dlg.getApplicationContext().getApplicationContextVersion();
    assertEquals(vers, MAPApplicationContextVersion.version2);
    acn = new ApplicationContextNameImpl();
    acn.setOid(new long[] { 0, 4, 0, 0, 1, 0, 25, 2 });
    evt5 = new DialogReject(dlg, MAPRefuseReason.ApplicationContextNotSupported, acn, null);
    this.mtSbb.onDialogReject(evt5, null);
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
    assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
    assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
    dlg = serviceMt.getLastMAPDialogSms();
    vers = dlg.getApplicationContext().getApplicationContextVersion();
    assertEquals(vers, MAPApplicationContextVersion.version1);
}
Also used : LocationInfoWithLMSI(org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) IMSIImpl(org.mobicents.protocols.ss7.map.primitives.IMSIImpl) DialogReject(org.mobicents.slee.resource.map.events.DialogReject) ArrayList(java.util.ArrayList) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) LocationInfoWithLMSIImpl(org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl) SendRoutingInfoForSMResponse(org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse) MAPApplicationContextVersion(org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion) SendRoutingInfoForSMResponseImpl(org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl) SmscPropertiesManagement(org.mobicents.smsc.domain.SmscPropertiesManagement) SmsProxy(org.mobicents.smsc.slee.resources.persistence.SmsProxy) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) Sms(org.mobicents.smsc.library.Sms) IMSI(org.mobicents.protocols.ss7.map.api.primitives.IMSI) ApplicationContextNameImpl(org.mobicents.protocols.ss7.tcap.asn.ApplicationContextNameImpl) UUID(java.util.UUID) SmsSet(org.mobicents.smsc.library.SmsSet) Test(org.testng.annotations.Test)

Aggregations

SmscPropertiesManagement (org.mobicents.smsc.domain.SmscPropertiesManagement)36 Test (org.testng.annotations.Test)27 SmsSet (org.mobicents.smsc.library.SmsSet)25 ArrayList (java.util.ArrayList)23 Sms (org.mobicents.smsc.library.Sms)23 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)22 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)22 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)22 UUID (java.util.UUID)20 SmsProxy (org.mobicents.smsc.slee.resources.persistence.SmsProxy)20 ISDNAddressStringImpl (org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl)19 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)17 MAPApplicationContextVersion (org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion)16 IMSI (org.mobicents.protocols.ss7.map.api.primitives.IMSI)16 LocationInfoWithLMSI (org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)16 SendRoutingInfoForSMResponse (org.mobicents.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)16 IMSIImpl (org.mobicents.protocols.ss7.map.primitives.IMSIImpl)16 LocationInfoWithLMSIImpl (org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)16 SendRoutingInfoForSMResponseImpl (org.mobicents.protocols.ss7.map.service.sms.SendRoutingInfoForSMResponseImpl)16 MAPTestEvent (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy.MAPTestEvent)15