Search in sources :

Example 96 with ApplicationId

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeSTR.

@Test
public void testMessageFactoryApplicationIdChangeSTR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqSessionTerminationRequest originalSTR = gqMessageFactory.createGqSessionTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTR);
    // now we switch..
    originalSTR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqSessionTerminationRequest changedSTR = gqMessageFactory.createGqSessionTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqSessionTerminationRequest(net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest) GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 97 with ApplicationId

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeAAA.

@Test
public void testMessageFactoryApplicationIdChangeAAA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqAAAnswer originalAAA = gqMessageFactory.createGqAAAnswer(gqMessageFactory.createGqAARequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAA);
    // now we switch..
    originalAAA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqAAAnswer changedAAA = gqMessageFactory.createGqAAAnswer(gqMessageFactory.createGqAARequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqAAAnswer(net.java.slee.resource.diameter.gq.events.GqAAAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 98 with ApplicationId

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeASA.

@Test
public void testMessageFactoryApplicationIdChangeASA() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqAbortSessionAnswer originalASA = gqMessageFactory.createGqAbortSessionAnswer(gqMessageFactory.createGqAbortSessionRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASA);
    // now we switch..
    originalASA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqAbortSessionAnswer changedASA = gqMessageFactory.createGqAbortSessionAnswer(gqMessageFactory.createGqAbortSessionRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqAbortSessionAnswer(net.java.slee.resource.diameter.gq.events.GqAbortSessionAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 99 with ApplicationId

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeASR.

@Test
public void testMessageFactoryApplicationIdChangeASR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqAbortSessionRequest originalASR = gqMessageFactory.createGqAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASR);
    // now we switch..
    originalASR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqAbortSessionRequest changedASR = gqMessageFactory.createGqAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqAbortSessionRequest(net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 100 with ApplicationId

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

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeAAR.

@Test
public void testMessageFactoryApplicationIdChangeAAR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GqMessageFactoryImpl) gqMessageFactory).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 Gq is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GqAARequest originalAAR = gqMessageFactory.createGqAARequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalAAR);
    // now we switch..
    originalAAR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqAARequest changedAAR = gqMessageFactory.createGqAARequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedAAR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqAARequest(net.java.slee.resource.diameter.gq.events.GqAARequest) 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