Search in sources :

Example 1 with GqReAuthAnswer

use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeRAA.

@Test
public void testMessageFactoryApplicationIdChangeRAA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqReAuthAnswer originalRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
    // now we switch..
    originalRAA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqReAuthAnswer changedRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with GqReAuthAnswer

use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method isProxiableCopiedRAA.

@Test
public void isProxiableCopiedRAA() throws Exception {
    GqReAuthRequest rar = gqMessageFactory.createGqReAuthRequest();
    GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Gq' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) rar).getGenericData().setProxiable(!rar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Gq' Re-Auth-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
    raa = gqMessageFactory.createGqReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Gq' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
Also used : GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) GqReAuthRequest(net.java.slee.resource.diameter.gq.events.GqReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with GqReAuthAnswer

use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method hasDestinationHostRAA.

@Test
public void hasDestinationHostRAA() throws Exception {
    GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", raa.getDestinationHost());
}
Also used : GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with GqReAuthAnswer

use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method hasTFlagSetRAA.

@Test
public void hasTFlagSetRAA() throws Exception {
    GqReAuthRequest rar = gqMessageFactory.createGqReAuthRequest();
    ((DiameterMessageImpl) rar).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Re-Auth-Request", rar.getHeader().isPotentiallyRetransmitted());
    GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(rar);
    assertFalse("The 'T' flag should not be set in Re-Auth-Answer", raa.getHeader().isPotentiallyRetransmitted());
}
Also used : GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) GqReAuthRequest(net.java.slee.resource.diameter.gq.events.GqReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with GqReAuthAnswer

use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method hasDestinationRealmRAA.

@Test
public void hasDestinationRealmRAA() throws Exception {
    GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", raa.getDestinationRealm());
}
Also used : GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

GqReAuthAnswer (net.java.slee.resource.diameter.gq.events.GqReAuthAnswer)7 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 GqReAuthRequest (net.java.slee.resource.diameter.gq.events.GqReAuthRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)1 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)1