aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-05-23 16:17:45 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-05-23 16:22:40 +0300
commit44c763981f2e368184d6461dd18529545c3b29aa (patch)
tree5dfa28ad05212706c594f3fb9c763cd8cdda6d36 /catalog-be/src/main/java
parent1742d73bf62fd80c6e88059c7226eb91c011a99d (diff)
new unit tests for sdc-be
Change-Id: I5a7cf20a9157432fd2bf72d24fa48bc5789ad3b4 Issue-ID: SDC-1333 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
index 794de4ab38..e28375d578 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/user/UserBusinessLogic.java
@@ -147,15 +147,8 @@ public class UserBusinessLogic implements IUserBusinessLogic {
Either<User, StorageOperationStatus> addOrUpdateUserReq;
- if (ActionStatus.USER_INACTIVE.equals(eitherUserInDB.right().value())) { // user
- // exist
- // with
- // inactive
- // state
- // -
- // update
- // user
- // data
+ if (eitherUserInDB.isRight() && ActionStatus.USER_INACTIVE.equals(eitherUserInDB.right().value())) {
+ // user exist with inactive state - update user data
newUser.setLastLoginTime(0L);
addOrUpdateUserReq = userAdminOperation.updateUserData(newUser);
@@ -172,7 +165,7 @@ public class UserBusinessLogic implements IUserBusinessLogic {
if (addOrUpdateUserReq.isRight() || addOrUpdateUserReq.left().value() == null) {
log.debug("createUser method - failed to create user");
- Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addOrUpdateUserReq.right().value())));
+ return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(addOrUpdateUserReq.right().value())));
}
log.debug("createUser method - user created");
User createdUser = addOrUpdateUserReq.left().value();
@@ -321,6 +314,9 @@ public class UserBusinessLogic implements IUserBusinessLogic {
} else {
rolesStr = "All";
getResponse = getUsersPerRole(null, user, rolesStr);
+ if(getResponse.isRight()) {
+ return getResponse;
+ }
resultList.addAll(getResponse.left().value());
}
responseFormat = componentsUtils.getResponseFormat(ActionStatus.OK);
@@ -487,9 +483,10 @@ public class UserBusinessLogic implements IUserBusinessLogic {
Either<User, StorageOperationStatus> updateUserReq = userAdminOperation.updateUserData(user);
if (updateUserReq.isRight()) {
- responseFormat = componentsUtils.getResponseFormatByUser(eitherCreator.right().value(), user);
+ ActionStatus convertFromStorageResponse = componentsUtils.convertFromStorageResponse(updateUserReq.right().value());
+ responseFormat = componentsUtils.getResponseFormatByUser(convertFromStorageResponse, user);
handleUserAccessAuditing(user, responseFormat, AuditingActionEnum.USER_ACCESS);
- return Either.right(componentsUtils.getResponseFormatByUser(eitherCreator.right().value(), user));
+ return Either.right(responseFormat);
}
User updatedUser = updateUserReq.left().value();
@@ -569,9 +566,10 @@ public class UserBusinessLogic implements IUserBusinessLogic {
Either<User, StorageOperationStatus> updateUserReq = userAdminOperation.updateUserData(user);
if (updateUserReq.isRight()) {
- responseFormat = componentsUtils.getResponseFormatByUser(eitherCreator.right().value(), user);
+ ActionStatus convertFromStorageResponse = componentsUtils.convertFromStorageResponse(updateUserReq.right().value());
+ responseFormat = componentsUtils.getResponseFormatByUser(convertFromStorageResponse, user);
handleUserAccessAuditing(user, responseFormat, AuditingActionEnum.USER_ACCESS);
- return Either.right(componentsUtils.getResponseFormatByUser(eitherCreator.right().value(), user));
+ return Either.right(responseFormat);
}
User updatedUser = updateUserReq.left().value();