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());
}
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());
}
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;
}
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);
}
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);
}
Aggregations