Search in sources :

Example 1 with LocationInfoAnswer

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

the class CxDxFactoriesTest method isAnswerLIA.

@Test
public void isAnswerLIA() throws Exception {
    serverSession.fetchSessionData(cxdxMessageFactory.createLocationInfoRequest());
    LocationInfoAnswer lia = serverSession.createLocationInfoAnswer();
    assertFalse("Request Flag in Location-Info-Answer is set.", lia.getHeader().isRequest());
}
Also used : LocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with LocationInfoAnswer

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

the class CxDxFactoriesTest method hasDestinationRealmLIA.

@Test
public void hasDestinationRealmLIA() throws Exception {
    serverSession.fetchSessionData(cxdxMessageFactory.createLocationInfoRequest());
    LocationInfoAnswer lia = serverSession.createLocationInfoAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", lia.getDestinationRealm());
}
Also used : LocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with LocationInfoAnswer

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer 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 4 with LocationInfoAnswer

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer 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 5 with LocationInfoAnswer

use of net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer 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)

Aggregations

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