use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxClientSessionImpl method createPushProfileAnswer.
/* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxClientSession#createPushProfileAnswer()
*/
public PushProfileAnswer createPushProfileAnswer() {
// Make sure we have the correct type of Request
if (!(lastRequest instanceof PushProfileRequest)) {
logger.warn("Invalid type of answer for this activity.");
return null;
}
try {
// Create the answer
PushProfileAnswer ppa = (PushProfileAnswer) this.cxdxMessageFactory.createCxDxMessage(lastRequest.getHeader(), new DiameterAvp[] {}, PushProfileAnswer.COMMAND_CODE, cxdxMessageFactory.getApplicationId());
// Fill session related AVPs, if present
fillSessionAVPs(ppa);
return ppa;
} catch (InternalException e) {
logger.error("Failed to create Push-Profile-Answer.", e);
}
return null;
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isAnswerPPA.
@Test
public void isAnswerPPA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
assertFalse("Request Flag in Push-Profile-Answer is set.", ppa.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method isProxiableCopiedPPA.
@Test
public void isProxiableCopiedPPA() throws Exception {
PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
clientSession.fetchSessionData(ppr);
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
assertEquals("The 'P' bit is not copied from request in Push-Profile-Answer, it should. [RFC3588/6.2]", ppr.getHeader().isProxiable(), ppa.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) ppr).getGenericData().setProxiable(!ppr.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Push-Profile-Request, it should.", ppr.getHeader().isProxiable() != ppa.getHeader().isProxiable());
clientSession.fetchSessionData(ppr);
ppa = clientSession.createPushProfileAnswer();
assertEquals("The 'P' bit is not copied from request in Push-Profile-Answer, it should. [RFC3588/6.2]", ppr.getHeader().isProxiable(), ppa.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasTFlagSetPPA.
@Test
public void hasTFlagSetPPA() throws Exception {
PushProfileRequest ppr = cxdxMessageFactory.createPushProfileRequest();
((DiameterMessageImpl) ppr).getGenericData().setReTransmitted(true);
assertTrue("The 'T' flag should be set in Push-Profile-Request", ppr.getHeader().isPotentiallyRetransmitted());
clientSession.fetchSessionData(ppr);
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
assertFalse("The 'T' flag should not be set in Push-Profile-Answer", ppa.getHeader().isPotentiallyRetransmitted());
}
use of net.java.slee.resource.diameter.cxdx.events.PushProfileAnswer in project jain-slee.diameter by RestComm.
the class CxDxFactoriesTest method hasDestinationRealmPPA.
@Test
public void hasDestinationRealmPPA() throws Exception {
clientSession.fetchSessionData(cxdxMessageFactory.createPushProfileRequest());
PushProfileAnswer ppa = clientSession.createPushProfileAnswer();
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", ppa.getDestinationRealm());
}
Aggregations