Search in sources :

Example 6 with GxReAuthAnswer

use of net.java.slee.resource.diameter.gx.events.GxReAuthAnswer in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeInClientSessionRAA.

@Test
public void testMessageFactoryApplicationIdChangeInClientSessionRAA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GxMessageFactoryImpl) gxMessageFactory).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 Gx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GxReAuthAnswer originalRAA = gxClientSession.createGxReAuthAnswer(gxMessageFactory.createGxReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
    // now we switch..
    originalRAA = null;
    isVendor = !isVendor;
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GxReAuthAnswer changedRAA = gxClientSession.createGxReAuthAnswer(gxMessageFactory.createGxReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
    // revert back to default
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GxReAuthAnswer(net.java.slee.resource.diameter.gx.events.GxReAuthAnswer) ApplicationId(org.jdiameter.api.ApplicationId) GxMessageFactoryImpl(org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with GxReAuthAnswer

use of net.java.slee.resource.diameter.gx.events.GxReAuthAnswer in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method isAnswerRAA.

@Test
public void isAnswerRAA() throws Exception {
    GxReAuthAnswer raa = gxClientSession.createGxReAuthAnswer(gxMessageFactory.createGxReAuthRequest());
    assertFalse("Request Flag in Gx Re-Auth-Answer is set.", raa.getHeader().isRequest());
}
Also used : GxReAuthAnswer(net.java.slee.resource.diameter.gx.events.GxReAuthAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with GxReAuthAnswer

use of net.java.slee.resource.diameter.gx.events.GxReAuthAnswer in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method hasTFlagSetRAA.

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

Aggregations

GxReAuthAnswer (net.java.slee.resource.diameter.gx.events.GxReAuthAnswer)8 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 GxReAuthRequest (net.java.slee.resource.diameter.gx.events.GxReAuthRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)1 GxMessageFactoryImpl (org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl)1