use of net.java.slee.resource.diameter.rx.events.AbortSessionRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeASR.
@Test
public void testMessageFactoryApplicationIdChangeASR() 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 originalASR = rxMessageFactory.createAbortSessionRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASR);
// now we switch..
originalASR = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
AbortSessionRequest changedASR = rxMessageFactory.createAbortSessionRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasTFlagSetASA.
@Test
public void hasTFlagSetASA() throws Exception {
AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
((DiameterMessageImpl) asr).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Abort-Session-Request", asr.getHeader().isPotentiallyRetransmitted());
AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(asr);
assertFalse("The 'T' flag should not be set in Abort-Session-Answer", asa.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isRequestASR.
// Abort-Session-Request
@Test
public void isRequestASR() throws Exception {
AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
assertTrue("Request Flag in Abort-Session-Request is not set.", asr.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isProxiableCopiedASA.
@Test
public void isProxiableCopiedASA() throws Exception {
AbortSessionRequest rar = rxMessageFactory.createAbortSessionRequest();
AbortSessionAnswer raa = rxMessageFactory.createAbortSessionAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' Abort-Session-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' Abort-Session-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
raa = rxMessageFactory.createAbortSessionAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' Abort-Session-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasRxApplicationIdASR.
@Test
public void hasRxApplicationIdASR() throws Exception {
AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
assertTrue("Auth-Application-Id AVP in Rx ASR must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + asr.getAuthApplicationId(), asr.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
Aggregations