use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxMessageFactoryImpl method createAARequest.
/**
* {@inheritDoc}
*/
@Override
public AARequest createAARequest(String sessionId) {
final AARequest aar = this.createAARequest();
aar.setSessionId(sessionId);
return aar;
}
use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isProxiableCopiedAAA.
@Test
public void isProxiableCopiedAAA() throws Exception {
AARequest rar = rxMessageFactory.createAARequest();
AAAnswer raa = rxMessageFactory.createAAAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' AA-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' AA-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
raa = rxMessageFactory.createAAAnswer(rar);
assertEquals("The 'P' bit is not copied from request in Rx' AA-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeAAR.
@Test
public void testMessageFactoryApplicationIdChangeAAR() 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 = rxMessageFactory.createAARequest();
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 = rxMessageFactory.createAARequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations