aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorPiotr Darosz <piotr.darosz@nokia.com>2019-09-03 08:40:37 +0200
committerPiotr Darosz <piotr.darosz@nokia.com>2019-09-03 08:45:00 +0200
commit7b10cc4d95582dfaf6c6010199fa95aae78c806b (patch)
tree858c94aeab1aecd9b137b69a61decbe2df4543c2 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parent51e1e5e941e5fb01cc684e5827b6c36029e30335 (diff)
openecomp-be code coverage increase
Add tests for classes in vendorsoftwareproduct.types.composition package Change-Id: I2b05536a4fd80021bfedd2e7ff0f1747f6227935 Issue-ID: SDC-2326 Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationData.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java6
5 files changed, 34 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
index ec2b07b5cd..2a1e833bf6 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentData.java
@@ -1,4 +1,5 @@
-/*
+/*-
+ * ============LICENSE_START=======================================================
* Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,10 +13,15 @@
* 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.vendorsoftwareproduct.types.composition;
+import java.util.Objects;
+
public class ComponentData implements CompositionDataEntity {
private String name;
private String description;
@@ -47,7 +53,7 @@ public class ComponentData implements CompositionDataEntity {
@Override
public int hashCode() {
- int result = name.hashCode();
+ int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
return result;
@@ -64,7 +70,7 @@ public class ComponentData implements CompositionDataEntity {
ComponentData that = (ComponentData) object;
- if (!name.equals(that.name)) {
+ if (!Objects.equals(name, that.name)) {
return false;
}
if (description != null ? !description.equals(that.description) : that.description != null) {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java
index 7f5f69de3b..98fde5b64c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityId.java
@@ -16,14 +16,21 @@
* 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.vendorsoftwareproduct.types.composition;
+import com.google.common.annotations.VisibleForTesting;
+
public class CompositionEntityId {
private String id;
private CompositionEntityId parentId;
+ @VisibleForTesting
+ CompositionEntityId() {}
+
public CompositionEntityId(String id, CompositionEntityId parentId) {
this.id = id;
this.parentId = parentId;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationData.java
index d126763409..95514d6f08 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationData.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationData.java
@@ -16,10 +16,14 @@
* 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.vendorsoftwareproduct.types.composition;
+import com.google.common.annotations.VisibleForTesting;
+
import java.util.ArrayList;
import java.util.Collection;
@@ -30,6 +34,9 @@ public class CompositionEntityValidationData {
private Collection<String> errors;
private Collection<CompositionEntityValidationData> subEntitiesValidationData;
+ @VisibleForTesting
+ CompositionEntityValidationData() {}
+
public CompositionEntityValidationData(CompositionEntityType entityType, String entityId) {
this.entityType = entityType;
this.entityId = entityId;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java
index 43f13ded4c..ec66d0e5b2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeData.java
@@ -16,10 +16,14 @@
* 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.vendorsoftwareproduct.types.composition;
+import java.util.Objects;
+
public class ComputeData implements CompositionDataEntity {
private String name;
private String description;
@@ -48,7 +52,7 @@ public class ComputeData implements CompositionDataEntity {
@Override
public int hashCode() {
- int result = name.hashCode();
+ int result = name != null ? name.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
return result;
}
@@ -64,7 +68,7 @@ public class ComputeData implements CompositionDataEntity {
ComputeData that = (ComputeData) object;
- if (!name.equals(that.name)) {
+ if (!Objects.equals(name, that.name)) {
return false;
}
return description != null ? description.equals(that.description): that.description == null;
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java
index ba0361b3b4..b0a2e850ed 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/Network.java
@@ -16,10 +16,14 @@
* 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.vendorsoftwareproduct.types.composition;
+import java.util.Objects;
+
public class Network implements CompositionDataEntity {
private String name;
private boolean dhcp;
@@ -58,7 +62,7 @@ public class Network implements CompositionDataEntity {
Network network = (Network) object;
- if (dhcp != network.dhcp) {
+ if (!Objects.equals(dhcp, network.dhcp)) {
return false;
}
return name != null ? name.equals(network.name) : network.name == null;