Search in sources :

Example 6 with RxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeRAR.

// @Test
// public void testClientSessionApplicationIdChangeASA() throws Exception {
// long vendor = 10415L;
// ApplicationId originalAppId = ((RxMessageFactoryImpl)rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// // let's create a message and see how it comes...
// AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
// rxClientSession.fetchCurrentState(asr);
// AbortSessionAnswer originalASA = rxClientSession.createAbortSessionAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASA);
// 
// // now we switch..
// originalASA = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// 
// // create a new message and see how it comes...
// AbortSessionAnswer changedASA = rxClientSession.createAbortSessionAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASA);
// 
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeRAR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    ReAuthRequest originalRAR = rxMessageFactory.createReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAR);
    // now we switch..
    originalRAR = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    ReAuthRequest changedRAR = rxMessageFactory.createReAuthRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAR);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : ReAuthRequest(net.java.slee.resource.diameter.rx.events.ReAuthRequest) RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with RxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeAAA.

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

Example 8 with RxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testClientSessionApplicationIdChangeAAR.

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

Example 9 with RxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testServerSessionApplicationIdChangeAAA.

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

Example 10 with RxMessageFactoryImpl

use of org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeSTR.

// @Test
// public void testClientSessionApplicationIdChangeRAA() throws Exception {
// long vendor = 10415L;
// ApplicationId originalAppId = ((RxMessageFactoryImpl)rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
// // let's create a message and see how it comes...
// ReAuthRequest rar = rxMessageFactory.createReAuthRequest();
// rxClientSession.fetchCurrentState(rar);
// ReAuthAnswer originalRAA = rxClientSession.createReAuthAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalRAA);
// 
// // now we switch..
// originalRAA = null;
// isVendor = !isVendor;
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// 
// // create a new message and see how it comes...
// ReAuthAnswer changedRAA = rxClientSession.createReAuthAnswer();
// BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedRAA);
// 
// // revert back to default
// ((RxMessageFactoryImpl)rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ?
// originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
// }
@Test
public void testMessageFactoryApplicationIdChangeSTR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((RxMessageFactoryImpl) rxMessageFactory).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 Rx is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    SessionTerminationRequest originalSTR = rxMessageFactory.createSessionTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalSTR);
    // now we switch..
    originalSTR = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    SessionTerminationRequest changedSTR = rxMessageFactory.createSessionTerminationRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedSTR);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) ApplicationId(org.jdiameter.api.ApplicationId) SessionTerminationRequest(net.java.slee.resource.diameter.rx.events.SessionTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ApplicationId (org.jdiameter.api.ApplicationId)12 Test (org.junit.Test)12 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)12 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)12 AARequest (net.java.slee.resource.diameter.rx.events.AARequest)3 SessionTerminationRequest (net.java.slee.resource.diameter.rx.events.SessionTerminationRequest)3 AAAnswer (net.java.slee.resource.diameter.rx.events.AAAnswer)2 SessionTerminationAnswer (net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer)2 AbortSessionAnswer (net.java.slee.resource.diameter.rx.events.AbortSessionAnswer)1 AbortSessionRequest (net.java.slee.resource.diameter.rx.events.AbortSessionRequest)1 ReAuthAnswer (net.java.slee.resource.diameter.rx.events.ReAuthAnswer)1 ReAuthRequest (net.java.slee.resource.diameter.rx.events.ReAuthRequest)1