Search in sources :

Example 6 with AARequest

use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.

the class RxMessageFactoryImpl method createAARequest.

/**
 * {@inheritDoc}
 */
@Override
public AARequest createAARequest(String sessionId) {
    final AARequest aar = this.createAARequest();
    aar.setSessionId(sessionId);
    return aar;
}
Also used : AARequest(net.java.slee.resource.diameter.rx.events.AARequest)

Example 7 with AARequest

use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method isProxiableCopiedAAA.

@Test
public void isProxiableCopiedAAA() throws Exception {
    AARequest rar = rxMessageFactory.createAARequest();
    AAAnswer raa = rxMessageFactory.createAAAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' AA-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) rar).getGenericData().setProxiable(!rar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Rx' AA-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
    raa = rxMessageFactory.createAAAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' AA-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
Also used : AARequest(net.java.slee.resource.diameter.rx.events.AARequest) 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 AARequest

use of net.java.slee.resource.diameter.rx.events.AARequest in project jain-slee.diameter by RestComm.

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeAAR.

@Test
public void testMessageFactoryApplicationIdChangeAAR() 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 = rxMessageFactory.createAARequest();
    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 = rxMessageFactory.createAARequest();
    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)

Aggregations

AARequest (net.java.slee.resource.diameter.rx.events.AARequest)8 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 AAAnswer (net.java.slee.resource.diameter.rx.events.AAAnswer)3 ApplicationId (org.jdiameter.api.ApplicationId)3 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)3 IPFilterRule (net.java.slee.resource.diameter.base.events.avp.IPFilterRule)1 MediaComponentDescriptionAvp (net.java.slee.resource.diameter.rx.events.avp.MediaComponentDescriptionAvp)1 MediaSubComponentAvp (net.java.slee.resource.diameter.rx.events.avp.MediaSubComponentAvp)1