use of net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method isProxiableCopiedSTA.
@Test
public void isProxiableCopiedSTA() throws Exception {
GqSessionTerminationRequest str = gqMessageFactory.createGqSessionTerminationRequest();
GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) str).getGenericData().setProxiable(!str.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Session-Termination-Request, it should.", str.getHeader().isProxiable() != sta.getHeader().isProxiable());
sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method testGettersAndSettersSTA.
@Test
public void testGettersAndSettersSTA() throws Exception {
GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
int nFailures = GqAvpAssistant.INSTANCE.testMethods(sta, GqSessionTerminationAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
use of net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method hasTFlagSetSTA.
@Test
public void hasTFlagSetSTA() throws Exception {
GqSessionTerminationRequest str = gqMessageFactory.createGqSessionTerminationRequest();
((DiameterMessageImpl) str).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Session-Termination-Request", str.getHeader().isPotentiallyRetransmitted());
GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(str);
assertFalse("The 'T' flag should not be set in Session-Termination-Answer", sta.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method testMessageFactoryApplicationIdChangeSTA.
@Test
public void testMessageFactoryApplicationIdChangeSTA() 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...
GqSessionTerminationAnswer originalSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
// now we switch..
originalSTA = null;
isVendor = !isVendor;
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
GqSessionTerminationAnswer changedSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
// revert back to default
((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer in project jain-slee.diameter by RestComm.
the class GqFactoriesTest method isAnswerSTA.
// Session-Termination-Answer
@Test
public void isAnswerSTA() throws Exception {
GqSessionTerminationAnswer sta = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
assertFalse("Request Flag in Re-Auth-Answer is set.", sta.getHeader().isRequest());
}
Aggregations