diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main')
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; |