Search in sources :

Example 1 with ProfileUpdateAnswer

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer 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 ProfileUpdateAnswer

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer 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 ProfileUpdateAnswer

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer 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 ProfileUpdateAnswer

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

the class ShServerFactoriesTest method hasTFlagSetPUA.

@Test
public void hasTFlagSetPUA() throws Exception {
    ProfileUpdateRequest pur = shClientFactory.createProfileUpdateRequest();
    ((DiameterMessageImpl) pur).getGenericData().setReTransmitted(true);
    assertTrue("The 'T' flag should be set in Profile-Update-Request", pur.getHeader().isPotentiallyRetransmitted());
    ProfileUpdateAnswer pua = shServerFactory.createProfileUpdateAnswer(pur);
    assertFalse("The 'T' flag should not be set in Profile-Update-Answer", pua.getHeader().isPotentiallyRetransmitted());
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) 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 ProfileUpdateAnswer

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

the class ShServerFactoriesTest method hasDestinationRealmPUA.

@Test
public void hasDestinationRealmPUA() throws Exception {
    ProfileUpdateAnswer pua = shServerFactory.createProfileUpdateAnswer(shClientFactory.createProfileUpdateRequest());
    assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", pua.getDestinationRealm());
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) Test(org.junit.Test) BaseFactoriesTest(org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)

Aggregations

ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)15 Test (org.junit.Test)9 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)9 ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)7 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)4 IOException (java.io.IOException)2 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)2 SubscribeNotificationsAnswer (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)2 UserDataAnswer (net.java.slee.resource.diameter.sh.events.UserDataAnswer)2 Answer (org.jdiameter.api.Answer)2 ApplicationId (org.jdiameter.api.ApplicationId)2 ProfileUpdateAnswerImpl (org.jdiameter.common.impl.app.sh.ProfileUpdateAnswerImpl)2 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)2 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)1