Search in sources :

Example 16 with ActivityContextInterface

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

the class RxSmppServerSbb method onSubmitSmRespLocal.

private void onSubmitSmRespLocal(final RxSmppServerSbbUsage anSbbUsage, final SubmitSmResp event, final ActivityContextInterface aci) {
    if (logger.isFineEnabled())
        logger.fine("onSubmitSmResp - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
    RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
    if (rxSmppServerSbbLocalObject != null) {
        ActivityContextInterface act = getSchedulerActivityContextInterface();
        if (act != null) {
            try {
                act.attach(rxSmppServerSbbLocalObject);
                fireSubmitSmRespChild(event, act, null);
            } catch (IllegalStateException e) {
                if (logger.isInfoEnabled())
                    logger.info("onSubmitSmRespLocal - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
            }
        }
    }
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface)

Example 17 with ActivityContextInterface

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

the class RxSmppServerSbb method onSendPduStatusLocal.

private void onSendPduStatusLocal(final SendPduStatus event, final ActivityContextInterface aci) {
    if (logger.isFineEnabled())
        logger.fine("onSendPduStatusParent - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
    RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
    if (rxSmppServerSbbLocalObject != null) {
        ActivityContextInterface act = getSchedulerActivityContextInterface();
        if (act != null) {
            try {
                act.attach(rxSmppServerSbbLocalObject);
                SendPduStatus2 event2 = new SendPduStatus2(event.getException(), event.getRequest(), event.getResponse(), event.getSystemId(), event.isSuccess());
                SmsSet smsSet = getSmsSet();
                Pdu pduEvent = event.getRequest();
                if (event.getResponse() != null)
                    pduEvent = event.getResponse();
                EsmeManagement esmeManagement = EsmeManagement.getInstance();
                Boolean destAddressLimitationEnabled = false;
                if (esmeManagement != null && smsSet != null) {
                    Esme esme = esmeManagement.getEsmeByName(smsSet.getDestEsmeName());
                    if (esme != null) {
                        destAddressLimitationEnabled = esme.getDestAddrSendLimit() != 0;
                    }
                }
                int realID = -1;
                SentItemsList list = null;
                if (destAddressLimitationEnabled) {
                    list = retreiveSentChunks();
                    for (int i = 0; i < list.getSentList().size(); i++) {
                        if (list.getSentList().get(i).getRemoteSequenceNumber() == pduEvent.getSequenceNumber()) {
                            realID = list.getSentList().get(i).getLocalSequenceNumber();
                            break;
                        }
                    }
                } else {
                    realID = pduEvent.getSequenceNumber();
                }
                ConfirmMessageInSendingPool confirmMessageInSendingPool = null;
                if (realID != -1)
                    confirmMessageInSendingPool = getMessageInSendingPoolBySeqNumber(realID);
                fireSendPduStatusChild(event2, act, null);
            } catch (IllegalStateException e) {
                if (logger.isInfoEnabled())
                    logger.info("onSendPduStatus - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
            }
        }
    }
}
Also used : Pdu(com.cloudhopper.smpp.pdu.Pdu) EsmeManagement(org.restcomm.smpp.EsmeManagement) SentItemsList(org.mobicents.smsc.slee.services.deliverysbb.SentItemsList) ActivityContextInterface(javax.slee.ActivityContextInterface) SendPduStatus2(org.mobicents.smsc.slee.resources.scheduler.SendPduStatus2) Esme(org.restcomm.smpp.Esme) ConfirmMessageInSendingPool(org.mobicents.smsc.slee.services.deliverysbb.ConfirmMessageInSendingPool) SmsSet(org.mobicents.smsc.library.SmsSet)

Example 18 with ActivityContextInterface

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

the class RxSmppServerSbb method onDeliverSmRespLocal.

private void onDeliverSmRespLocal(final RxSmppServerSbbUsage anSbbUsage, final DeliverSmResp event, final ActivityContextInterface aci) {
    if (logger.isFineEnabled())
        logger.fine("onDeliverSmResp - refire to RxSmppServerChildSbb : activity=" + aci.getActivity());
    RxSmppServerChildLocalObject rxSmppServerSbbLocalObject = this.getRxSmppServerChildSbbObject();
    if (rxSmppServerSbbLocalObject != null) {
        ActivityContextInterface act = getSchedulerActivityContextInterface();
        if (act != null) {
            try {
                act.attach(rxSmppServerSbbLocalObject);
                fireDeliverSmRespChild(event, act, null);
            } catch (IllegalStateException e) {
                if (logger.isInfoEnabled())
                    logger.info("onDeliverSmResp - IllegalStateException (activity is ending - dropping a SLEE event because it is not needed) : new activity=" + act.getActivity() + ", event=" + event);
            }
        }
    }
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface)

Example 19 with ActivityContextInterface

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

the class TxHttpServerSbbTest method sendArabicMessageGETStringSuccessTest.

@Test
public void sendArabicMessageGETStringSuccessTest() throws UnsupportedEncodingException {
    System.out.println("sendArabicMessageGETStringSuccessTest");
    if (!this.cassandraDbInited) {
        // Assert.fail("Cassandra DB is not inited");
        return;
    }
    // prepare
    ActivityContextInterface aci = new HttpActivityContextInterface();
    MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
    String urlEncoded = null;
    urlEncoded = URLEncoder.encode(MSG_ARABIC, "UTF-8");
    MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, urlEncoded, FORMAT_STRING, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_MULTIPLE);
    event.setRequest(request);
    MockHttpServletResponse response = new MockHttpServletResponse();
    event.setResponse(response);
    // perform the action
    this.sbb.onHttpGet(event, aci);
    MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
    printResponseData(resp);
    Assert.assertTrue(isValid(resp, FORMAT_STRING, true, 3), "Response is not valid");
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.testng.annotations.Test)

Example 20 with ActivityContextInterface

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

the class TxHttpServerSbbTest method sendArabicMessagePOSTSuccessStringTest.

@Test
public void sendArabicMessagePOSTSuccessStringTest() throws UnsupportedEncodingException {
    System.out.println("sendArabicMessagePOSTSuccessTest");
    if (!this.cassandraDbInited) {
        // Assert.fail("Cassandra DB is not inited");
        return;
    }
    // prepare
    ActivityContextInterface aci = new HttpActivityContextInterface();
    MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
    String urlEncoded = null;
    urlEncoded = URLEncoder.encode(MSG_ARABIC, "UTF-8");
    MockHttpServletRequest request = buildSendMessageRequest(METHOD_POST, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, urlEncoded, FORMAT_STRING, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_MULTIPLE);
    event.setRequest(request);
    MockHttpServletResponse response = new MockHttpServletResponse();
    event.setResponse(response);
    // perform the action
    this.sbb.onHttpPost(event, aci);
    MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
    printResponseData(resp);
    Assert.assertTrue(isValid(resp, FORMAT_STRING, true, 3), "Response is not valid");
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) 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