Search in sources :

Example 66 with ApplicationId

use of org.jdiameter.api.ApplicationId 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 67 with ApplicationId

use of org.jdiameter.api.ApplicationId 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)

Example 68 with ApplicationId

use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testServerSessionApplicationIdChangeSAA.

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

Example 69 with ApplicationId

use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testClientSessionApplicationIdChangePPA.

@Test
public void testClientSessionApplicationIdChangePPA() 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...
    PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
    clientSession.fetchSessionData(ppr);
    PushProfileAnswer originalPPA = clientSession.createPushProfileAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPPA);
    // now we switch..
    originalPPA = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    PushProfileAnswer changedPPA = clientSession.createPushProfileAnswer();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPPA);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : PushProfileAnswer(net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer) CxDxMessageFactoryImpl(org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) PushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 70 with ApplicationId

use of org.jdiameter.api.ApplicationId in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testClientSessionApplicationIdChangeMAR.

@Test
public void testClientSessionApplicationIdChangeMAR() 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...
    MultimediaAuthenticationRequest originalMAR = clientSession.createMultimediaAuthenticationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalMAR);
    // now we switch..
    originalMAR = null;
    isVendor = !isVendor;
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    MultimediaAuthenticationRequest changedMAR = clientSession.createMultimediaAuthenticationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedMAR);
    // revert back to default
    ((CxDxMessageFactoryImpl) cxdxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : MultimediaAuthenticationRequest(net.java.slee.resource.diameter.cxdx.events.MultimediaAuthenticationRequest) 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)103 Test (org.junit.Test)76 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)76 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)18 S6aMessageFactoryImpl (org.mobicents.slee.resource.diameter.s6a.S6aMessageFactoryImpl)16 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)12 ObjectName (javax.management.ObjectName)11 InvalidConfigurationException (javax.slee.resource.InvalidConfigurationException)11 CreateActivityException (net.java.slee.resource.diameter.base.CreateActivityException)11 AvpDataException (org.jdiameter.api.AvpDataException)11 ISessionFactory (org.jdiameter.client.api.ISessionFactory)11 DiameterStackMultiplexerMBean (org.mobicents.diameter.stack.DiameterStackMultiplexerMBean)11 DiameterAvpFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterAvpFactoryImpl)10 OperationNotSupportedException (javax.naming.OperationNotSupportedException)9 DiameterMessageFactoryImpl (org.mobicents.slee.resource.diameter.base.DiameterMessageFactoryImpl)8 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)8 IOException (java.io.IOException)7 IllegalDiameterStateException (org.jdiameter.api.IllegalDiameterStateException)7 InternalException (org.jdiameter.api.InternalException)7 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)7