use of org.mobicents.slee.resource.diameter.ro.RoMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class RoFactoriesTest method testServerSessionApplicationIdChangeCCA.
@Test
public void testServerSessionApplicationIdChangeCCA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RoMessageFactoryImpl) roMessageFactory).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 Ro is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
RoCreditControlRequest ccr = roMessageFactory.createRoCreditControlRequest();
((RoServerSessionActivityImpl) roServerSession).fetchCurrentState(ccr);
RoCreditControlAnswer originalCCA = roServerSession.createRoCreditControlAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalCCA);
// now we switch..
originalCCA = null;
isVendor = !isVendor;
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
RoCreditControlAnswer changedCCA = roServerSession.createRoCreditControlAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedCCA);
// revert back to default
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.mobicents.slee.resource.diameter.ro.RoMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class RoFactoriesTest method testMessageFactoryApplicationIdChangeCCR.
@Test
public void testMessageFactoryApplicationIdChangeCCR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RoMessageFactoryImpl) roMessageFactory).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 Ro is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
RoCreditControlRequest originalCCR = roMessageFactory.createRoCreditControlRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalCCR);
// now we switch..
originalCCR = null;
isVendor = !isVendor;
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
RoCreditControlRequest changedCCR = roMessageFactory.createRoCreditControlRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedCCR);
// revert back to default
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.mobicents.slee.resource.diameter.ro.RoMessageFactoryImpl in project jain-slee.diameter by RestComm.
the class RoFactoriesTest method testClientSessionApplicationIdChangeCCR.
@Test
public void testClientSessionApplicationIdChangeCCR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RoMessageFactoryImpl) roMessageFactory).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 Ro is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
RoCreditControlRequest originalCCR = roClientSession.createRoCreditControlRequest(CcRequestType.EVENT_REQUEST);
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalCCR);
// now we switch..
originalCCR = null;
isVendor = !isVendor;
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
RoCreditControlRequest changedCCR = roClientSession.createRoCreditControlRequest(CcRequestType.EVENT_REQUEST);
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedCCR);
// revert back to default
((RoMessageFactoryImpl) roMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations