Search in sources :

Example 6 with CxDxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testServerSessionApplicationIdChangeRTR.

@Test
public void testServerSessionApplicationIdChangeRTR() 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...
    RegistrationTerminationRequest originalRTR = serverSession.createRegistrationTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRTR);
    // now we switch..
    originalRTR = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    RegistrationTerminationRequest changedRTR = serverSession.createRegistrationTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRTR);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) 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 7 with CxDxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testClientSessionApplicationIdChangeRTA.

@Test
public void testClientSessionApplicationIdChangeRTA() 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...
    RegistrationTerminationRequest rtr = cxdxMessageFactory.createRegistrationTerminationRequest();
    clientSession.fetchSessionData(rtr);
    RegistrationTerminationAnswer originalRTA = clientSession.createRegistrationTerminationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRTA);
    // now we switch..
    originalRTA = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    RegistrationTerminationAnswer changedRTA = clientSession.createRegistrationTerminationAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRTA);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) 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 8 with CxDxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl 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)

Example 9 with CxDxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testClientSessionApplicationIdChangeSAR.

@Test
public void testClientSessionApplicationIdChangeSAR() 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...
    ServerAssignmentRequest originalSAR = clientSession.createServerAssignmentRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSAR);
    // now we switch..
    originalSAR = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    ServerAssignmentRequest changedSAR = clientSession.createServerAssignmentRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSAR);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : ServerAssignmentRequest(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest) 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 10 with CxDxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testMessageFactoryApplicationIdChangeRTR.

@Test
public void testMessageFactoryApplicationIdChangeRTR() 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...
    RegistrationTerminationRequest originalRTR = cxdxMessageFactory.createRegistrationTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRTR);
    // now we switch..
    originalRTR = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    RegistrationTerminationRequest changedRTR = cxdxMessageFactory.createRegistrationTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRTR);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) 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

ApplicationId (org.jdiameter.api.ApplicationId)18 Test (org.junit.Test)18 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)18 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)18 LocationInfoRequest (net.java.slee.resource.diameter.cxdx.events.LocationInfoRequest)3 MultimediaAuthenticationRequest (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest)3 PushProfileRequest (net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)3 RegistrationTerminationRequest (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)3 ServerAssignmentRequest (net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest)3 UserAuthorizationRequest (net.java.slee.resource.diameter.cxdx.events.UserAuthorizationRequest)3 LocationInfoAnswer (net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer)1 MultimediaAuthenticationAnswer (net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationAnswer)1 PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)1 RegistrationTerminationAnswer (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer)1 ServerAssignmentAnswer (net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer)1 UserAuthorizationAnswer (net.java.slee.resource.diameter.cxdx.events.UserAuthorizationAnswer)1