Search in sources :

Example 1 with GqMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeRAA.

@Test
public void testMessageFactoryApplicationIdChangeRAA() 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...
    GqReAuthAnswer originalRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
    // now we switch..
    originalRAA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqReAuthAnswer changedRAA = gqMessageFactory.createGqReAuthAnswer(gqMessageFactory.createGqReAuthRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqReAuthAnswer(net.java.slee.resource.diameter.gq.events.GqReAuthAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with GqMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeSTA.

@Test
public void testMessageFactoryApplicationIdChangeSTA() 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...
    GqSessionTerminationAnswer originalSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTA);
    // now we switch..
    originalSTA = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqSessionTerminationAnswer changedSTA = gqMessageFactory.createGqSessionTerminationAnswer(gqMessageFactory.createGqSessionTerminationRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTA);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) GqSessionTerminationAnswer(net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with GqMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class GqFactoriesTest method testMessageFactoryApplicationIdChangeRAR.

@Test
public void testMessageFactoryApplicationIdChangeRAR() 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...
    GqReAuthRequest originalRAR = gqMessageFactory.createGqReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
    // now we switch..
    originalRAR = null;
    isVendor = !isVendor;
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    GqReAuthRequest changedRAR = gqMessageFactory.createGqReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
    // revert back to default
    ((GqMessageFactoryImpl) gqMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : GqMessageFactoryImpl(org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) GqReAuthRequest(net.java.slee.resource.diameter.gq.events.GqReAuthRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with GqMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl 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 5 with GqMessageFactoryImpl

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

Aggregations

ApplicationId (org.jdiameter.api.ApplicationId)8 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 GqMessageFactoryImpl (org.mobicents.slee.resource.diameter.gq.GqMessageFactoryImpl)8 GqAAAnswer (net.java.slee.resource.diameter.gq.events.GqAAAnswer)1 GqAARequest (net.java.slee.resource.diameter.gq.events.GqAARequest)1 GqAbortSessionAnswer (net.java.slee.resource.diameter.gq.events.GqAbortSessionAnswer)1 GqAbortSessionRequest (net.java.slee.resource.diameter.gq.events.GqAbortSessionRequest)1 GqReAuthAnswer (net.java.slee.resource.diameter.gq.events.GqReAuthAnswer)1 GqReAuthRequest (net.java.slee.resource.diameter.gq.events.GqReAuthRequest)1 GqSessionTerminationAnswer (net.java.slee.resource.diameter.gq.events.GqSessionTerminationAnswer)1 GqSessionTerminationRequest (net.java.slee.resource.diameter.gq.events.GqSessionTerminationRequest)1