use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.
the class CxDxClientSessionImpl method createLocationInfoRequest.
/* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createLocationInfoRequest()
*/
public LocationInfoRequest createLocationInfoRequest() {
// Create the request
LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest(super.getSessionId());
// Fill session related AVPs, if present
fillSessionAVPs(lir);
return lir;
}
use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isRequestLIR.
// // test set application-id
// @Test
// public void testSetApplicationId() throws Exception {
// ApplicationId appId = ((CxDxMessageFactoryImpl)cxdxMessageFactory).getApplicationId();
// long vendorId = appId.getVendorId();
// long authAppId = appId.getAuthAppId();
//
// assertTrue("Auth-Application-Id in Message Factory is not correctly set", authAppId != 0);
//
// LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
// if(vendorId != 0) {
// VendorSpecificApplicationIdAvp vsaiAvp = lir.getVendorSpecificApplicationId();
//
// assertFalse("No Vendor-Specific-Application-Id AVP found.", vsaiAvp == null);
//
// long msgAuthAppId = vsaiAvp.getAuthApplicationId();
//
// assertEquals("Auth-Application-Id in Vendor-Specific-Application-Id does not match factory value.", authAppId,
// msgAuthAppId);
// }
// else {
// DiameterAvp authAppIdAvp = null;
// DiameterAvp[] avps = lir.getAvps();
// for (DiameterAvp avp : avps) {
// if(avp.getCode() == Avp.AUTH_APPLICATION_ID) {
// authAppIdAvp = avp;
// break;
// }
// }
//
// assertFalse("No Auth-Application-Id AVP found.", authAppIdAvp == null);
//
// long msgAuthAppId = authAppIdAvp.longValue();
//
// }
// }
@Test
public void isRequestLIR() throws Exception {
LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
assertTrue("Request Flag in Location-Info-Request is not set.", lir.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testClientSessionApplicationIdChangeLIR.
@Test
public void testClientSessionApplicationIdChangeLIR() 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...
LocationInfoRequest originalLIR = clientSession.createLocationInfoRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalLIR);
// now we switch..
originalLIR = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
LocationInfoRequest changedLIR = clientSession.createLocationInfoRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedLIR);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isProxiableCopiedLIA.
@Test
public void isProxiableCopiedLIA() throws Exception {
LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
serverSession.fetchSessionData(lir);
LocationInfoAnswer lia = serverSession.createLocationInfoAnswer();
assertEquals("The 'P' bit is not copied from request in Location-Info-Answer, it should. [RFC3588/6.2]", lir.getHeader().isProxiable(), lia.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) lir).getGenericData().setProxiable(!lir.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Location-Info-Request, it should.", lir.getHeader().isProxiable() != lia.getHeader().isProxiable());
serverSession.fetchSessionData(lir);
lia = serverSession.createLocationInfoAnswer();
assertEquals("The 'P' bit is not copied from request in Location-Info-Answer, it should. [RFC3588/6.2]", lir.getHeader().isProxiable(), lia.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method testMessageFactoryApplicationIdChangeLIR.
@Test
public void testMessageFactoryApplicationIdChangeLIR() 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...
LocationInfoRequest originalLIR = cxdxMessageFactory.createLocationInfoRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalLIR);
// now we switch..
originalLIR = null;
isVendor = !isVendor;
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// create a new message and see how it comes...
LocationInfoRequest changedLIR = cxdxMessageFactory.createLocationInfoRequest();
BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedLIR);
// revert back to default
((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Aggregations