use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerActivityImpl method sendSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerActivity#sendSubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)
*/
public void sendSubscribeNotificationsAnswer(SubscribeNotificationsAnswer message) throws IOException {
try {
DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
fetchSessionData(msg, false);
this.serverSession.sendSubscribeNotificationsAnswer(new SubscribeNotificationsAnswerImpl((Answer) msg.getGenericData()));
clean(msg);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
throw new IOException("Failed to send message, due to: " + e);
}
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerActivityImpl method createSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerActivity#createSubscribeNotificationsAnswer()
*/
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer() {
// Fetch the session stored request
SubscribeNotificationsRequest req = (SubscribeNotificationsRequest) getSessionMessage(SubscribeNotificationsRequest.commandCode);
SubscribeNotificationsAnswer answer = null;
if (req != null) {
// Create answer from it
answer = this.messageFactory.createSubscribeNotificationsAnswer(req);
// Add any extra session data
addSessionData(answer);
// Store request data FIXME: Commented by Alex. Is this needed?
// ((DiameterShMessageImpl)answer).setData(req);
}
return answer;
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method isAnswerSNA.
@Test
public void isAnswerSNA() throws Exception {
SubscribeNotificationsAnswer sna = shServerFactory.createSubscribeNotificationsAnswer(shClientFactory.createSubscribeNotificationsRequest());
assertFalse("Request Flag in Subscribe-Notifications-Answer is set.", sna.getHeader().isRequest());
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method isProxiableCopiedSNA.
@Test
public void isProxiableCopiedSNA() throws Exception {
SubscribeNotificationsRequest snr = shClientFactory.createSubscribeNotificationsRequest();
SubscribeNotificationsAnswer sna = shServerFactory.createSubscribeNotificationsAnswer(snr);
assertEquals("The 'P' bit is not copied from request in Subscribe-Notifications-Answer, it should. [RFC3588/6.2]", snr.getHeader().isProxiable(), sna.getHeader().isProxiable());
// Reverse 'P' bit ...
((DiameterMessageImpl) snr).getGenericData().setProxiable(!snr.getHeader().isProxiable());
assertTrue("The 'P' bit was not modified in Subscribe-Notifications-Request, it should.", snr.getHeader().isProxiable() != sna.getHeader().isProxiable());
sna = shServerFactory.createSubscribeNotificationsAnswer(snr);
assertEquals("The 'P' bit is not copied from request in Subscribe-Notifications-Answer, it should. [RFC3588/6.2]", snr.getHeader().isProxiable(), sna.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method testGettersAndSettersSNA.
@Test
public void testGettersAndSettersSNA() throws Exception {
SubscribeNotificationsAnswer sna = shServerFactory.createSubscribeNotificationsAnswer(shClientFactory.createSubscribeNotificationsRequest());
int nFailures = ShServerAvpAssistant.INSTANCE.testMethods(sna, SubscribeNotificationsAnswer.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Aggregations