use of net.java.slee.resource.diameter.rx.events.AbortSessionAnswer in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testGettersAndSettersASA.
@Test
public void testGettersAndSettersASA() throws Exception {
AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
int nFailures = RxAvpAssistant.INSTANCE.testMethods(asa, AbortSessionAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionAnswer 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 net.java.slee.resource.diameter.rx.events.AbortSessionAnswer 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.AbortSessionAnswer in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasDestinationHostASA.
@Test
public void hasDestinationHostASA() throws Exception {
AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", asa.getDestinationHost());
}
use of net.java.slee.resource.diameter.rx.events.AbortSessionAnswer 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());
}
Aggregations