Search in sources :

Example 1 with ServerAssignmentAnswer

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

the class CxDxFactoriesTest method isProxiableCopiedSAA.

@Test
public void isProxiableCopiedSAA() throws Exception {
    ServerAssignmentRequest sar = cxdxMessageFactory.createServerAssignmentRequest();
    serverSession.fetchSessionData(sar);
    ServerAssignmentAnswer saa = serverSession.createServerAssignmentAnswer();
    assertEquals("The 'P' bit is not copied from request in Server-Assignment-Answer, it should. [RFC3588/6.2]", sar.getHeader().isProxiable(), saa.getHeader().isProxiable());
    // Reverse 'P' bit ...
    ((DiameterMessageImpl) sar).getGenericData().setProxiable(!sar.getHeader().isProxiable());
    assertTrue("The 'P' bit was not modified in Server-Assignment-Request, it should.", sar.getHeader().isProxiable() != saa.getHeader().isProxiable());
    serverSession.fetchSessionData(sar);
    saa = serverSession.createServerAssignmentAnswer();
    assertEquals("The 'P' bit is not copied from request in Server-Assignment-Answer, it should. [RFC3588/6.2]", sar.getHeader().isProxiable(), saa.getHeader().isProxiable());
}
Also used : ServerAssignmentRequest(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest) ServerAssignmentAnswer(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 2 with ServerAssignmentAnswer

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

the class CxDxFactoriesTest method hasTFlagSetSAA.

@Test
public void hasTFlagSetSAA() throws Exception {
    ServerAssignmentRequest sar = cxdxMessageFactory.createServerAssignmentRequest();
    ((DiameterMessageImpl) sar).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Server-Assignment-Request", sar.getHeader().isPotentiallyRetransmitted());
    serverSession.fetchSessionData(sar);
    ServerAssignmentAnswer saa = serverSession.createServerAssignmentAnswer();
    assertFalse("The 'T' flag should not be set in Server-Assignment-Answer", saa.getHeader().isPotentiallyRetransmitted());
}
Also used : ServerAssignmentRequest(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest) ServerAssignmentAnswer(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 3 with ServerAssignmentAnswer

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

the class CxDxFactoriesTest method testGettersAndSettersSAA.

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

Example 4 with ServerAssignmentAnswer

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

the class CxDxServerSessionImpl method createServerAssignmentAnswer.

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

Example 5 with ServerAssignmentAnswer

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

the class CxDxFactoriesTest method hasDestinationHostSAA.

@Test
public void hasDestinationHostSAA() throws Exception {
    serverSession.fetchSessionData(cxdxMessageFactory.createServerAssignmentRequest());
    ServerAssignmentAnswer saa = serverSession.createServerAssignmentAnswer();
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", saa.getDestinationHost());
}
Also used : ServerAssignmentAnswer(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ServerAssignmentAnswer (net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer)8 Test (org.junit.Test)7 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)7 ServerAssignmentRequest (net.java.slee.resource.diameter.cxdx.events.ServerAssignmentRequest)4 DiameterAvp (net.java.slee.resource.diameter.base.events.avp.DiameterAvp)1 ApplicationId (org.jdiameter.api.ApplicationId)1 InternalException (org.jdiameter.api.InternalException)1 CxDxMessageFactoryImpl (org.mobicents.slee.resource.diameter.cxdx.CxDxMessageFactoryImpl)1