use of org.mobicents.slee.resource.diameter.rf.RfServerSessionActivityImpl in project jain-slee.diameter by RestComm.
the class RfFactoriesTest method testServerSessionApplicationIdChangeACA.
@Test
public void testServerSessionApplicationIdChangeACA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RfMessageFactoryImpl) rfMessageFactory).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 Rf is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
RfAccountingRequest acr = rfMessageFactory.createRfAccountingRequest(AccountingRecordType.EVENT_RECORD);
((RfServerSessionActivityImpl) rfServerSession).fetchSessionData(acr, true);
RfAccountingAnswer originalACA = rfServerSession.createRfAccountingAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalACA);
// now we switch..
originalACA = null;
isVendor = !isVendor;
((RfMessageFactoryImpl) rfMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
RfAccountingAnswer changedACA = rfServerSession.createRfAccountingAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedACA);
changedACA = rfServerSession.createRfAccountingAnswer(acr);
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedACA);
// revert back to default
((RfMessageFactoryImpl) rfMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations