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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations