Search in sources :

Example 1 with SubscribeNotificationsRequest

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;
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) SubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)

Example 2 with SubscribeNotificationsRequest

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());
    }
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) Request(org.jdiameter.api.Request) PushNotificationRequest(net.java.slee.resource.diameter.sh.events.PushNotificationRequest) SubscribeNotificationsRequestImpl(org.jdiameter.common.impl.app.sh.SubscribeNotificationsRequestImpl) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException)

Example 3 with SubscribeNotificationsRequest

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));
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) UserIdentityAvpImpl(org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 4 with SubscribeNotificationsRequest

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());
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with SubscribeNotificationsRequest

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);
}
Also used : SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)23 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)7 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)7 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)5 ShClientActivity (net.java.slee.resource.diameter.sh.client.ShClientActivity)5 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)4 IOException (java.io.IOException)3 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)3 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)3 Request (org.jdiameter.api.Request)3 SubscribeNotificationsRequestImpl (org.jdiameter.common.impl.app.sh.SubscribeNotificationsRequestImpl)3 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)2 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)2 UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)2 AvpRepresentation (org.mobicents.diameter.dictionary.AvpRepresentation)1 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)1