Search in sources :

Example 1 with PushProfileAnswer

use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.

the class CxDxClientSessionImpl method createPushProfileAnswer.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createPushProfileAnswer()
   */
public PushProfileAnswer createPushProfileAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof PushProfileRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        PushProfileAnswer ppa = (PushProfileAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, PushProfileAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(ppa);
        return ppa;
    } catch (InternalException e) {
        logger.error("Failed to create Push-Profile-Answer.", e);
    }
    return null;
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) InternalException(org.jdiameter.api.InternalException)

Example 2 with PushProfileAnswer

use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isAnswerPPA.

@Test
public void isAnswerPPA() throws Exception {
    clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
    PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
    assertFalse("Request Flag in Push-Profile-Answer is set.", ppa.getHeader().isRequest());
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with PushProfileAnswer

use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isProxiableCopiedPPA.

@Test
public void isProxiableCopiedPPA() throws Exception {
    PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
    clientSession.fetchSessionData(ppr);
    PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
    assertEquals("The 'P' bit is not copied from request in Push-Profile-Answer, it should. [RFC3588/6.2]", ppr.getHeader().isProxiable(), ppa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) ppr).getGenericData().setProxiable(!ppr.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Push-Profile-Request, it should.", ppr.getHeader().isProxiable() != ppa.getHeader().isProxiable());
    clientSession.fetchSessionData(ppr);
    ppa = clientSession.createPushProfileAnswer();
    assertEquals("The 'P' bit is not copied from request in Push-Profile-Answer, it should. [RFC3588/6.2]", ppr.getHeader().isProxiable(), ppa.getHeader().isProxiable());
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with PushProfileAnswer

use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method hasTFlagSetPPA.

@Test
public void hasTFlagSetPPA() throws Exception {
    PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
    ((DiameterMessageImpl) ppr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Push-Profile-Request", ppr.getHeader().isPotentiallyRetransmitted());
    clientSession.fetchSessionData(ppr);
    PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
    assertFalse("The 'T' flag should not be set in Push-Profile-Answer", ppa.getHeader().isPotentiallyRetransmitted());
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with PushProfileAnswer

use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method hasDestinationRealmPPA.

@Test
public void hasDestinationRealmPPA() throws Exception {
    clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
    PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", ppa.getDestinationRealm());
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)9 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 PushProfileRequest (net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)4 InternalException (org.jdiameter.api.InternalException)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 RegistrationTerminationAnswer (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer)1 Answer (org.jdiameter.api.Answer)1 ApplicationId (org.jdiameter.api.ApplicationId)1 JPushProfileAnswerImpl (org.jdiameter.common.impl.app.cxdx.JPushProfileAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)1