use of net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testServerSessionApplicationIdChangeSAA.
@Test
public void testServerSessionApplicationIdChangeSAA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((CxDxMessageFactoryImpl) cxdxMessageFactory).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 CxDx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
ServerAssignmentRequest sar = cxdxMessageFactory.createServerAssignmentRequest();
serverSession.fetchSessionData(sar);
ServerAssignmentAnswer originalSAA = serverSession.createServerAssignmentAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSAA);
// now we switch..
originalSAA = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
ServerAssignmentAnswer changedSAA = serverSession.createServerAssignmentAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSAA);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isAnswerSAA.
@Test
public void isAnswerSAA() throws Exception {
serverSession.fetchSessionData(cxdxMessageFactory.createServerAssignmentRequest());
ServerAssignmentAnswer saa = serverSession.createServerAssignmentAnswer();
assertFalse("Request Flag in Server-Assignment-Answer is set.", saa.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasDestinationRealmSAA.
@Test
public void hasDestinationRealmSAA() throws Exception {
serverSession.fetchSessionData(cxdxMessageFactory.createServerAssignmentRequest());
ServerAssignmentAnswer saa = serverSession.createServerAssignmentAnswer();
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", saa.getDestinationRealm());
}
Aggregations