Search in sources :

Example 6 with RegistrationTerminationAnswer

use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isAnswerRTA.

@Test
public void isAnswerRTA() throws Exception {
    clientSession.fetchSessionData(cxdxMessageFactory.createRegistrationTerminationRequest());
    RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
    assertFalse("Request Flag in Registration-Termination-Answer is set.", rta.getHeader().isRequest());
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 7 with RegistrationTerminationAnswer

use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method testGettersAndSettersRTA.

@Test
public void testGettersAndSettersRTA() throws Exception {
    clientSession.fetchSessionData(cxdxMessageFactory.createRegistrationTerminationRequest());
    RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
    int nFailures = CxDxAvpAssistant.INSTANCE.testMethods(rta, RegistrationTerminationAnswer.class);
    assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 8 with RegistrationTerminationAnswer

use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.

the class CxDxClientSessionImpl method createRegistrationTerminationAnswer.

/* (non-Javadoc)
   * @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createRegistrationTerminationRequest()
   */
public RegistrationTerminationAnswer createRegistrationTerminationAnswer() {
    // Make sure we have the correct type of Request
    if (!(lastRequest instanceof RegistrationTerminationRequest)) {
        logger.warn("Invalid type of answer for this activity.");
        return null;
    }
    try {
        // Create the answer
        RegistrationTerminationAnswer rta = (RegistrationTerminationAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, RegistrationTerminationAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
        // Fill session related AVPs, if present
        fillSessionAVPs(rta);
        return rta;
    } catch (InternalException e) {
        logger.error("Failed to create Registration-Termination-Answer.", e);
    }
    return null;
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) DiameterAvp(net.java.slee.resource.diameter.base.events.avp.DiameterAvp) InternalException(org.jdiameter.api.InternalException)

Example 9 with RegistrationTerminationAnswer

use of net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer in project jain-slee.diameter by RestComm.

the class CxDxFactoriesTest method isProxiableCopiedRTA.

@Test
public void isProxiableCopiedRTA() throws Exception {
    RegistrationTerminationRequest rtr = cxdxMessageFactory.createRegistrationTerminationRequest();
    clientSession.fetchSessionData(rtr);
    RegistrationTerminationAnswer rta = clientSession.createRegistrationTerminationAnswer();
    assertEquals("The 'P' bit is not copied from request in Registration-Termination-Answer, it should. [RFC3588/6.2]", rtr.getHeader().isProxiable(), rta.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) rtr).getGenericData().setProxiable(!rtr.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Registration-Termination-Request, it should.", rtr.getHeader().isProxiable() != rta.getHeader().isProxiable());
    clientSession.fetchSessionData(rtr);
    rta = clientSession.createRegistrationTerminationAnswer();
    assertEquals("The 'P' bit is not copied from request in Registration-Termination-Answer, it should. [RFC3588/6.2]", rtr.getHeader().isProxiable(), rta.getHeader().isProxiable());
}
Also used : RegistrationTerminationAnswer(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer) RegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

RegistrationTerminationAnswer (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationAnswer)9 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 RegistrationTerminationRequest (net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)4 InternalException (org.jdiameter.api.InternalException)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 PushProfileAnswer (net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer)1 Answer (org.jdiameter.api.Answer)1 ApplicationId (org.jdiameter.api.ApplicationId)1 JRegistrationTerminationAnswerImpl (org.jdiameter.common.impl.app.cxdx.JRegistrationTerminationAnswerImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)1