Search in sources :

Example 1 with CancelLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method isAnswerCLA.

@Test
public void isAnswerCLA() throws Exception {
    CancelLocationRequest clr = s6aMessageFactory.createCancelLocationRequest();
    clientSession.fetchSessionData(clr);
    CancelLocationAnswer cla = clientSession.createCancelLocationAnswer();
    assertFalse("Request Flag in Cancel-Location-Answer is set.", cla.getHeader().isRequest());
}
Also used : CancelLocationRequest(net.java.slee.resource.diameter.s6a.events.CancelLocationRequest) CancelLocationAnswer(net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with CancelLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method testGettersAndSettersCLA.

@Test
public void testGettersAndSettersCLA() throws Exception {
    CancelLocationRequest clr = s6aMessageFactory.createCancelLocationRequest();
    clientSession.fetchSessionData(clr);
    CancelLocationAnswer cla = clientSession.createCancelLocationAnswer();
    int nFailures = S6aAvpAssistant.INSTANCE.testMethods(cla, CancelLocationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : CancelLocationRequest(net.java.slee.resource.diameter.s6a.events.CancelLocationRequest) CancelLocationAnswer(net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with CancelLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasDestinationRealmCLA.

@Test
public void hasDestinationRealmCLA() throws Exception {
    CancelLocationRequest clr = s6aMessageFactory.createCancelLocationRequest();
    clientSession.fetchSessionData(clr);
    CancelLocationAnswer cla = clientSession.createCancelLocationAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", cla.getDestinationRealm());
}
Also used : CancelLocationRequest(net.java.slee.resource.diameter.s6a.events.CancelLocationRequest) CancelLocationAnswer(net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with CancelLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aFactoriesTest method hasTFlagSetCLA.

@Test
public void hasTFlagSetCLA() throws Exception {
    CancelLocationRequest clr = s6aMessageFactory.createCancelLocationRequest();
    ((DiameterMessageImpl) clr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Cancel-Location-Request", clr.getHeader().isPotentiallyRetransmitted());
    clientSession.fetchSessionData(clr);
    CancelLocationAnswer cla = clientSession.createCancelLocationAnswer();
    assertFalse("The 'T' flag should not be set in Cancel-Location-Answer", cla.getHeader().isPotentiallyRetransmitted());
}
Also used : CancelLocationRequest(net.java.slee.resource.diameter.s6a.events.CancelLocationRequest) CancelLocationAnswer(net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with CancelLocationAnswer

use of net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer in project jain-slee.diameter by RestComm.

the class S6aClientSessionImpl method createCancelLocationAnswer.

public CancelLocationAnswer createCancelLocationAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof CancelLocationRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        CancelLocationAnswer cla = (CancelLocationAnswer) this.s6aMessageFactory.createS6aMessage(lastRequest.getHeader(), new DiameterAvp[] {}, CancelLocationAnswer.COMMAND_CODE, s6aMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(cla);
        return cla;
    } catch (InternalException e) {
        logger.error("Failed to create Cancel-Location-Answer.", e);
    }
    return null;
}
Also used : DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) CancelLocationRequest(net.java.slee.resource.diameter.s6a.events.CancelLocationRequest) CancelLocationAnswer(net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer) InternalException(org.jdiameter.api.InternalException)

Aggregations

CancelLocationAnswer (net.java.slee.resource.diameter.s6a.events.CancelLocationAnswer)8 CancelLocationRequest (net.java.slee.resource.diameter.s6a.events.CancelLocationRequest)8 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 ApplicationId (org.jdiameter.api.ApplicationId)1 InternalException (org.jdiameter.api.InternalException)1 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)1