use of net.java.slee.resource.diameter.rx.events.ReAuthRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasRxApplicationIdRAR.
@Test
public void hasRxApplicationIdRAR() throws Exception {
ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
assertTrue("Auth-Application-Id AVP in Rx RAR must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + rar.getAuthApplicationId(), rar.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
use of net.java.slee.resource.diameter.rx.events.ReAuthRequest 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 net.java.slee.resource.diameter.rx.events.ReAuthRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isProxiableCopiedRAA.
@Test
public void isProxiableCopiedRAA() throws Exception {
ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
ReAuthAnswer raa = rxMessageFactory.createReAuthAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) rar).getGenericData().setProxiable(!rar.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Rx' Re-Auth-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
raa = rxMessageFactory.createReAuthAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' Re-Auth-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.rx.events.ReAuthRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasTFlagSetRAA.
@Test
public void hasTFlagSetRAA() throws Exception {
ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
((DiameterMessageImpl) rar).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Re-Auth-Request", rar.getHeader().isPotentiallyRetransmitted());
ReAuthAnswer raa = rxMessageFactory.createReAuthAnswer(rar);
assertFalse("The 'T' flag should not be set in Re-Auth-Answer", raa.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.rx.events.ReAuthRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isRequestRAR.
// Re-Auth-Request
@Test
public void isRequestRAR() throws Exception {
ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
assertTrue("Request Flag in Re-Auth-Request is not set.", rar.getHeader().isRequest());
}
Aggregations