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