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());
}
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());
}
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);
}
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;
}
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());
}
Aggregations