use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest 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.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.
the class ShClientSubscriptionActivityImpl method sendUnsubscribeRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.ShClientSubscriptionActivity#sendUnsubscribeRequest()
*/
public void sendUnsubscribeRequest() throws IOException {
try {
SubscribeNotificationsRequest snr = this.messageFactory.createSubscribeNotificationsRequest(getSubscribedUserIdentity(), this.dataReferenceType[0], SubsReqType.UNSUBSCRIBE);
snr.setDataReferences(this.dataReferenceType);
snr.setDestinationRealm(remoteRealm);
snr.setAuthSessionState(authSessionState);
DiameterMessageImpl msg = (DiameterMessageImpl) snr;
this.clientSession.sendSubscribeNotificationsRequest(new SubscribeNotificationsRequestImpl((Request) msg.getGenericData()));
} 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.getLocalizedMessage());
}
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method isSNRPublicIdentityAccessibleTwice.
@Test
public void isSNRPublicIdentityAccessibleTwice() throws Exception {
String originalValue = "sip:alexandre@diameter.mobicents.org";
UserIdentityAvpImpl uiAvp = new UserIdentityAvpImpl(DiameterShAvpCodes.USER_IDENTITY, 10415L, 1, 0, new byte[] {});
uiAvp.setPublicIdentity(originalValue);
SubscribeNotificationsRequest udr = shClientFactory.createSubscribeNotificationsRequest(uiAvp, DataReferenceType.IMS_PUBLIC_IDENTITY, SubsReqType.SUBSCRIBE);
String obtainedValue1 = udr.getUserIdentity().getPublicIdentity();
String obtainedValue2 = udr.getUserIdentity().getPublicIdentity();
assertTrue("Obtained value for Public-Identity AVP differs from original.", obtainedValue1.equals(originalValue));
assertTrue("Obtained #1 value for Public-Identity AVP differs from Obtained #2.", obtainedValue1.equals(obtainedValue2));
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method isProxiableSNR.
@Test
public void isProxiableSNR() throws Exception {
SubscribeNotificationsRequest snr = shClientFactory.createSubscribeNotificationsRequest();
assertTrue("The 'P' bit is not set by default in Subscribe-Notifications-Request, it should.", snr.getHeader().isProxiable());
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest in project jain-slee.diameter by RestComm.
the class ShClientFactoriesTest method testGettersAndSettersSNR.
@Test
public void testGettersAndSettersSNR() throws Exception {
SubscribeNotificationsRequest snr = shClientFactory.createSubscribeNotificationsRequest();
int nFailures = ShClientAvpAssistant.INSTANCE.testMethods(snr, SubscribeNotificationsRequest.class);
assertEquals("Some methods have failed. See logs for more details.", 0, nFailures);
}
Aggregations