Search in sources :

Example 1 with GxReAuthRequest

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

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeRAR.

@Test
public void testMessageFactoryApplicationIdChangeRAR() 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...
    GxReAuthRequest originalRAR = gxMessageFactory.createGxReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
    // now we switch..
    originalRAR = null;
    isVendor = !isVendor;
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GxCreditControlRequest changedRAR = gxMessageFactory.createGxCreditControlRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
    // revert back to default
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) GxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest) 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 2 with GxReAuthRequest

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

the class GxFactoriesTest method isProxiableCopiedRAA.

@Test
public void isProxiableCopiedRAA() throws Exception {
    GxReAuthRequest rar = gxMessageFactory.createGxReAuthRequest();
    GxReAuthAnswer raa = gxClientSession.createGxReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in 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 Re-Auth-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
    raa = gxClientSession.createGxReAuthAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
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)

Example 3 with GxReAuthRequest

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

the class GxMessageFactoryImpl method createGxReAuthRequest.

@Override
public GxReAuthRequest createGxReAuthRequest(String sessionId) {
    final GxReAuthRequest gxRAR = this.createGxReAuthRequest();
    gxRAR.setSessionId(sessionId);
    return gxRAR;
}
Also used : GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest)

Example 4 with GxReAuthRequest

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

the class GxFactoriesTest method testGettersAndSettersRAR.

@Test
public void testGettersAndSettersRAR() throws Exception {
    GxReAuthRequest rar = gxMessageFactory.createGxReAuthRequest();
    int nFailures = GxAvpAssistant.INSTANCE.testMethods(rar, GxReAuthRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with GxReAuthRequest

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

the class GxFactoriesTest method hasGxApplicationIdRAR.

@Test
public void hasGxApplicationIdRAR() throws Exception {
    GxReAuthRequest rar = gxMessageFactory.createGxReAuthRequest();
    assertTrue("Auth-Application-Id AVP in Gx RAR must be 16777224, it is " + rar.getAuthApplicationId(), rar.getAuthApplicationId() == 16777224);
}
Also used : GxReAuthRequest(net.java.slee.resource.diameter.gx.events.GxReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

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