Search in sources :

Example 1 with AbortSessionRequest

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

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeASR.

@Test
public void testMessageFactoryApplicationIdChangeASR() 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 originalASR = rxMessageFactory.createAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalASR);
    // now we switch..
    originalASR = null;
    isVendor = !isVendor;
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    AbortSessionRequest changedASR = rxMessageFactory.createAbortSessionRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASR);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : AbortSessionRequest(net.java.slee.resource.diameter.rx.events.AbortSessionRequest) 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 2 with AbortSessionRequest

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

the class RxFactoriesTest method hasTFlagSetASA.

@Test
public void hasTFlagSetASA() throws Exception {
    AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
    ((DiameterMessageImpl) asr).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Abort-Session-Request", asr.getHeader().isPotentiallyRetransmitted());
    AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(asr);
    assertFalse("The 'T' flag should not be set in Abort-Session-Answer", asa.getHeader().isPotentiallyRetransmitted());
}
Also used : AbortSessionRequest(net.java.slee.resource.diameter.rx.events.AbortSessionRequest) AbortSessionAnswer(net.java.slee.resource.diameter.rx.events.AbortSessionAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with AbortSessionRequest

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

the class RxFactoriesTest method isRequestASR.

// Abort-Session-Request
@Test
public void isRequestASR() throws Exception {
    AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
    assertTrue("Request Flag in Abort-Session-Request is not set.", asr.getHeader().isRequest());
}
Also used : AbortSessionRequest(net.java.slee.resource.diameter.rx.events.AbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with AbortSessionRequest

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

the class RxFactoriesTest method isProxiableCopiedASA.

@Test
public void isProxiableCopiedASA() throws Exception {
    AbortSessionRequest rar = rxMessageFactory.createAbortSessionRequest();
    AbortSessionAnswer raa = rxMessageFactory.createAbortSessionAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' Abort-Session-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' Abort-Session-Request, it should.", rar.getHeader().isProxiable() != raa.getHeader().isProxiable());
    raa = rxMessageFactory.createAbortSessionAnswer(rar);
    assertEquals("The 'P' bit is not copied from request in Rx' Abort-Session-Answer, it should. [RFC3588/6.2]", rar.getHeader().isProxiable(), raa.getHeader().isProxiable());
}
Also used : AbortSessionRequest(net.java.slee.resource.diameter.rx.events.AbortSessionRequest) AbortSessionAnswer(net.java.slee.resource.diameter.rx.events.AbortSessionAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with AbortSessionRequest

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

the class RxFactoriesTest method hasRxApplicationIdASR.

@Test
public void hasRxApplicationIdASR() throws Exception {
    AbortSessionRequest asr = rxMessageFactory.createAbortSessionRequest();
    assertTrue("Auth-Application-Id AVP in Rx ASR must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + asr.getAuthApplicationId(), asr.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
Also used : AbortSessionRequest(net.java.slee.resource.diameter.rx.events.AbortSessionRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

AbortSessionRequest (net.java.slee.resource.diameter.rx.events.AbortSessionRequest)7 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 AbortSessionAnswer (net.java.slee.resource.diameter.rx.events.AbortSessionAnswer)2 ApplicationId (org.jdiameter.api.ApplicationId)1 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)1