Search in sources :

Example 1 with GqReAuthRequest

use of net.java.slee.resource.diameter.gq.events.GqReAuthRequest 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 2 with GqReAuthRequest

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeRAR.

@Test
public void testMessageFactoryApplicationIdChangeRAR() 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...
    GqReAuthRequest originalRAR = gqMessageFactory.createGqReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
    // now we switch..
    originalRAR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqReAuthRequest changedRAR = gqMessageFactory.createGqReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) 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 GqReAuthRequest

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

the class GqFactoriesTest method isProxiableRAR.

@Test
public void isProxiableRAR() throws Exception {
    GqReAuthRequest rar = gqMessageFactory.createGqReAuthRequest();
    assertTrue("The 'P' bit is not set by default in Gq' Re-Auth-Request, it should.", rar.getHeader().isProxiable());
}
Also used : GqReAuthRequest(net.java.slee.resource.diameter.gq.events.GqReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with GqReAuthRequest

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

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

the class GqFactoriesTest method hasGqApplicationIdRAR.

@Test
public void hasGqApplicationIdRAR() throws Exception {
    GqReAuthRequest rar = gqMessageFactory.createGqReAuthRequest();
    assertTrue("Auth-Application-Id AVP in Gq RAR must be " + GqMessageFactory._GQ_AUTH_APP_ID + ", it is " + rar.getAuthApplicationId(), rar.getAuthApplicationId() == GqMessageFactory._GQ_AUTH_APP_ID);
}
Also used : GqReAuthRequest(net.java.slee.resource.diameter.gq.events.GqReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

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