Search in sources :

Example 1 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerActivityImpl method createProfileUpdateAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerActivity#createProfileUpdateAnswer(long, boolean)
   */
public ProfileUpdateAnswer createProfileUpdateAnswer(long resultCode, boolean isExperimentalResult) {
    // Fetch the session stored request
    ProfileUpdateRequest req = (ProfileUpdateRequest) getSessionMessage(ProfileUpdateRequest.commandCode);
    ProfileUpdateAnswer answer = null;
    if (req != null) {
        // Create answer from it
        answer = this.messageFactory.createProfileUpdateAnswer(req, resultCode, isExperimentalResult);
        // 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 : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Example 2 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method createProfileUpdateAnswer.

public ProfileUpdateAnswer createProfileUpdateAnswer(long resultCode, boolean isExperimentalResult) {
    ProfileUpdateAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == ProfileUpdateRequest.commandCode) {
            ProfileUpdateRequest msg = (ProfileUpdateRequest) stateMessages.get(index);
            answer = this.messageFactory.createProfileUpdateAnswer(msg, resultCode, isExperimentalResult);
            if (answer.getAuthSessionState() == null && this.authSessionState != null) {
                answer.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) answer).setData(msg);
            break;
        }
    }
    // answer.setSessionId(super.session.getSessionId());
    return answer;
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Example 3 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerSubscriptionActivityImpl method createProfileUpdateAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#createProfileUpdateAnswer()
   */
public ProfileUpdateAnswer createProfileUpdateAnswer() {
    ProfileUpdateAnswer answer = null;
    for (int index = 0; index < stateMessages.size(); index++) {
        if (stateMessages.get(index).getCommand().getCode() == ProfileUpdateRequest.commandCode) {
            ProfileUpdateRequest msg = (ProfileUpdateRequest) stateMessages.get(index);
            answer = this.messageFactory.createProfileUpdateAnswer(msg);
            if (answer.getAuthSessionState() == null && this.authSessionState != null) {
                answer.setAuthSessionState(this.authSessionState);
            }
            ((DiameterShMessageImpl) answer).setData(msg);
            break;
        }
    }
    // answer.setSessionId(super.session.getSessionId());
    return answer;
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) DiameterShMessageImpl(org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Example 4 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method isRequestPUR.

@Test
public void isRequestPUR() throws Exception {
    ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
    assertTrue("Request Flag in Profile-Update-Request is not set.", pur.getHeader().isRequest());
}
Also used : ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Example 5 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShClientFactoriesTest method testMessageFactoryApplicationIdChangePUR.

@Test
public void testMessageFactoryApplicationIdChangePUR() throws Exception {
    long vendor = 10415L;
    ApplicationId originalAppId = ((ShClientMessageFactoryImpl) shClientFactory).getApplicationId();
    boolean isAuth = originalAppId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isAcct = originalAppId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE;
    boolean isVendor = originalAppId.getVendorId() != 0L;
    assertTrue("Invalid Application-Id (" + originalAppId + "). Should only, and at least, contain either Auth or Acct value.", (isAuth && !isAcct) || (!isAuth && isAcct));
    System.out.println("Default VENDOR-ID for Sh is " + originalAppId.getVendorId());
    // let's create a message and see how it comes...
    ProfileUpdateRequest originalPUR = shClientFactory.createProfileUpdateRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, originalPUR);
    // now we switch..
    originalPUR = null;
    isVendor = !isVendor;
    ((ShClientMessageFactoryImpl) shClientFactory).setApplicationId(isVendor ? vendor : 0L, isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
    // create a new message and see how it comes...
    ProfileUpdateRequest changedPUR = shClientFactory.createProfileUpdateRequest();
    BaseFactoriesTest.checkCorrectApplicationIdAVPs(isVendor, isAuth, isAcct, changedPUR);
    // revert back to default
    ((ShClientMessageFactoryImpl) shClientFactory).setApplicationId(originalAppId.getVendorId(), isAuth ? originalAppId.getAuthAppId() : originalAppId.getAcctAppId());
}
Also used : ShClientMessageFactoryImpl(org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) ApplicationId(org.jdiameter.api.ApplicationId) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)17 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)7 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)4 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)2 ShClientActivity (net.java.slee.resource.diameter.sh.client.ShClientActivity)2 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)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 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)1 Request (org.jdiameter.api.Request)1 ProfileUpdateRequestImpl (org.jdiameter.common.impl.app.sh.ProfileUpdateRequestImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)1 UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)1 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)1