Search in sources :

Example 1 with LocationInfoRequest

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;
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest)

Example 2 with LocationInfoRequest

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());
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with LocationInfoRequest

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());
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest) CxDxMessageFactoryImpl(org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with LocationInfoRequest

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());
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest) LocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with LocationInfoRequest

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());
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest) CxDxMessageFactoryImpl(org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

LocationInfoRequest (net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest)11 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 LocationInfoAnswer (net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer)4 ApplicationId (org.jdiameter.api.ApplicationId)3 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)3 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 InternalException (org.jdiameter.api.InternalException)1