Search in sources :

Example 1 with PushNotificationAnswer

use of net.java.slee.resource.diameter.sh.events.PushNotificationAnswer in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method isProxiableCopiedPNA.

@Test
public void isProxiableCopiedPNA() throws Exception {
    PushNotificationRequest pnr = createPushNotificationRequest();
    PushNotificationAnswer pna = shClientFactory.createPushNotificationAnswer(pnr);
    assertEquals("The 'P' bit is not copied from request in Push-Notification-Answer, it should. [RFC3588/6.2]", pnr.getHeader().isProxiable(), pna.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) pnr).getGenericData().setProxiable(!pnr.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Push-Notification-Request, it should.", pnr.getHeader().isProxiable() != pna.getHeader().isProxiable());
    pna = shClientFactory.createPushNotificationAnswer(pnr);
    assertEquals("The 'P' bit is not copied from request in Push-Notification-Answer, it should. [RFC3588/6.2]", pnr.getHeader().isProxiable(), pna.getHeader().isProxiable());
}
Also used : PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with PushNotificationAnswer

use of net.java.slee.resource.diameter.sh.events.PushNotificationAnswer in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method testGettersAndSettersPNA.

@Test
public void testGettersAndSettersPNA() throws Exception {
    PushNotificationAnswer pna = shClientFactory.createPushNotificationAnswer(createPushNotificationRequest());
    int nFailures = ShClientAvpAssistant.INSTANCE.testMethods(pna, PushNotificationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with PushNotificationAnswer

use of net.java.slee.resource.diameter.sh.events.PushNotificationAnswer in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method hasTFlagSetPNA.

@Test
public void hasTFlagSetPNA() throws Exception {
    PushNotificationRequest pnr = createPushNotificationRequest();
    ((DiameterMessageImpl) pnr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Push-Notification-Request", pnr.getHeader().isPotentiallyRetransmitted());
    PushNotificationAnswer pna = shClientFactory.createPushNotificationAnswer(pnr);
    assertFalse("The 'T' flag should not be set in Push-Notification-Answer", pna.getHeader().isPotentiallyRetransmitted());
}
Also used : PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with PushNotificationAnswer

use of net.java.slee.resource.diameter.sh.events.PushNotificationAnswer in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method hasDestinationRealmPNA.

@Test
public void hasDestinationRealmPNA() throws Exception {
    PushNotificationAnswer pna = shClientFactory.createPushNotificationAnswer(createPushNotificationRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", pna.getDestinationRealm());
}
Also used : PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with PushNotificationAnswer

use of net.java.slee.resource.diameter.sh.events.PushNotificationAnswer in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method isExperimentalResultCorrectlySetPNA.

/**
 * Test for Issue #665 (Diameter Experimental Result AVP is Nested)
 * http://code.google.com/p/mobicents/issues/detail?id=655
 *
 * @throws Exception
 */
@Test
public void isExperimentalResultCorrectlySetPNA() throws Exception {
    long originalValue = 5001;
    PushNotificationAnswer pna = shClientFactory.createPushNotificationAnswer(createPushNotificationRequest(), originalValue, true);
    long obtainedValue = pna.getExperimentalResult().getExperimentalResultCode();
    assertTrue("Experimental-Result-Code in PNA should be " + originalValue + " and is " + obtainedValue + ".", originalValue == obtainedValue);
}
Also used : PushNotificationAnswer(net.java.slee.resource.diameter.sh.events.PushNotificationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

PushNotificationAnswer (net.java.slee.resource.diameter.sh.events.PushNotificationAnswer)11 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)5 ApplicationId (org.jdiameter.api.ApplicationId)2 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)1 Answer (org.jdiameter.api.Answer)1 PushNotificationAnswerImpl (org.jdiameter.common.impl.app.sh.PushNotificationAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)1