use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method testMessageFactoryApplicationIdChangeRAA.
@Test
public void testMessageFactoryApplicationIdChangeRAA() 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...
GqReAuthAnswer originalRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
// now we switch..
originalRAA = null;
isVendor = !isVendor;
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
GqReAuthAnswer changedRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
// revert back to default
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer 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.GqReAuthAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method hasDestinationHostRAA.
@Test
public void hasDestinationHostRAA() throws Exception {
GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", raa.getDestinationHost());
}
use of net.java.slee.resource.diameter.gq.events.GqReAuthAnswer 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.GqReAuthAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method hasDestinationRealmRAA.
@Test
public void hasDestinationRealmRAA() throws Exception {
GqReAuthAnswer raa = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", raa.getDestinationRealm());
}
Aggregations