use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method hasTFlagSetSTA.
@Test
public void hasTFlagSetSTA() throws Exception {
SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
((DiameterMessageImpl) str).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Session-Termination-Request", str.getHeader().isPotentiallyRetransmitted());
SessionTerminationAnswer sta = rxMessageFactory.createSessionTerminationAnswer(str);
assertFalse("The 'T' flag should not be set in Session-Termination-Answer", sta.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testServerSessionApplicationIdChangeSTA.
@Test
public void testServerSessionApplicationIdChangeSTA() 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...
SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
rxServerSession.fetchCurrentState(str);
SessionTerminationAnswer originalSTA = rxServerSession.createSessionTermAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
// now we switch..
originalSTA = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
SessionTerminationAnswer changedSTA = rxServerSession.createSessionTermAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isProxiableSTR.
@Test
public void isProxiableSTR() throws Exception {
SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
assertTrue("The 'P' bit is not set by default in Session-Termination-Request, it should.", str.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method isProxiableCopiedSTA.
@Test
public void isProxiableCopiedSTA() throws Exception {
SessionTerminationRequest str = rxMessageFactory.createSessionTerminationRequest();
SessionTerminationAnswer sta = rxMessageFactory.createSessionTerminationAnswer(str);
assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) str).getGenericData().setProxiable(!str.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Session-Termination-Request, it should.", str.getHeader().isProxiable() != sta.getHeader().isProxiable());
sta = rxMessageFactory.createSessionTerminationAnswer(str);
assertEquals("The 'P' bit is not copied from request in Session-Termination-Answer, it should. [RFC3588/6.2]", str.getHeader().isProxiable(), sta.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.rx.events.SessionTerminationRequest in project jain-slee.diameter by RestComm.
the class RxFactoriesTest method testMessageFactoryApplicationIdChangeSTR.
// @Test
// public void testClientSessionApplicationIdChangeRAA() 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 rar = rxMessageFactory.createReAuthRequest();
// rxClientSession.fetchCurrentState(rar);
// ReAuthAnswer originalRAA = rxClientSession.createReAuthAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
//
// // now we switch..
// originalRAA = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
//
// // create a new message and see how it comes...
// ReAuthAnswer changedRAA = rxClientSession.createReAuthAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
//
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeSTR() 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...
SessionTerminationRequest originalSTR = rxMessageFactory.createSessionTerminationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTR);
// now we switch..
originalSTR = null;
isVendor = !isVendor;
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
SessionTerminationRequest changedSTR = rxMessageFactory.createSessionTerminationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTR);
// revert back to default
((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations