Search in sources :

Example 6 with LocationInfoRequest

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isProxiableLIR.

@Test
public void isProxiableLIR() throws Exception {
    LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
    assertTrue("The 'P' bit is not set by default in Location-Info-Request, it should.", lir.getHeader().isProxiable());
}
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 7 with LocationInfoRequest

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method hasTFlagSetLIA.

@Test
public void hasTFlagSetLIA() throws Exception {
    LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
    ((DiameterMessageImpl) lir).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Location-Info-Request", lir.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(lir);
    LocationInfoAnswer lia = serverSession.createLocationInfoAnswer();
    assertFalse("The 'T' flag should not be set in Location-Info-Answer", lia.getHeader().isPotentiallyRetransmitted());
}
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 8 with LocationInfoRequest

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testGettersAndSettersLIR.

@Test
public void testGettersAndSettersLIR() throws Exception {
    LocationInfoRequest lir = cxdxMessageFactory.createLocationInfoRequest();
    int nFailures = CxDxAvpAssistant.INSTANCE.testMethods(lir, LocationInfoRequest.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
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 9 with LocationInfoRequest

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testServerSessionApplicationIdChangeLIA.

@Test
public void testServerSessionApplicationIdChangeLIA() 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 lir = cxdxMessageFactory.createLocationInfoRequest();
    serverSession.fetchSessionData(lir);
    LocationInfoAnswer originalLIA = serverSession.createLocationInfoAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalLIA);
    // now we switch..
    originalLIA = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    LocationInfoAnswer changedLIA = serverSession.createLocationInfoAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedLIA);
    // 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) LocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 10 with LocationInfoRequest

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest in project jain-slee.diameter by RestComm.

the class CxDxMessageFactoryImpl method createLocationInfoRequest.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxMessageFactory#createLocationInfoRequest(java.lang.String)
   */
public LocationInfoRequest createLocationInfoRequest(String sessionId) throws IllegalArgumentException {
    LocationInfoRequest lir = createLocationInfoRequest();
    lir.setSessionId(sessionId);
    return lir;
}
Also used : LocationInfoRequest(net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest)

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