use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeASA.
@Test
public void testMessageFactoryApplicationIdChangeASA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AbortSessionAnswer originalASA = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASA);
// now we switch..
originalASA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AbortSessionAnswer changedASA = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeRAR.
// @Test
// public void testClientSessionApplicationIdChangeASA() throws Exception {
// long vendor = 10415L;
// ApplicationId originalAppId = ((RxMessageFactoryImpl)rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// // let's create a message and see how it comes...
// AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
// rxClientSession.fetchCurrentState(asr);
// AbortSessionAnswer originalASA = rxClientSession.createAbortSessionAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASA);
//
// // now we switch..
// originalASA = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
//
// // create a new message and see how it comes...
// AbortSessionAnswer changedASA = rxClientSession.createAbortSessionAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASA);
//
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeRAR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
ReAuthRequest originalRAR = rxMessageFactory.createReAuthRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
// now we switch..
originalRAR = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
ReAuthRequest changedRAR = rxMessageFactory.createReAuthRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeAAA.
@Test
public void testMessageFactoryApplicationIdChangeAAA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AAAnswer originalAAA = rxMessageFactory.createAAAnswer(rxMessageFactory.createAARequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAA);
// now we switch..
originalAAA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AAAnswer changedAAA = rxMessageFactory.createAAAnswer(rxMessageFactory.createAARequest());
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testClientSessionApplicationIdChangeAAR.
@Test
public void testClientSessionApplicationIdChangeAAR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AARequest originalAAR = rxClientSession.createRxAARequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAR);
// now we switch..
originalAAR = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AARequest changedAAR = rxClientSession.createRxAARequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testServerSessionApplicationIdChangeAAA.
@Test
public void testServerSessionApplicationIdChangeAAA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
AARequest aar = rxMessageFactory.createAARequest();
rxServerSession.fetchCurrentState(aar);
AAAnswer originalAAA = rxServerSession.createAAAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAA);
// now we switch..
originalAAA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AAAnswer changedAAA = rxServerSession.createAAAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations