summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2019-07-02 12:55:35 +0200
committerOren Kleks <orenkle@amdocs.com>2019-07-07 13:05:01 +0000
commit8f82ddc9c6a2bc45680748f3f584e36a1ce131d4 (patch)
tree24888e1fbeb4942f294f37aad0644ce5d2b22f7c /catalog-model/src/main/java
parent6185ebc6d0e1e002029764dadd43818c71ab1120 (diff)
Improved unit tests for ComponentValidationUtils and Sonar fixes.
Improved unit tests for ComponentValidationUtils. Checkstyle for ComponentValidationUtils. Add a private constructor to hide the implicit public one in the ComponentValidationUtils. Issue-ID: SDC-2327 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Change-Id: I8a2f2f7b9a5e6475a4e28d13f3acab333b4af6da
Diffstat (limited to 'catalog-model/src/main/java')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
index 5c2212072c..9621f9e401 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/utils/ComponentValidationUtils.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (c) 2019 Samsung
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,6 @@
package org.openecomp.sdc.be.model.operations.utils;
-import fj.data.Either;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
@@ -29,10 +29,15 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.common.log.wrappers.Logger;
+import fj.data.Either;
+
public class ComponentValidationUtils {
private static final Logger log = Logger.getLogger(ComponentValidationUtils.class.getName());
+ private ComponentValidationUtils() {
+ }
+
public static boolean canWorkOnResource(Resource resource, String userId) {
// verify resource is checked-out
if (resource.getLifecycleState() != LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT) {
@@ -52,9 +57,11 @@ public class ComponentValidationUtils {
return true;
}
- public static boolean canWorkOnComponent(String componentId, ToscaOperationFacade toscaOperationFacade, String userId) {
+ public static boolean canWorkOnComponent(String componentId,
+ ToscaOperationFacade toscaOperationFacade, String userId) {
- Either<Component, StorageOperationStatus> getResourceResult = toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseMetadata);
+ Either<Component, StorageOperationStatus> getResourceResult =
+ toscaOperationFacade.getToscaElement(componentId, JsonParseFlagEnum.ParseMetadata);
if (getResourceResult.isRight()) {
log.debug("Failed to retrieve component, component id {}", componentId);
@@ -69,7 +76,8 @@ public class ComponentValidationUtils {
return canWorkOnComponent(component.getLifecycleState(), component.getLastUpdaterUserId(), userId);
}
- private static boolean canWorkOnComponent(LifecycleStateEnum lifecycleState, String lastUpdaterUserId, String userId) {
+ private static boolean canWorkOnComponent(LifecycleStateEnum lifecycleState,
+ String lastUpdaterUserId, String userId) {
// verify resource is checked-out
if (lifecycleState != LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT) {
log.debug("resource is not checked-out");