Search in sources :

Example 6 with ActivityContextInterface

use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.

the class RxSmppServerSbbTest method testSubmitSm_test3_3.

@Test(groups = { "RxSmppServer" })
public void testSubmitSm_test3_3() throws Exception {
    if (!this.cassandraDbInited)
        return;
    ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
    SmsDef sd1 = new SmsDef();
    String s01 = "1234567890";
    StringBuilder sb = new StringBuilder();
    for (int i1 = 0; i1 < 20; i1++) {
        sb.append(s01);
    }
    sd1.msg = sb.toString();
    sd1.stored = true;
    lst.add(sd1);
    SmsDef sd2 = new SmsDef();
    sd2.msg = "Msg 2";
    sd2.stored = true;
    lst.add(sd2);
    SmsSet smsSet = prepareDatabase(lst);
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    EventContext eventContext = null;
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    this.sbb.onDeliverSm(event, aci, eventContext);
    DeliverSmResp eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
    eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
    eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
}
Also used : EventContext(javax.slee.EventContext) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ActivityContextInterface(javax.slee.ActivityContextInterface) ArrayList(java.util.ArrayList) SmsSet(org.mobicents.smsc.library.SmsSet) DeliverSmResp(com.cloudhopper.smpp.pdu.DeliverSmResp) Test(org.testng.annotations.Test)

Example 7 with ActivityContextInterface

use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.

the class RxSmppServerSbbTest method testSubmitSm_test1_2.

@Test(groups = { "RxSmppServer" })
public void testSubmitSm_test1_2() throws Exception {
    if (!this.cassandraDbInited)
        return;
    ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
    SmsDef sd1 = new SmsDef();
    sd1.stored = true;
    lst.add(sd1);
    SmsSet smsSet = prepareDatabase(lst);
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    EventContext eventContext = null;
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    this.sbb.onDeliverSm(event, aci, eventContext);
    DeliverSmResp eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
}
Also used : EventContext(javax.slee.EventContext) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ActivityContextInterface(javax.slee.ActivityContextInterface) ArrayList(java.util.ArrayList) SmsSet(org.mobicents.smsc.library.SmsSet) DeliverSmResp(com.cloudhopper.smpp.pdu.DeliverSmResp) Test(org.testng.annotations.Test)

Example 8 with ActivityContextInterface

use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.

the class RxSmppServerSbbTest method testSubmitSm_test3_2.

@Test(groups = { "RxSmppServer" })
public void testSubmitSm_test3_2() throws Exception {
    if (!this.cassandraDbInited)
        return;
    ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
    SmsDef sd1 = new SmsDef();
    sd1.msg = "Msg 1";
    sd1.stored = true;
    lst.add(sd1);
    SmsDef sd2 = new SmsDef();
    sd2.msg = "Msg 2";
    sd2.stored = true;
    lst.add(sd2);
    SmsDef sd3 = new SmsDef();
    sd3.msg = "Msg 3";
    sd3.stored = true;
    lst.add(sd3);
    SmsSet smsSet = prepareDatabase(lst);
    SmsSetEvent event = new SmsSetEvent();
    event.setSmsSet(smsSet);
    EventContext eventContext = null;
    ActivityContextInterface aci = new SmppTransactionProxy(esme);
    this.sbb.onDeliverSm(event, aci, eventContext);
    DeliverSmResp eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
    eventResp = new DeliverSmResp();
    // eventResp.setCommandStatus(2);
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    // eventResp.setSequenceNumber(10001);
    this.sbb.onDeliverSmRespParent(eventResp, aci, eventContext);
    eventResp = new DeliverSmResp();
    eventResp.setSequenceNumber(sbb.getNextSentSequenseId());
    this.sbb.onPduRequestTimeoutParent(null, aci, eventContext);
// this.sbb.onDeliverSmResp(eventResp, aci, eventContext);
}
Also used : EventContext(javax.slee.EventContext) SmsSetEvent(org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent) ActivityContextInterface(javax.slee.ActivityContextInterface) ArrayList(java.util.ArrayList) SmsSet(org.mobicents.smsc.library.SmsSet) DeliverSmResp(com.cloudhopper.smpp.pdu.DeliverSmResp) Test(org.testng.annotations.Test)

Example 9 with ActivityContextInterface

use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.

the class DeliveryCommonSbb method getSchedulerActivityContextInterface.

protected ActivityContextInterface getSchedulerActivityContextInterface() {
    ActivityContextInterface[] acis = this.sbbContext.getActivities();
    for (int count = 0; count < acis.length; count++) {
        ActivityContextInterface aci = acis[count];
        Object activity = aci.getActivity();
        if (activity instanceof SchedulerActivity) {
            return aci;
        }
    }
    return null;
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) SchedulerActivity(org.mobicents.smsc.slee.resources.scheduler.SchedulerActivity)

Example 10 with ActivityContextInterface

use of javax.slee.ActivityContextInterface 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

ActivityContextInterface (javax.slee.ActivityContextInterface)67 Test (org.testng.annotations.Test)45 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)33 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)33 SmsSet (org.mobicents.smsc.library.SmsSet)11 Date (java.util.Date)9 Esme (org.restcomm.smpp.Esme)9 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)8 SmppSessionsProxy (org.mobicents.smsc.slee.resources.persistence.SmppSessionsProxy)8 Sms (org.mobicents.smsc.library.Sms)7 SubmitSm (com.cloudhopper.smpp.pdu.SubmitSm)6 ArrayList (java.util.ArrayList)6 PduResponse (com.cloudhopper.smpp.pdu.PduResponse)5 DeliverSmResp (com.cloudhopper.smpp.pdu.DeliverSmResp)4 EventContext (javax.slee.EventContext)4 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)4 SmsSetEvent (org.mobicents.smsc.slee.services.smpp.server.events.SmsSetEvent)4 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)4 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)4 Tlv (com.cloudhopper.smpp.tlv.Tlv)3