From 7b10cc4d95582dfaf6c6010199fa95aae78c806b Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Tue, 3 Sep 2019 08:40:37 +0200 Subject: 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 --- .../ComponentComputeAssociationTest.java | 33 ++++++++++++++++ .../types/composition/ComponentDataTest.java | 45 +++++++++++++++++++++ .../types/composition/ComponentTest.java | 33 ++++++++++++++++ .../types/composition/CompositionDataTest.java | 33 ++++++++++++++++ .../CompositionEntityValidationDataTest.java | 45 +++++++++++++++++++++ .../types/composition/ComputeDataTest.java | 45 +++++++++++++++++++++ .../types/composition/DeploymentFlavorTest.java | 33 ++++++++++++++++ .../ExtractCompositionDataContextTest.java | 33 ++++++++++++++++ .../types/composition/ImageDataTest.java | 33 ++++++++++++++++ .../types/composition/ImageTest.java | 33 ++++++++++++++++ .../types/composition/NetworkTest.java | 46 ++++++++++++++++++++++ .../types/composition/NicTest.java | 45 +++++++++++++++++++++ .../types/composition/VmSizingTest.java | 34 ++++++++++++++++ .../types/composition/ComponentData.java | 12 ++++-- .../types/composition/CompositionEntityId.java | 7 ++++ .../CompositionEntityValidationData.java | 7 ++++ .../types/composition/ComputeData.java | 8 +++- .../types/composition/Network.java | 6 ++- 18 files changed, 525 insertions(+), 6 deletions(-) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociationTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/DeploymentFlavorTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContextTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NicTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/VmSizingTest.java diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociationTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociationTest.java new file mode 100644 index 0000000000..182953d894 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentComputeAssociationTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ComponentComputeAssociationTest { + @Test + public void accessorsTest() { + assertThat(ComponentComputeAssociation.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/ComponentDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentDataTest.java new file mode 100644 index 0000000000..47ee5db651 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentDataTest.java @@ -0,0 +1,45 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +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.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ComponentDataTest { + @Test + public void accessorsTest() { + assertThat(ComponentData.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(ComponentData.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(ComponentData.class, hasValidBeanHashCode()); + } +} \ 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/vendorsoftwareproduct/types/composition/ComponentTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentTest.java new file mode 100644 index 0000000000..88ec1b5843 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComponentTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ComponentTest { + @Test + public void accessorsTest() { + assertThat(Component.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/CompositionDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataTest.java new file mode 100644 index 0000000000..f6def252dd --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionDataTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CompositionDataTest { + @Test + public void accessorsTest() { + assertThat(CompositionData.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/CompositionEntityValidationDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationDataTest.java new file mode 100644 index 0000000000..8f1121e98d --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/CompositionEntityValidationDataTest.java @@ -0,0 +1,45 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +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.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CompositionEntityValidationDataTest { + @Test + public void accessorsTest() { + assertThat(CompositionEntityValidationData.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(CompositionEntityValidationData.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(CompositionEntityValidationData.class, hasValidBeanHashCode()); + } +} \ 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/vendorsoftwareproduct/types/composition/ComputeDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeDataTest.java new file mode 100644 index 0000000000..0175ff1bd2 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ComputeDataTest.java @@ -0,0 +1,45 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +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.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ComputeDataTest { + @Test + public void accessorsTest() { + assertThat(ComputeData.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(ComputeData.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(ComputeData.class, hasValidBeanHashCode()); + } +} \ 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/vendorsoftwareproduct/types/composition/DeploymentFlavorTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/DeploymentFlavorTest.java new file mode 100644 index 0000000000..51518d7dd5 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/DeploymentFlavorTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class DeploymentFlavorTest { + @Test + public void accessorsTest() { + assertThat(DeploymentFlavor.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/ExtractCompositionDataContextTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContextTest.java new file mode 100644 index 0000000000..f3e59abf85 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ExtractCompositionDataContextTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ExtractCompositionDataContextTest { + @Test + public void accessorsTest() { + assertThat(ExtractCompositionDataContext.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/ImageDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageDataTest.java new file mode 100644 index 0000000000..39965a10c6 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageDataTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ImageDataTest { + @Test + public void accessorsTest() { + assertThat(ImageData.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/ImageTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageTest.java new file mode 100644 index 0000000000..9ed5aab985 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/ImageTest.java @@ -0,0 +1,33 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ImageTest { + @Test + public void accessorsTest() { + assertThat(Image.class, hasValidGettersAndSetters()); + } +} \ 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/vendorsoftwareproduct/types/composition/NetworkTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkTest.java new file mode 100644 index 0000000000..397486beb3 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NetworkTest.java @@ -0,0 +1,46 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +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.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class NetworkTest { + @Test + public void accessorsTest() { + assertThat(Network.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(Network.class, hasValidBeanEquals()); + } + + @Test + public void hashCodeTest() { + assertThat(Network.class, hasValidBeanHashCode()); + } + +} \ 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/vendorsoftwareproduct/types/composition/NicTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NicTest.java new file mode 100644 index 0000000000..4976a5fdc6 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/NicTest.java @@ -0,0 +1,45 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeExcluding; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class NicTest { + @Test + public void accessorsTest() { + assertThat(Nic.class, hasValidGettersAndSetters()); + } + + @Test + public void equalsTest() { + assertThat(Nic.class, hasValidBeanEqualsExcluding("networkName")); + } + + @Test + public void hashCodeTest() { + assertThat(Nic.class, hasValidBeanHashCodeExcluding("networkName")); + } +} \ 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/vendorsoftwareproduct/types/composition/VmSizingTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/VmSizingTest.java new file mode 100644 index 0000000000..463ac6fc38 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/types/composition/VmSizingTest.java @@ -0,0 +1,34 @@ +/*- + * ============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.vendorsoftwareproduct.types.composition; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class VmSizingTest { + @Test + public void accessorsTest() { + assertThat(VmSizing.class, hasValidGettersAndSetters()); + } + +} \ No newline at end of file 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 errors; private Collection 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; -- cgit 1.2.3-korg