Search in sources :

Example 1 with PurgeUEAnswer

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

the class S6aServerSessionImpl method createPurgeUEAnswer.

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

Example 2 with PurgeUEAnswer

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

the class S6aFactoriesTest method hasDestinationHostPUA.

@Test
public void hasDestinationHostPUA() throws Exception {
    PurgeUERequest pur = s6aMessageFactory.createPurgeUERequest();
    serverSession.fetchSessionData(pur);
    PurgeUEAnswer pua = serverSession.createPurgeUEAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", pua.getDestinationHost());
}
Also used : PurgeUEAnswer(net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer) PurgeUERequest(net.java.slee.resource.diameter.s6a.events.PurgeUERequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with PurgeUEAnswer

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

the class S6aFactoriesTest method hasTFlagSetPUA.

@Test
public void hasTFlagSetPUA() throws Exception {
    PurgeUERequest pur = s6aMessageFactory.createPurgeUERequest();
    ((DiameterMessageImpl) pur).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Purge-UE-Request", pur.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(pur);
    PurgeUEAnswer pua = serverSession.createPurgeUEAnswer();
    assertFalse("The 'T' flag should not be set in Purge-UE-Answer", pua.getHeader().isPotentiallyRetransmitted());
}
Also used : PurgeUEAnswer(net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer) PurgeUERequest(net.java.slee.resource.diameter.s6a.events.PurgeUERequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with PurgeUEAnswer

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

the class S6aFactoriesTest method hasDestinationRealmPUA.

@Test
public void hasDestinationRealmPUA() throws Exception {
    PurgeUERequest pur = s6aMessageFactory.createPurgeUERequest();
    serverSession.fetchSessionData(pur);
    PurgeUEAnswer pua = serverSession.createPurgeUEAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", pua.getDestinationRealm());
}
Also used : PurgeUEAnswer(net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer) PurgeUERequest(net.java.slee.resource.diameter.s6a.events.PurgeUERequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with PurgeUEAnswer

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

the class S6aFactoriesTest method isProxiableCopiedPUA.

@Test
public void isProxiableCopiedPUA() throws Exception {
    PurgeUERequest pur = s6aMessageFactory.createPurgeUERequest();
    serverSession.fetchSessionData(pur);
    PurgeUEAnswer pua = serverSession.createPurgeUEAnswer();
    assertEquals("The 'P' bit is not copied from request in Location-Info-Answer, it should. [RFC3588/6.2]", pur.getHeader().isProxiable(), pua.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) pur).getGenericData().setProxiable(!pur.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Purge-UE-Request, it should.", pur.getHeader().isProxiable() != pua.getHeader().isProxiable());
    serverSession.fetchSessionData(pur);
    pua = serverSession.createPurgeUEAnswer();
    assertEquals("The 'P' bit is not copied from request in Purge-UE-Answer, it should. [RFC3588/6.2]", pur.getHeader().isProxiable(), pua.getHeader().isProxiable());
}
Also used : PurgeUEAnswer(net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer) PurgeUERequest(net.java.slee.resource.diameter.s6a.events.PurgeUERequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

PurgeUEAnswer (net.java.slee.resource.diameter.s6a.events.PurgeUEAnswer)8 PurgeUERequest (net.java.slee.resource.diameter.s6a.events.PurgeUERequest)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