Search in sources :

Example 66 with ActivityContextInterface

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

the class TxHttpServerSbbTest method sendMessageGETJsonWrongPasswordTest.

@Test
public void sendMessageGETJsonWrongPasswordTest() {
    System.out.println("sendMessageGETJsonWrongPasswordTest");
    if (!this.cassandraDbInited) {
        // Assert.fail("Cassandra DB is not inited");
        return;
    }
    // prepare
    ActivityContextInterface aci = new HttpActivityContextInterface();
    MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
    MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_INCORRECT, PASSWORD_INCORRECT, MESSAGE_DEFAULT, FORMAT_JSON, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_ONE);
    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.assertEquals(resp.getStatus(), HttpServletResponse.SC_UNAUTHORIZED);
}
Also used : ActivityContextInterface(javax.slee.ActivityContextInterface) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Test(org.testng.annotations.Test)

Example 67 with ActivityContextInterface

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

the class RxSmppServerSbbTest method testSubmitSm_test1.

@Test(groups = { "RxSmppServer" })
public void testSubmitSm_test1() throws Exception {
    if (!this.cassandraDbInited)
        return;
    ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
    SmsDef sd1 = new SmsDef();
    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)

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