Search in sources :

Example 1 with PushProfileRequest

use of net.java.slee.resource.diameter.cxdx.events.PushProfileRequest 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 PushProfileRequest

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

the class CxDxServerSessionImpl method createPushProfileRequest.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#createPushProfileRequest()
   */
public PushProfileRequest createPushProfileRequest() {
    // Create the request
    PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest(super.getSessionId());
    // Fill session related AVPs, if present
    fillSessionAVPs(ppr);
    return ppr;
}
Also used : PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)

Example 3 with PushProfileRequest

use of net.java.slee.resource.diameter.cxdx.events.PushProfileRequest 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 PushProfileRequest

use of net.java.slee.resource.diameter.cxdx.events.PushProfileRequest 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 PushProfileRequest

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

the class CxDxFactoriesTest method testGettersAndSettersPPR.

@Test
public void testGettersAndSettersPPR() throws Exception {
    PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
    int nFailures = CxDxAvpAssistant.INSTANCE.testMethods(ppr, PushProfileRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

PushProfileRequest (net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)10 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)4 ApplicationId (org.jdiameter.api.ApplicationId)3 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 InternalException (org.jdiameter.api.InternalException)1