use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasTFlagSetMAA.
@Test
public void hasTFlagSetMAA() throws Exception {
MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
((DiameterMessageImpl) mar).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Multimedia-Authentication-Request", mar.getHeader().isPotentiallyRetransmitted());
serverSession.fetchSessionData(mar);
MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
assertFalse("The 'T' flag should not be set in Multimedia-Authentication-Answer", maa.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isProxiableCopiedMAA.
@Test
public void isProxiableCopiedMAA() throws Exception {
MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
serverSession.fetchSessionData(mar);
MultimediaAuthenticationAnswer maa = serverSession.createMultimediaAuthenticationAnswer();
assertEquals("The 'P' bit is not copied from request in Multimedia-Authentication-Answer, it should. [RFC3588/6.2]", mar.getHeader().isProxiable(), maa.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) mar).getGenericData().setProxiable(!mar.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Multimedia-Authentication-Request, it should.", mar.getHeader().isProxiable() != maa.getHeader().isProxiable());
serverSession.fetchSessionData(mar);
maa = serverSession.createMultimediaAuthenticationAnswer();
assertEquals("The 'P' bit is not copied from request in Multimedia-Authentication-Answer, it should. [RFC3588/6.2]", mar.getHeader().isProxiable(), maa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isProxiableMAR.
@Test
public void isProxiableMAR() throws Exception {
MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
assertTrue("The 'P' bit is not set by default in Multimedia-Authentication-Request, it should.", mar.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testClientSessionApplicationIdChangeMAR.
@Test
public void testClientSessionApplicationIdChangeMAR() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((CxDxMessageFactoryImpl) cxdxMessageFactory).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 CxDx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
MultimediaAuthenticationRequest originalMAR = clientSession.createMultimediaAuthenticationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalMAR);
// now we switch..
originalMAR = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
MultimediaAuthenticationRequest changedMAR = clientSession.createMultimediaAuthenticationRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedMAR);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testServerSessionApplicationIdChangeMAA.
@Test
public void testServerSessionApplicationIdChangeMAA() throws Exception {
long vendor = 10415L;
ApplicationId originalAppId = ((CxDxMessageFactoryImpl) cxdxMessageFactory).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 CxDx is " + originalAppId.getVendorId());
// let's create a message and see how it comes...
MultimediaAuthenticationRequest mar = cxdxMessageFactory.createMultimediaAuthenticationRequest();
serverSession.fetchSessionData(mar);
MultimediaAuthenticationAnswer originalMAA = serverSession.createMultimediaAuthenticationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalMAA);
// now we switch..
originalMAA = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
MultimediaAuthenticationAnswer changedMAA = serverSession.createMultimediaAuthenticationAnswer();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedMAA);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations