Search in sources :

Example 6 with AAAnswer

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

the class RxServerSessionActivityImpl method sendAAAnswer.

/**
 * {@inheritDoc}
 */
@Override
public void sendAAAnswer(final AAAnswer aaa) throws IOException {
    fetchCurrentState(aaa);
    final DiameterMessageImpl msg = (DiameterMessageImpl) aaa;
    try {
        session.sendAAAnswer(new RxAAAnswerImpl((Answer) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        final AvpNotAllowedException anae = new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
        throw anae;
    } catch (Exception e) {
        throw new IOException("Failed to send message.", e);
    }
}
Also used : AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) SessionTerminationAnswer(net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer) Answer(org.jdiameter.api.Answer) RxAAAnswerImpl(org.jdiameter.common.impl.app.rx.RxAAAnswerImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException)

Example 7 with AAAnswer

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

the class RxFactoriesTest method hasRxApplicationIdAAA.

@Test
public void hasRxApplicationIdAAA() throws Exception {
    rxServerSession.fetchCurrentState(rxMessageFactory.createAARequest());
    AAAnswer aaa = rxServerSession.createAAAnswer();
    assertTrue("Auth-Application-Id AVP in Rx AAA must be " + RxMessageFactory._Rx_AUTH_APP_ID + ", it is " + aaa.getAuthApplicationId(), aaa.getAuthApplicationId() == RxMessageFactory._Rx_AUTH_APP_ID);
}
Also used : 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 AAAnswer

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

the class RxFactoriesTest method testGettersAndSettersAAA.

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

Example 9 with AAAnswer

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

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

the class RxFactoriesTest method isAnswerAAA.

// AA-Answer
@Test
public void isAnswerAAA() throws Exception {
    rxServerSession.fetchCurrentState(rxMessageFactory.createAARequest());
    AAAnswer aaa = rxServerSession.createAAAnswer();
    assertFalse("Request Flag in AA-Answer is set.", aaa.getHeader().isRequest());
}
Also used : AAAnswer(net.java.slee.resource.diameter.rx.events.AAAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

AAAnswer (net.java.slee.resource.diameter.rx.events.AAAnswer)10 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 AARequest (net.java.slee.resource.diameter.rx.events.AARequest)3 ApplicationId (org.jdiameter.api.ApplicationId)2 RxMessageFactoryImpl (org.mobicents.slee.resource.diameter.rx.RxMessageFactoryImpl)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 SessionTerminationAnswer (net.java.slee.resource.diameter.rx.events.SessionTerminationAnswer)1 Answer (org.jdiameter.api.Answer)1 RxAAAnswerImpl (org.jdiameter.common.impl.app.rx.RxAAAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1