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;
}
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;
}
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;
}
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());
}
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());
}
Aggregations