summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorTomasz Golabek <tomasz.golabek@nokia.com>2019-04-11 14:29:49 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-04-30 11:34:29 +0000
commit7e28cea706ca5e0ca423fde637a7846eaaa2e1e0 (patch)
treead9f416df381ce6bad81344e1f7f2cce4d30b25b /catalog-be/src/main/java
parent96a163f5a9fa81f23b9859a63a8401c1659c187c (diff)
Some unit tests for catalog-be
Code coverage for some classes from catalog-be increased. Some refactor made if needed. Change-Id: Ia9348f624984ab7e5f9aa53c0adf33cf5867fa07 Issue-ID: SDC-2220 Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java25
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java14
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java22
4 files changed, 40 insertions, 25 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java
index 11a42694bf..1aad998e78 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/DistributionStatus.java
@@ -7,19 +7,23 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
*/
package org.openecomp.sdc.be.info;
+import java.util.Arrays;
+import java.util.Optional;
import org.openecomp.sdc.common.log.wrappers.Logger;
public enum DistributionStatus {
@@ -44,18 +48,13 @@ public enum DistributionStatus {
}
public static DistributionStatus getStatusByAuditingStatusName(String auditingStatus) {
- DistributionStatus res = null;
- DistributionStatus[] values = values();
- for (DistributionStatus value : values) {
- if (value.getAuditingStatus().equals(auditingStatus)) {
- res = value;
- break;
- }
- }
- if (res == null) {
- log.debug("No DistributionStatus is mapped to name {}", auditingStatus);
+ Optional<DistributionStatus> distributionStatus = Arrays.stream(values())
+ .filter(value -> value.getAuditingStatus().equals(auditingStatus)).findAny();
+ if (!distributionStatus.isPresent()){
+ log.debug("No DistributionStatus is mapped to name {}", auditingStatus);
}
- return res;
+ // it should be replaced by some exception handling. Keeping it only for the purpose of backward compatibility
+ return distributionStatus.orElse(null);
}
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java
index e7a0706b31..621485c7a1 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupDefinitionInfo.java
@@ -7,17 +7,18 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
*/
-
package org.openecomp.sdc.be.info;
import org.openecomp.sdc.be.model.GroupDefinition;
@@ -62,9 +63,7 @@ public class GroupDefinitionInfo {
private List<? extends GroupProperty> properties;
- public GroupDefinitionInfo() {
- super();
- }
+ public GroupDefinitionInfo() {}
public GroupDefinitionInfo(GroupDefinition other) {
this.setName(other.getName());
@@ -139,7 +138,6 @@ public class GroupDefinitionInfo {
this.version = version;
}
-
public String getCustomizationUUID() {
return customizationUUID;
}
@@ -172,8 +170,6 @@ public class GroupDefinitionInfo {
this.properties = (properties==null) ? null : new ArrayList<>(properties);
}
-
-
public String getGroupInstanceUniqueId() {
return groupInstanceUniqueId;
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java
index 301cffafdc..3ae0dcdf62 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/GroupTemplateInfo.java
@@ -25,9 +25,7 @@ public class GroupTemplateInfo {
boolean isBase;
ArtifactTemplateInfo artifactTemplateInfo;
- public GroupTemplateInfo() {
- super();
- }
+ public GroupTemplateInfo() {}
public String getGroupName() {
return groupName;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java
index 766581bd62..9ab0bd7f27 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/info/NodeTypeInfoToUpdateArtifacts.java
@@ -1,3 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ * Modifications copyright (c) 2019 Nokia
+ * ================================================================================
+ */
package org.openecomp.sdc.be.info;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum;
@@ -12,6 +33,7 @@ public class NodeTypeInfoToUpdateArtifacts {
private String nodeName;
private Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle;
+ NodeTypeInfoToUpdateArtifacts() {}
public NodeTypeInfoToUpdateArtifacts(String nodeName,
Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>> nodeTypesArtifactsToHandle) {