use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasRxApplicationIdAAR.
// // AA-Request
//
// @Test
// public void isRequestAAR() throws Exception {
// AARequest aar = rxMessageFactory.createAARequest();
// assertTrue("Request Flag in AA-Request is not set.", aar.getHeader().isRequest());
// }
//
// @Test
// public void isProxiableAAR() throws Exception {
// AARequest rar = rxMessageFactory.createAARequest();
// assertTrue("The 'P' bit is not set by default in Rx' AA-Request, it should.", rar.getHeader().isProxiable());
// }
//
// @Test
// public void testGettersAndSettersAAR() throws Exception {
// AARequest aar = rxMessageFactory.createAARequest();
// int nFailures = RxAvpAssistant.INSTANCE.testMethods(aar, AARequest.class);
//
// assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
// }
//
@Test
public void hasRxApplicationIdAAR() throws Exception {
AARequest aar = rxMessageFactory.createAARequest();
assertTrue("Auth-Application-Id AVP in Rx AAR must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + aar.getAuthApplicationId(), aar.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasTFlagSetAAA.
@Test
public void hasTFlagSetAAA() throws Exception {
AARequest aar = rxMessageFactory.createAARequest();
((DiameterMessageImpl) aar).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in AA-Request", aar.getHeader().isPotentiallyRetransmitted());
AAAnswer aaa = rxMessageFactory.createAAAnswer(aar);
assertFalse("The 'T' flag should not be set in AA-Answer", aaa.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMediaComponentDescription.
@Test
public void testMediaComponentDescription() {
AARequest aar = rxMessageFactory.createAARequest();
MediaComponentDescriptionAvp mcdAvp = rxAvpFactory.createMediaComponentDescription();
MediaSubComponentAvp mscAvp = rxAvpFactory.createMediaSubComponent();
mscAvp.setFlowUsage(FlowUsage.AF_SIGNALLING);
IPFilterRule fd1Avp = new IPFilterRule("permit in ip from 192.168.0.0/24 10,11,12,20-30 to 192.168.1.1 99 frag established");
IPFilterRule fd2Avp = new IPFilterRule("permit out 2 from 192.1.0.0/24 to 192.1.1.1/0 frag established setup tcpoptions mrss");
IPFilterRule fd3Avp = new IPFilterRule("permit out 4 from 10.0.1.91 4060 to 10.0.0.190 43772 ");
mscAvp.setFlowDescriptions(new IPFilterRule[] { fd1Avp, fd2Avp, fd3Avp });
mcdAvp.setMediaSubComponent(mscAvp);
aar.setMediaComponentDescription(mcdAvp);
// from Richard Good
if (aar.hasMediaComponentDescription()) {
System.err.println("Has media component description");
MediaComponentDescriptionAvp[] mcd = aar.getMediaComponentDescriptions();
if (mcd[0].hasMediaSubComponent()) {
System.err.println("Has media sub component");
MediaSubComponentAvp[] msc = mcd[0].getMediaSubComponents();
if (msc[0].hasFlowUsage()) {
System.err.println("Has flow usage");
}
System.err.println("msc[0] flow usage: " + msc[0].getFlowUsage());
System.err.println("msc[0] flow usage value: " + msc[0].getFlowUsage().getValue());
// other from Richarg Good
IPFilterRule[] ipf = msc[0].getFlowDescriptions();
System.err.println("msc[0] flow descriptions " + ipf.toString());
System.err.println("msc[0] flow description length " + ipf.length);
for (int b = 0; b < ipf.length; b++) {
// THIS DOES NOT PRINT!
System.err.println("msc[0] flow description " + ipf[b].toString());
}
}
}
}
use of net.java.slee.resource.diameter.rx.events.AARequest 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 net.java.slee.resource.diameter.rx.events.AARequest 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