Search in sources :

Example 1 with AbortSessionAnswer

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

the class RxFactoriesTest method testGettersAndSettersASA.

@Test
public void testGettersAndSettersASA() throws Exception {
    AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
    int nFailures = RxAvpAssistant.INSTANCE.testMethods(asa, AbortSessionAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : AbortSessionAnswer(net.java.slee.resource.diameter.rx.events.AbortSessionAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with AbortSessionAnswer

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

the class RxFactoriesTest method testMessageFactoryApplicationIdChangeASA.

@Test
public void testMessageFactoryApplicationIdChangeASA() 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...
    AbortSessionAnswer originalASA = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
    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 = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedASA);
    // revert back to default
    ((RxMessageFactoryImpl) rxMessageFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : RxMessageFactoryImpl(org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl) AbortSessionAnswer(net.java.slee.resource.diameter.rx.events.AbortSessionAnswer) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with AbortSessionAnswer

use of net.java.slee.resource.diameter.rx.events.AbortSessionAnswer 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 4 with AbortSessionAnswer

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

the class RxFactoriesTest method hasDestinationHostASA.

@Test
public void hasDestinationHostASA() throws Exception {
    AbortSessionAnswer asa = rxMessageFactory.createAbortSessionAnswer(rxMessageFactory.createAbortSessionRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", asa.getDestinationHost());
}
Also used : 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 AbortSessionAnswer

use of net.java.slee.resource.diameter.rx.events.AbortSessionAnswer 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)

Aggregations

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