Search in sources :

Example 1 with PreparedStatementCollection

use of org.mobicents.smsc.cassandra.PreparedStatementCollection in project smscgateway by RestComm.

the class TxSmppServerSbbTest method testUSim.

@Test(groups = { "TxSmppServer" })
public void testUSim() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.smppSess = new SmppSessionsProxy();
    this.sbb.setSmppServerSessions(smppSess);
    int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
    long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
    long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
    long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
    long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
    long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
    Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    SubmitSm event = new SubmitSm();
    Date curDate = new Date();
    this.fillSm(event, curDate, true);
    event.setDataCoding((byte) 246);
    event.setEsmClass((byte) 0x43);
    event.setShortMessage(msgUSim);
    long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
    PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Unicode);
    this.sbb.onSubmitSm(event, aci);
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
// SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
// this.checkSmsSet(smsSet, curDate, true);
// Sms sms = smsSet.getSms(0);
// assertEquals(sms.getShortMessageText(), sMsg); // msgUcs2
// assertEquals(sms.getShortMessageBin(), udhCode);
// 
// assertEquals(this.smppSess.getReqList().size(), 0);
// assertEquals(this.smppSess.getRespList().size(), 1);
// 
// PduResponse resp = this.smppSess.getRespList().get(0);
// assertEquals(resp.getCommandStatus(), 0);
// assertEquals(resp.getOptionalParameterCount(), 0);
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) SubmitSm(com.cloudhopper.smpp.pdu.SubmitSm) Esme(org.restcomm.smpp.Esme) SmppSessionsProxy(org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Test(org.testng.annotations.Test)

Example 2 with PreparedStatementCollection

use of org.mobicents.smsc.cassandra.PreparedStatementCollection in project smscgateway by RestComm.

the class TxSmppServerSbbTest method testDataSm.

@Test(groups = { "TxSmppServer" })
public void testDataSm() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.smppSess = new SmppSessionsProxy();
    this.sbb.setSmppServerSessions(smppSess);
    int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
    long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
    long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
    long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
    long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
    long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
    Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    DataSm event = new DataSm();
    Date curDate = new Date();
    this.fillSm(event, curDate, false);
    Tlv tlv = new Tlv(SmppConstants.TAG_MESSAGE_PAYLOAD, msgUtf8);
    event.addOptionalParameter(tlv);
    tlv = new Tlv(SmppConstants.TAG_SAR_MSG_REF_NUM, msg_ref_num);
    event.addOptionalParameter(tlv);
    tlv = new Tlv(SmppConstants.TAG_SAR_SEGMENT_SEQNUM, new byte[] { 1 });
    event.addOptionalParameter(tlv);
    tlv = new Tlv(SmppConstants.TAG_SAR_TOTAL_SEGMENTS, new byte[] { 2 });
    event.addOptionalParameter(tlv);
    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);
    TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Utf8);
    this.sbb.onDataSm(event, aci);
    b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    dueSlot = b2;
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
    assertEquals(b2, dueSlot);
    SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
    this.checkSmsSet(smsSet, curDate, false);
    Sms sms = smsSet.getSms(0);
    // msgUcs2
    assertEquals(sms.getShortMessageText(), sMsg);
    assertEquals(this.smppSess.getReqList().size(), 0);
    assertEquals(this.smppSess.getRespList().size(), 1);
    PduResponse resp = this.smppSess.getRespList().get(0);
    assertEquals(resp.getCommandStatus(), 0);
    assertEquals(resp.getOptionalParameterCount(), 0);
}
Also used : PduResponse(com.cloudhopper.smpp.pdu.PduResponse) ActivityContextInterface(javax.slee.ActivityContextInterface) Esme(org.restcomm.smpp.Esme) SmppSessionsProxy(org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) DataSm(com.cloudhopper.smpp.pdu.DataSm) Sms(org.mobicents.smsc.library.Sms) SmsSet(org.mobicents.smsc.library.SmsSet) Tlv(com.cloudhopper.smpp.tlv.Tlv) Test(org.testng.annotations.Test)

Example 3 with PreparedStatementCollection

use of org.mobicents.smsc.cassandra.PreparedStatementCollection in project smscgateway by RestComm.

the class TxSmppServerSbbTest method getStoredRecord.

// @Test(groups = { "TxSmppServer" })
// public void testXXX() throws Exception {
// 
// if (!this.cassandraDbInited)
// return;
// 
// this.smppSess = new SmppSessionsProxy();
// this.sbb.setSmppServerSessions(smppSess);
// 
// int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
// long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
// long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
// long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
// long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
// long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
// 
// Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null,
// SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT,
// windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout,
// "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, -1, -1);
// ActivityContextInterface aci = new SmppTransactionProxy(esme);
// 
// TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForGsm7(SmppEncoding.Gsm7);
// 
// 
// // ..................................
// byte[] bbb = new byte[] { 0x69, 0x64, 0x3A, 0x34, 0x32, 0x31, 0x39, 0x34, 0x30, 0x38, 0x33, 0x31, 0x34, 0x20, 0x73,
// 0x75, 0x62, 0x3A, 0x30, 0x30, 0x31, 0x20, 0x64, 0x6C, 0x76, 0x72, 0x64, 0x3A, 0x30, 0x30, 0x31, 0x20, 0x73,
// 0x75, 0x62, 0x6D, 0x69, 0x74, 0x20, 0x64, 0x61, 0x74, 0x65, 0x3A, 0x31, 0x37, 0x30, 0x31, 0x31, 0x30, 0x32,
// 0x33, 0x35, 0x34, 0x20, 0x64, 0x6F, 0x6E, 0x65, 0x20, 0x64, 0x61, 0x74, 0x65, 0x3A, 0x31, 0x37, 0x30, 0x31,
// 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x20, 0x73, 0x74, 0x61, 0x74, 0x3A, 0x44, 0x45, 0x4C, 0x49, 0x56, 0x52,
// 0x44, 0x20, 0x65, 0x72, 0x72, 0x3A, 0x30, 0x30, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74, 0x3A, 0x05, 0x00, 0x03,
// 0x2D, 0x04, 0x01, 0x6B, 0x61, (byte) 0x8F, (byte) 0xCE, 0x60, (byte) 0xA8, 0x52, (byte) 0xA0, 0x51, 0x65, 0x6A,
// 0x02, 0x51, 0x52 };
// 
// 
// SubmitSm event = new SubmitSm();
// Date curDate = new Date();
// this.fillSm(event, curDate, true);
// 
// event.setShortMessage(bbb);
// event.setDataCoding((byte) 0);
// event.setEsmClass((byte) 4);
// 
// long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
// PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
// int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
// long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
// assertEquals(b1, 0);
// assertEquals(b2, 0L);
// 
// this.sbb.onSubmitSm(event, aci);
// 
// b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
// assertEquals(b1, 1);
// 
// SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
// //        this.checkSmsSet(smsSet, curDate, true);
// Sms sms = smsSet.getSms(0);
// assertEquals(sms.getShortMessageText(), sMsg_4); // msgGsm7
// assertNull(sms.getShortMessageBin());
// 
// assertEquals(this.smppSess.getReqList().size(), 0);
// assertEquals(this.smppSess.getRespList().size(), 1);
// 
// PduResponse resp = this.smppSess.getRespList().get(0);
// assertEquals(resp.getCommandStatus(), 0);
// assertEquals(resp.getOptionalParameterCount(), 0);
// }
private long getStoredRecord() throws PersistenceException {
    long dueSlot;
    if (scheduleDeliveryTime != null) {
        dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
    } else {
        dueSlot = this.pers.c2_getDueSlotForTime(new Date());
    }
    PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
    dueSlot = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    return dueSlot;
}
Also used : Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection)

Example 4 with PreparedStatementCollection

use of org.mobicents.smsc.cassandra.PreparedStatementCollection in project smscgateway by RestComm.

the class TxSmppServerSbbTest method testSubmitSm_Gsm7Enc.

@Test(groups = { "TxSmppServer" })
public void testSubmitSm_Gsm7Enc() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.smppSess = new SmppSessionsProxy();
    this.sbb.setSmppServerSessions(smppSess);
    int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
    long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
    long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
    long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
    long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
    long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
    Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    SubmitSm event = new SubmitSm();
    Date curDate = new Date();
    this.fillSm(event, curDate, true);
    event.setShortMessage(msgGsm7);
    event.setDataCoding((byte) 0);
    event.setEsmClass((byte) 3);
    // byte[] bbb = new byte[25500];
    // bbb[0] = 6;
    // bbb[1] = 36;
    // bbb[2] = 1;
    // bbb[3] = 13;
    // bbb[4] = 37;
    // bbb[5] = 1;
    // bbb[6] = 13;
    // for (int i = 7; i < 25500; i++) {
    // bbb[i] = 0x41;
    // }
    // event.setShortMessage(null);
    // Tlv tlv = new Tlv(SmppConstants.TAG_MESSAGE_PAYLOAD, bbb);
    // event.addOptionalParameter(tlv);
    // TxSmppServerSbb.smscPropertiesManagement.setNationalLanguageLockingShift(13);
    // TxSmppServerSbb.smscPropertiesManagement.setNationalLanguageSingleShift(13);
    // event.setEsmClass((byte) 67);
    long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
    PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForGsm7(SmppEncoding.Gsm7);
    this.sbb.onSubmitSm(event, aci);
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
    SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
    // this.checkSmsSet(smsSet, curDate, true);
    Sms sms = smsSet.getSms(0);
    // msgGsm7
    assertEquals(sms.getShortMessageText(), sMsg_4);
    assertNull(sms.getShortMessageBin());
    assertEquals(this.smppSess.getReqList().size(), 0);
    assertEquals(this.smppSess.getRespList().size(), 1);
    PduResponse resp = this.smppSess.getRespList().get(0);
    assertEquals(resp.getCommandStatus(), 0);
    assertEquals(resp.getOptionalParameterCount(), 0);
}
Also used : PduResponse(com.cloudhopper.smpp.pdu.PduResponse) ActivityContextInterface(javax.slee.ActivityContextInterface) SubmitSm(com.cloudhopper.smpp.pdu.SubmitSm) Esme(org.restcomm.smpp.Esme) Sms(org.mobicents.smsc.library.Sms) SmppSessionsProxy(org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) SmsSet(org.mobicents.smsc.library.SmsSet) Test(org.testng.annotations.Test)

Example 5 with PreparedStatementCollection

use of org.mobicents.smsc.cassandra.PreparedStatementCollection in project smscgateway by RestComm.

the class TxSmppServerSbbTest method testUcs2Udh.

@Test(groups = { "TxSmppServer" })
public void testUcs2Udh() throws Exception {
    if (!this.cassandraDbInited)
        return;
    this.smppSess = new SmppSessionsProxy();
    this.sbb.setSmppServerSessions(smppSess);
    int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE;
    long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT;
    long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT;
    long clientBindTimeout = SmppConstants.DEFAULT_BIND_TIMEOUT;
    long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL;
    long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT;
    Esme esme = new Esme("Esme_1", "Esme_systemId_1", "pwd", "host", 0, false, null, SmppInterfaceVersionType.SMPP34, -1, -1, null, SmppBindType.TRANSCEIVER, SmppSession.Type.CLIENT, windowSize, connectTimeout, requestExpiryTimeout, clientBindTimeout, windowMonitorInterval, windowWaitTimeout, "Esme_1", true, 30000, 0, 0, -1, -1, "^[0-9a-zA-Z]*", -1, -1, "^[0-9a-zA-Z]*", 0, false, 0, 0, 0, 0, -1, -1, 0, -1, -1, -1, -1);
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    SubmitSm event = new SubmitSm();
    Date curDate = new Date();
    this.fillSm(event, curDate, true);
    event.setDataCoding((byte) 8);
    event.setEsmClass((byte) 0x40);
    event.setShortMessage(msgUcs2Udh);
    long dueSlot = this.pers.c2_getDueSlotForTime(scheduleDeliveryTime);
    PreparedStatementCollection psc = this.pers.getStatementCollection(scheduleDeliveryTime);
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    TxSmppServerSbb.smscPropertiesManagement.setSmppEncodingForUCS2(SmppEncoding.Unicode);
    this.sbb.onSubmitSm(event, aci);
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
// SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
// this.checkSmsSet(smsSet, curDate, true);
// Sms sms = smsSet.getSms(0);
// assertEquals(sms.getShortMessageText(), sMsg); // msgUcs2
// assertEquals(sms.getShortMessageBin(), udhCode);
// 
// assertEquals(this.smppSess.getReqList().size(), 0);
// assertEquals(this.smppSess.getRespList().size(), 1);
// 
// PduResponse resp = this.smppSess.getRespList().get(0);
// assertEquals(resp.getCommandStatus(), 0);
// assertEquals(resp.getOptionalParameterCount(), 0);
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) SubmitSm(com.cloudhopper.smpp.pdu.SubmitSm) Esme(org.restcomm.smpp.Esme) SmppSessionsProxy(org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) Test(org.testng.annotations.Test)

Aggregations

PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)27 Date (java.util.Date)23 Test (org.testng.annotations.Test)21 Sms (org.mobicents.smsc.library.Sms)20 SmsSet (org.mobicents.smsc.library.SmsSet)19 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)11 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)11 ISDNAddressStringImpl (org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl)10 SmppSessionsProxy (org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy)9 ActivityContextInterface (javax.slee.ActivityContextInterface)8 ArrayList (java.util.ArrayList)7 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)7 TargetAddress (org.mobicents.smsc.library.TargetAddress)7 SubmitSm (com.cloudhopper.smpp.pdu.SubmitSm)6 UUID (java.util.UUID)6 AddressString (org.mobicents.protocols.ss7.map.api.primitives.AddressString)6 SM_RP_DA (org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA)6 SmsSignalInfo (org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo)6 UserData (org.mobicents.protocols.ss7.map.api.smstpdu.UserData)6 Esme (org.restcomm.smpp.Esme)6