From 587e939a4248e3e5a53b84b9d263c5c47bc6bbc0 Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Tue, 3 Sep 2019 09:14:35 +0200 Subject: openecomp-be code coverage increase Add tests for classes in generator.datatypes.tosca package Change-Id: Ic21b4e05d15e881016fa5f25113625bc441924c9 Issue-ID: SDC-2326 Signed-off-by: Piotr Darosz --- .../datatypes/tosca/ComputeFlavorTest.java | 51 ++++++++++++++++++++++ .../datatypes/tosca/DeploymentFlavorModelTest.java | 51 ++++++++++++++++++++++ .../datatypes/tosca/LicenseFlavorTest.java | 51 ++++++++++++++++++++++ .../datatypes/tosca/MultiFlavorVfcImageTest.java | 51 ++++++++++++++++++++++ .../generator/datatypes/tosca/VendorInfoTest.java | 51 ++++++++++++++++++++++ .../datatypes/tosca/VspModelInfoTest.java | 51 ++++++++++++++++++++++ .../generator/datatypes/tosca/ComputeFlavor.java | 8 ++-- .../datatypes/tosca/DeploymentFlavorModel.java | 8 ++-- .../generator/datatypes/tosca/LicenseFlavor.java | 8 ++-- .../datatypes/tosca/MultiFlavorVfcImage.java | 8 ++-- .../sdc/generator/datatypes/tosca/VendorInfo.java | 8 ++-- .../generator/datatypes/tosca/VspModelInfo.java | 8 ++-- 12 files changed, 336 insertions(+), 18 deletions(-) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java new file mode 100644 index 0000000000..08fcd5db11 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavorTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ComputeFlavorTest { + @Test + public void accessorsTest() { + assertThat(ComputeFlavor.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(ComputeFlavor.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(ComputeFlavor.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(ComputeFlavor.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java new file mode 100644 index 0000000000..e26c11ff79 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModelTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class DeploymentFlavorModelTest { + @Test + public void accessorsTest() { + assertThat(DeploymentFlavorModel.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(DeploymentFlavorModel.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(DeploymentFlavorModel.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(DeploymentFlavorModel.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java new file mode 100644 index 0000000000..28e0f23625 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavorTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class LicenseFlavorTest { + @Test + public void accessorsTest() { + assertThat(LicenseFlavor.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(LicenseFlavor.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(LicenseFlavor.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(LicenseFlavor.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java new file mode 100644 index 0000000000..20f2878980 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImageTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class MultiFlavorVfcImageTest { + @Test + public void accessorsTest() { + assertThat(MultiFlavorVfcImage.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(MultiFlavorVfcImage.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(MultiFlavorVfcImage.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(MultiFlavorVfcImage.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java new file mode 100644 index 0000000000..0cd6985254 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfoTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class VendorInfoTest { + @Test + public void accessorsTest() { + assertThat(VendorInfo.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(VendorInfo.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(VendorInfo.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(VendorInfo.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java new file mode 100644 index 0000000000..0b7f2ddd13 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfoTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. 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========================================================= + */ + +package org.openecomp.sdc.generator.datatypes.tosca; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEquals; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCode; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class VspModelInfoTest { + @Test + public void accessorsTest() { + assertThat(VspModelInfo.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(VspModelInfo.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(VspModelInfo.class, hasValidBeanHashCode()); + } + + @Test + public void toStringTest() { + assertThat(VspModelInfo.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java index 5edb29c74a..4c3e1a6a7a 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/ComputeFlavor.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -61,10 +63,10 @@ public class ComputeFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (obj != null && getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; ComputeFlavor other = (ComputeFlavor) obj; - if(other != null) { + if (num_cpus != other.num_cpus) return false; if (this.disk_size == null) { @@ -77,7 +79,7 @@ public class ComputeFlavor { return false; } else if (!mem_size.equals(other.mem_size)) return false; - } + return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java index 62705a28b6..2474c1b6d8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/DeploymentFlavorModel.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -73,10 +75,10 @@ public class DeploymentFlavorModel { public boolean equals(Object obj) { if (this == obj) return true; - if (obj != null && getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; DeploymentFlavorModel other = (DeploymentFlavorModel) obj; - if (other != null) { + if (this.sp_part_number == null) { if (other.sp_part_number != null) return false; @@ -97,7 +99,7 @@ public class DeploymentFlavorModel { return false; } else if (!license_flavor.equals(other.license_flavor)) return false; - } + return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java index 2a1b765767..b7f9dd87da 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/LicenseFlavor.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -44,16 +46,16 @@ public class LicenseFlavor { public boolean equals(Object obj) { if (this == obj) return true; - if (obj != null && getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; LicenseFlavor other = (LicenseFlavor) obj; - if (other != null) { + if (this.feature_group_uuid == null) { if (other.feature_group_uuid != null) return false; } else if (!feature_group_uuid.equals(other.feature_group_uuid)) return false; - } + return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java index ac5e4c0bcb..d6620ce5c8 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/MultiFlavorVfcImage.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -74,10 +76,10 @@ public class MultiFlavorVfcImage { public boolean equals(Object obj) { if (this == obj) return true; - if (obj != null && getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; MultiFlavorVfcImage other = (MultiFlavorVfcImage) obj; - if (other != null) { + if (this.file_name == null) { if (other.file_name != null) return false; @@ -98,7 +100,7 @@ public class MultiFlavorVfcImage { return false; } else if (!software_version.equals(other.software_version)) return false; - } + return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java index 821549f0ac..d8d8cb6f8c 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VendorInfo.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -52,10 +54,10 @@ public class VendorInfo { public boolean equals(Object obj) { if (this == obj) return true; - if (obj != null && getClass() != obj.getClass()) + if (obj == null || getClass() != obj.getClass()) return false; VendorInfo other = (VendorInfo) obj; - if (other != null) { + if (this.manufacturer_reference_number == null) { if (other.manufacturer_reference_number != null) return false; @@ -66,7 +68,7 @@ public class VendorInfo { return false; } else if (!vendor_model.equals(other.vendor_model)) return false; - } + return true; } diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java index 7349edb4e5..1eb1b32073 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/src/main/java/org/openecomp/sdc/generator/datatypes/tosca/VspModelInfo.java @@ -16,6 +16,8 @@ * 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.generator.datatypes.tosca; @@ -102,11 +104,11 @@ public class VspModelInfo { if (this == obj) { return true; } - if (obj != null && getClass() != obj.getClass()) { + if (obj == null || getClass() != obj.getClass()) { return false; } VspModelInfo other = (VspModelInfo) obj; - if(other != null) { + if (this.releaseVendor == null) { if (other.releaseVendor != null) { return false; @@ -149,7 +151,7 @@ public class VspModelInfo { } else if (!nics.equals(other.nics)) { return false; } - } + return true; } } -- cgit 1.2.3-korg