Search in sources :

Example 1 with GxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeRAR.

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

Example 2 with GxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeCCR.

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

Example 3 with GxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeInServerSessionCCA.

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

Example 4 with GxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeInClientSessionRAA.

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

Example 5 with GxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GxFactoriesTest method testMessageFactoryApplicationIdChangeInClientSessionCCR.

@Test
public void testMessageFactoryApplicationIdChangeInClientSessionCCR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((GxMessageFactoryImpl) gxMessageFactory).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 Gx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    GxCreditControlRequest originalCCR = gxClientSession.createGxCreditControlRequest(CcRequestType.EVENT_REQUEST);
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalCCR);
    // now we switch..
    originalCCR = null;
    isVendor = !isVendor;
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GxCreditControlRequest changedCCR = gxClientSession.createGxCreditControlRequest(CcRequestType.EVENT_REQUEST);
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedCCR);
    // revert back to default
    ((GxMessageFactoryImpl) gxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GxCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest) ApplicationId(org.jdiameter.api.ApplicationId) GxMessageFactoryImpl(org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ApplicationId (org.jdiameter.api.ApplicationId)5 Test (org.junit.Test)5 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)5 GxMessageFactoryImpl (org.mobicents.slee.resource.diameter.gx.GxMessageFactoryImpl)5 GxCreditControlRequest (net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)3 GxCreditControlAnswer (net.java.slee.resource.diameter.gx.events.GxCreditControlAnswer)1 GxReAuthAnswer (net.java.slee.resource.diameter.gx.events.GxReAuthAnswer)1 GxReAuthRequest (net.java.slee.resource.diameter.gx.events.GxReAuthRequest)1