diff options
author | Tomasz Golabek <tomasz.golabek@nokia.com> | 2019-04-04 17:52:26 +0200 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-04-17 06:49:39 +0000 |
commit | 8fa77ad4d4c2498e40a4c23e6826d9ad73a1dab8 (patch) | |
tree | 2974630bcf758e8e3247a5f58e15c836a043d108 /catalog-be/src/main | |
parent | 6df542cf030b3f22111f7f091f43c28fcd395bb1 (diff) |
Some unit tests for catalog-be
Code coverage for some classes from catalog-be increased.
Some refactor made if needed.
Change-Id: I5cd63fe61425f5eb05336545d714cbe2df83e116
Issue-ID: SDC-2220
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/AccessValidations.java | 26 | ||||
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactAccessInfo.java | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/AccessValidations.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/AccessValidations.java index 335a9398d7..28723f6c29 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/AccessValidations.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/AccessValidations.java @@ -14,7 +14,6 @@ public class AccessValidations { private final UserValidations userValidations; private final ComponentValidations componentValidations; - public AccessValidations(UserValidations userValidations, ComponentValidations componentValidations) { this.userValidations = userValidations; this.componentValidations = componentValidations; @@ -31,8 +30,16 @@ public class AccessValidations { validateUserIsAdminOrDesigner(user); return componentValidations.validateComponentIsCheckedOutByUser(componentId, componentType, userId); } - private User retrieveUser(String userId, String actionContext) { - return userValidations.validateUserExists(userId, actionContext, true); + + + public void validateUserCanWorkOnComponent(Component component, String userId, String actionContext) { + User user = retrieveUser(userId, actionContext); + validateUserIsAdminOrDesigner(user); + componentValidations.validateComponentIsCheckedOutByUser(component, userId); + } + + public void validateUserExists(String userId, String context) { + retrieveUser(userId, context); } public void validateUserExist(String userId, String actionContext) { @@ -45,6 +52,10 @@ public class AccessValidations { return user; } + private User retrieveUser(String userId, String actionContext) { + return userValidations.validateUserExists(userId, actionContext, true); + } + private void validateUserIsAdminOrDesigner(User user) { List<Role> roles = new ArrayList<>(2); roles.add(Role.ADMIN); @@ -52,13 +63,4 @@ public class AccessValidations { userValidations.validateUserRole(user, roles); } - public void validateUserCanWorkOnComponent(Component component, String userId, String actionContext) { - User user = retrieveUser(userId, actionContext); - validateUserIsAdminOrDesigner(user); - componentValidations.validateComponentIsCheckedOutByUser(component, userId); - } - - public void validateUserExists(String userId, String context) { - retrieveUser(userId, context); - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactAccessInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactAccessInfo.java index bedbff46b1..490684e20d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactAccessInfo.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/ArtifactAccessInfo.java @@ -35,10 +35,8 @@ public class ArtifactAccessInfo { urlBuilder = urlBuilder.append(servletContext).append("/"); urlBuilder.append("resources/") // .append(artifactData.getResourceId()).append("/") - - .append("/artifacts/"); + .append("artifacts/"); this.url = urlBuilder.toString(); - } private String name; |