From 51a0f7b4a6c924c42955fa93042bd154cb636a16 Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Wed, 4 Sep 2019 10:05:34 +0200 Subject: common code coverage increase Add tests for classes in sdc.tosca.datatypes.model package Change-Id: Ifc277512d833b2501f0e594b9062d39c26565055 Issue-ID: SDC-2326 Signed-off-by: Piotr Darosz --- common/onap-tosca-datatype/pom.xml | 6 +++ .../sdc/tosca/datatypes/model/Implementation.java | 7 +-- .../datatypes/model/ActivityDefinitionTest.java | 34 +++++++++++++ .../datatypes/model/ArtifactDefinitionTest.java | 34 +++++++++++++ .../tosca/datatypes/model/ArtifactTypeTest.java | 34 +++++++++++++ .../datatypes/model/AttributeDefinitionTest.java | 59 ++++++++++++++++++++++ .../datatypes/model/CapabilityAssignmentTest.java | 34 +++++++++++++ .../datatypes/model/CapabilityDefinitionTest.java | 3 +- .../datatypes/model/CapabilityFilterTest.java | 40 +++++++++++++++ .../tosca/datatypes/model/CapabilityTypeTest.java | 34 +++++++++++++ .../sdc/tosca/datatypes/model/ConditionTest.java | 33 ++++++++++++ .../sdc/tosca/datatypes/model/CredentialTest.java | 33 ++++++++++++ .../sdc/tosca/datatypes/model/DataTypeTest.java | 33 ++++++++++++ .../sdc/tosca/datatypes/model/EventFilterTest.java | 33 ++++++++++++ .../tosca/datatypes/model/GroupDefinitionTest.java | 33 ++++++++++++ .../sdc/tosca/datatypes/model/GroupTypeTest.java | 33 ++++++++++++ .../tosca/datatypes/model/ImplementationTest.java | 45 +++++++++++++++++ .../onap/sdc/tosca/datatypes/model/ImportTest.java | 33 ++++++++++++ .../model/InterfaceDefinitionTemplateTest.java | 45 +++++++++++++++++ .../model/InterfaceDefinitionTypeTest.java | 45 +++++++++++++++++ .../tosca/datatypes/model/InterfaceTypeTest.java | 45 +++++++++++++++++ .../tosca/datatypes/model/NodeTemplateTest.java | 21 ++++++++ .../sdc/tosca/datatypes/model/NodeTypeTest.java | 10 ++++ .../model/OperationDefinitionTemplateTest.java | 45 +++++++++++++++++ .../datatypes/model/OperationDefinitionTest.java | 45 +++++++++++++++++ .../model/OperationDefinitionTypeTest.java | 45 +++++++++++++++++ .../datatypes/model/PolicyDefinitionTest.java | 51 +++++++++++++++++++ .../sdc/tosca/datatypes/model/PolicyTypeTest.java | 51 +++++++++++++++++++ .../model/PreconditionDefinitionTest.java | 51 +++++++++++++++++++ .../datatypes/model/RelationshipTemplateTest.java | 51 +++++++++++++++++++ .../datatypes/model/RelationshipTypeTest.java | 51 +++++++++++++++++++ .../sdc/tosca/datatypes/model/RepositoryTest.java | 51 +++++++++++++++++++ .../datatypes/model/RequirementAssignmentTest.java | 51 +++++++++++++++++++ .../onap/sdc/tosca/datatypes/model/ScalarTest.java | 33 ++++++++++++ .../tosca/datatypes/model/ServiceTemplateTest.java | 11 ++++ .../tosca/datatypes/model/StepDefinitionTest.java | 33 ++++++++++++ .../datatypes/model/SubstitutionMappingTest.java | 33 ++++++++++++ .../tosca/datatypes/model/TimeIntervalTest.java | 33 ++++++++++++ .../datatypes/model/TopologyTemplateTest.java | 54 ++++++++++++++++++++ .../sdc/tosca/datatypes/model/TriggerTest.java | 21 ++++++++ .../datatypes/model/WorkflowDefinitionTest.java | 33 ++++++++++++ .../extension/RequirementAssignmentExtTest.java | 47 +++++++++++++++++ .../extension/SubstitutionMappingExtTest.java | 45 +++++++++++++++++ .../model/heatextend/AnnotationDefinitionTest.java | 33 ++++++++++++ .../model/heatextend/AnnotationTypeTest.java | 33 ++++++++++++ .../heatextend/ParameterDefinitionExtTest.java | 33 ++++++++++++ .../datatypes/model/RequirementDefinitionTest.java | 9 ++++ 47 files changed, 1666 insertions(+), 4 deletions(-) create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignmentTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilterTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConditionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CredentialTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/DataTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/EventFilterTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImportTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplateTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplateTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplateTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RepositoryTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignmentTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ScalarTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/StepDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMappingTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TimeIntervalTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExtTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExtTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinitionTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationTypeTest.java create mode 100644 common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExtTest.java diff --git a/common/onap-tosca-datatype/pom.xml b/common/onap-tosca-datatype/pom.xml index f63bfa63d6..10f89d6cfd 100644 --- a/common/onap-tosca-datatype/pom.xml +++ b/common/onap-tosca-datatype/pom.xml @@ -75,5 +75,11 @@ slf4j-api ${slf4j.version} + + com.google.code.bean-matchers + bean-matchers + ${bean-matchers.version} + test + diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java index 80a2a22b25..e771f4e5b9 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java @@ -12,13 +12,14 @@ * 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. + * Modifications copyright (c) 2019 Nokia */ package org.onap.sdc.tosca.datatypes.model; -import java.util.HashSet; import java.util.List; import java.util.Objects; + import org.onap.sdc.tosca.services.DataModelCloneUtil; @@ -52,8 +53,8 @@ public class Implementation implements Cloneable { return false; } Implementation that = (Implementation) o; - return Objects.equals(primary, that.primary) && Objects.equals(new HashSet<>(dependencies), - new HashSet<>(that.dependencies)); + return Objects.equals(primary, that.primary) + && Objects.equals(dependencies, that.dependencies); } @Override diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinitionTest.java new file mode 100644 index 0000000000..89fe98e03a --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ActivityDefinitionTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(ActivityDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinitionTest.java new file mode 100644 index 0000000000..bf36fe3ae1 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ArtifactDefinitionTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(ArtifactDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactTypeTest.java new file mode 100644 index 0000000000..ee94e68f60 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ArtifactTypeTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ArtifactTypeTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(ArtifactType.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinitionTest.java new file mode 100644 index 0000000000..237832971f --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinitionTest.java @@ -0,0 +1,59 @@ +/*- + * ============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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +public class AttributeDefinitionTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(AttributeDefinition.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidCloneMethod() { + AttributeDefinition attributeDefinition = new AttributeDefinition(); + attributeDefinition.setType("type"); + attributeDefinition.setDescription("description"); + attributeDefinition.set_default("default"); + attributeDefinition.setStatus(Status.SUPPORTED); + attributeDefinition.setEntry_schema(new EntrySchema()); + + AttributeDefinition cloned = attributeDefinition.clone(); + assertEquals(attributeDefinition.getType(), cloned.getType()); + assertEquals(attributeDefinition.getDescription(), cloned.getDescription()); + assertEquals(attributeDefinition.get_default(), cloned.get_default()); + assertEquals(attributeDefinition.getStatus(), cloned.getStatus()); + + assertThat(attributeDefinition.getEntry_schema().getConstraints(), + is(cloned.getEntry_schema().getConstraints())); + assertThat(attributeDefinition.getEntry_schema().getDescription(), + is(cloned.getEntry_schema().getDescription())); + assertThat(attributeDefinition.getEntry_schema().getType(), + is(cloned.getEntry_schema().getType())); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignmentTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignmentTest.java new file mode 100644 index 0000000000..6f430cdb6f --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignmentTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CapabilityAssignmentTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(CapabilityAssignment.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java index 95bc6e5ce7..31091ef720 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java @@ -16,13 +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.onap.sdc.tosca.datatypes.model; import org.junit.Before; import org.junit.Test; -import org.mockito.Mockito; import static org.junit.Assert.assertEquals; diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilterTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilterTest.java new file mode 100644 index 0000000000..96d5f37185 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilterTest.java @@ -0,0 +1,40 @@ +/*- + * ============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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CapabilityFilterTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(CapabilityFilter.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(CapabilityFilter.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityTypeTest.java new file mode 100644 index 0000000000..6e8cb11ab6 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CapabilityTypeTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CapabilityTypeTest { + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(CapabilityType.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConditionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConditionTest.java new file mode 100644 index 0000000000..a3656ea84b --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ConditionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ConditionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Condition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CredentialTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CredentialTest.java new file mode 100644 index 0000000000..986080172a --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/CredentialTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class CredentialTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Credential.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/DataTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/DataTypeTest.java new file mode 100644 index 0000000000..23616f0fcc --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/DataTypeTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class DataTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(DataType.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/EventFilterTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/EventFilterTest.java new file mode 100644 index 0000000000..6fe557bf5b --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/EventFilterTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class EventFilterTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(EventFilter.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupDefinitionTest.java new file mode 100644 index 0000000000..5841b6019a --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class GroupDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(GroupDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupTypeTest.java new file mode 100644 index 0000000000..d45343f54e --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/GroupTypeTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class GroupTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(GroupType.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.java new file mode 100644 index 0000000000..93ec20dc5a --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImplementationTest.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.onap.sdc.tosca.datatypes.model; + +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 ImplementationTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Implementation.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(Implementation.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(Implementation.class, hasValidBeanHashCode()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImportTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImportTest.java new file mode 100644 index 0000000000..68f86e22f7 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ImportTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ImportTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Import.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplateTest.java new file mode 100644 index 0000000000..9670237165 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplateTest.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.onap.sdc.tosca.datatypes.model; + +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 InterfaceDefinitionTemplateTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(InterfaceDefinitionTemplate.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(InterfaceDefinitionTemplate.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(InterfaceDefinitionTemplate.class, hasValidBeanHashCode()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTypeTest.java new file mode 100644 index 0000000000..42fe0e9610 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTypeTest.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.onap.sdc.tosca.datatypes.model; + +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 InterfaceDefinitionTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(InterfaceDefinitionType.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(InterfaceDefinitionType.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(InterfaceDefinitionType.class, hasValidBeanHashCode()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceTypeTest.java new file mode 100644 index 0000000000..f63d128a78 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/InterfaceTypeTest.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.onap.sdc.tosca.datatypes.model; + +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 InterfaceTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(InterfaceType.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(InterfaceType.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(InterfaceType.class, hasValidBeanHashCode()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java index 1fb886f328..b9f2b838c2 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTemplateTest.java @@ -12,6 +12,8 @@ * 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. + * + * Modifications copyright (c) 2019 Nokia */ package org.onap.sdc.tosca.datatypes.model; @@ -25,6 +27,11 @@ import org.junit.Assert; import org.junit.Test; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding; +import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanHashCodeExcluding; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + public class NodeTemplateTest { @@ -66,6 +73,20 @@ public class NodeTemplateTest { Assert.assertEquals(expectedServiceTemplate, actualServiceTemplate); } + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(NodeTemplate.class, hasValidGettersAndSettersExcluding("normalizeInterfaces")); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(NodeTemplate.class, hasValidBeanEqualsExcluding("normalizeInterfaces")); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(NodeTemplate.class, hasValidBeanHashCodeExcluding("normalizeInterfaces")); + } private InterfaceDefinitionTemplate createInterfaceDefinitionTemplate() { InterfaceDefinitionTemplate interfaceDefinitionTemplate = new InterfaceDefinitionTemplate(); diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTypeTest.java index 1f0732d12f..53a5f5ca1c 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTypeTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/NodeTypeTest.java @@ -12,6 +12,8 @@ * 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. + * + * Modifications copyright (c) 2019 Nokia */ package org.onap.sdc.tosca.datatypes.model; @@ -23,6 +25,9 @@ import org.junit.Assert; import org.junit.Test; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + public class NodeTypeTest { @@ -44,6 +49,11 @@ public class NodeTypeTest { } + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(NodeType.class, hasValidGettersAndSettersExcluding("normalizeInterfaces")); + } + protected InterfaceDefinitionType chkData(Map normalizeInterfacesNoEvent) { Assert.assertNotNull(normalizeInterfacesNoEvent); InterfaceDefinitionType interfaceDefinitionType = normalizeInterfacesNoEvent.get(STANDARD_INTERFACE_DEF); diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplateTest.java new file mode 100644 index 0000000000..676a538c93 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplateTest.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.onap.sdc.tosca.datatypes.model; + +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 OperationDefinitionTemplateTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(OperationDefinitionTemplate.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(OperationDefinitionTemplate.class, hasValidBeanEqualsExcluding("description")); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(OperationDefinitionTemplate.class, hasValidBeanHashCodeExcluding("description")); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTest.java new file mode 100644 index 0000000000..ef7a1ea7b4 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +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 OperationDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(OperationDefinition.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(OperationDefinition.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(OperationDefinition.class, hasValidBeanHashCode()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTypeTest.java new file mode 100644 index 0000000000..8798244cf9 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTypeTest.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.onap.sdc.tosca.datatypes.model; + +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 OperationDefinitionTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(OperationDefinitionType.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(OperationDefinitionType.class, hasValidBeanEqualsExcluding("description")); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(OperationDefinitionType.class, hasValidBeanHashCodeExcluding("description")); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinitionTest.java new file mode 100644 index 0000000000..a6a35bca1f --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +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 PolicyDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(PolicyDefinition.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(PolicyDefinition.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(PolicyDefinition.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(PolicyDefinition.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyTypeTest.java new file mode 100644 index 0000000000..7079539881 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PolicyTypeTest.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.onap.sdc.tosca.datatypes.model; + +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 PolicyTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(PolicyType.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(PolicyType.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(PolicyType.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(PolicyType.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinitionTest.java new file mode 100644 index 0000000000..143f2051ad --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +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 PreconditionDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(PreconditionDefinition.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(PreconditionDefinition.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(PreconditionDefinition.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(PreconditionDefinition.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplateTest.java new file mode 100644 index 0000000000..5350ef0a49 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplateTest.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.onap.sdc.tosca.datatypes.model; + +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 RelationshipTemplateTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(RelationshipTemplate.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(RelationshipTemplate.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(RelationshipTemplate.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(RelationshipTemplate.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTypeTest.java new file mode 100644 index 0000000000..1b8167bb90 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RelationshipTypeTest.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.onap.sdc.tosca.datatypes.model; + +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 RelationshipTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(RelationshipType.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(RelationshipType.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(RelationshipType.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(RelationshipType.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RepositoryTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RepositoryTest.java new file mode 100644 index 0000000000..3c7da27602 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RepositoryTest.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.onap.sdc.tosca.datatypes.model; + +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.hamcrest.MatcherAssert.assertThat; + +public class RepositoryTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Repository.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(Repository.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(Repository.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(Repository.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignmentTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignmentTest.java new file mode 100644 index 0000000000..1629d97efc --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignmentTest.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.onap.sdc.tosca.datatypes.model; + +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.hamcrest.MatcherAssert.assertThat; + +public class RequirementAssignmentTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(RequirementAssignment.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(RequirementAssignment.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(RequirementAssignment.class, hasValidBeanHashCode()); + } + + @Test + public void shouldHaveValidToStringMethod() { + assertThat(RequirementAssignment.class, hasValidBeanToString()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ScalarTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ScalarTest.java new file mode 100644 index 0000000000..6b073a01a8 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ScalarTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class ScalarTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Scalar.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java index 37be2e4cfd..70f93649ab 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplateTest.java @@ -12,6 +12,8 @@ * 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. + * + * Modifications copyright (c) 2019 Nokia */ package org.onap.sdc.tosca.datatypes.model; @@ -25,6 +27,9 @@ import org.junit.Assert; import org.junit.Test; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.hamcrest.MatcherAssert.assertThat; + public class ServiceTemplateTest { private static final String INTERFACE_NO_OPER = "amdocs.interfaces.interfaceNoOper"; @@ -61,4 +66,10 @@ public class ServiceTemplateTest { } } + + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(ServiceTemplate.class, + hasValidGettersAndSettersExcluding("imports", "normalizeInterfaceTypes")); + } } diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/StepDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/StepDefinitionTest.java new file mode 100644 index 0000000000..fa946960bd --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/StepDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class StepDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(StepDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMappingTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMappingTest.java new file mode 100644 index 0000000000..888a51c9af --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMappingTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class SubstitutionMappingTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(SubstitutionMapping.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TimeIntervalTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TimeIntervalTest.java new file mode 100644 index 0000000000..d2df4a5f3c --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TimeIntervalTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class TimeIntervalTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(TimeInterval.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java new file mode 100644 index 0000000000..e033c651ca --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplateTest.java @@ -0,0 +1,54 @@ +/*- + * ============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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +public class TopologyTemplateTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(TopologyTemplate.class, hasValidGettersAndSetters()); + } + + @Test + public void groupShouldBeNullWhenNotInitialized() { + TopologyTemplate topologyTemplate = new TopologyTemplate(); + assertNull(topologyTemplate.getGroups()); + } + + @Test + public void addGroupShouldCorrectlyInitializeAndAddGroup() { + String key = "group1"; + GroupDefinition groupDefinition = new GroupDefinition(); + TopologyTemplate topologyTemplate = new TopologyTemplate(); + topologyTemplate.addGroup(key, groupDefinition); + + assertTrue(topologyTemplate.getGroups().containsKey(key)); + assertEquals(groupDefinition, topologyTemplate.getGroups().get(key)); + + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TriggerTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TriggerTest.java index c9f8d2dd63..875f2eb590 100644 --- a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TriggerTest.java +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/TriggerTest.java @@ -12,6 +12,8 @@ * 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. + * + * Modifications copyright (c) 2019 Nokia */ package org.onap.sdc.tosca.datatypes.model; @@ -23,6 +25,11 @@ import org.junit.Assert; import org.junit.Test; import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +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.hamcrest.MatcherAssert.assertThat; + public class TriggerTest { @@ -89,5 +96,19 @@ public class TriggerTest { Assert.assertNotNull( ((Map)operationAction).get(IMPLEMENTATION)); } + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(Trigger.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(Trigger.class, hasValidBeanEquals()); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(Trigger.class, hasValidBeanHashCode()); + } } diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinitionTest.java new file mode 100644 index 0000000000..ac4315e4bd --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinitionTest.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.onap.sdc.tosca.datatypes.model; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + +public class WorkflowDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(WorkflowDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExtTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExtTest.java new file mode 100644 index 0000000000..2db1636590 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExtTest.java @@ -0,0 +1,47 @@ +/*- + * ============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.onap.sdc.tosca.datatypes.model.extension; + +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 RequirementAssignmentExtTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(RequirementAssignmentExt.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(RequirementAssignmentExt.class, + hasValidBeanEqualsExcluding("capability", "node", "node_filter", "occurrences", "relationship")); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(RequirementAssignmentExt.class, + hasValidBeanHashCodeExcluding("capability", "node", "node_filter", "occurrences", "relationship")); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExtTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExtTest.java new file mode 100644 index 0000000000..aa1290b683 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/extension/SubstitutionMappingExtTest.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.onap.sdc.tosca.datatypes.model.extension; + +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 SubstitutionMappingExtTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(SubstitutionMappingExt.class, hasValidGettersAndSetters()); + } + + @Test + public void shouldHaveValidEquals() { + assertThat(SubstitutionMappingExt.class, hasValidBeanEqualsExcluding("capabilities", "node_type", "requirements")); + } + + @Test + public void shouldHaveValidHashCode() { + assertThat(SubstitutionMappingExt.class, hasValidBeanHashCodeExcluding("capabilities", "node_type", "requirements")); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinitionTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinitionTest.java new file mode 100644 index 0000000000..0581cdbd00 --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinitionTest.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.onap.sdc.tosca.datatypes.model.heatextend; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class AnnotationDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(AnnotationDefinition.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationTypeTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationTypeTest.java new file mode 100644 index 0000000000..605570073f --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationTypeTest.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.onap.sdc.tosca.datatypes.model.heatextend; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class AnnotationTypeTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(AnnotationType.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExtTest.java b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExtTest.java new file mode 100644 index 0000000000..7001c9b3ad --- /dev/null +++ b/common/onap-tosca-datatype/src/test/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExtTest.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.onap.sdc.tosca.datatypes.model.heatextend; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class ParameterDefinitionExtTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(ParameterDefinitionExt.class, hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java index a5c8fde25a..9f6bd25038 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.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.tosca.datatypes.model; @@ -31,11 +33,18 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.hamcrest.MatcherAssert.assertThat; + /** * @author shiria * @since September 07, 2016. */ public class RequirementDefinitionTest { + @Test + public void shouldHaveValidGettersAndSetters() { + assertThat(RequirementDefinition.class, hasValidGettersAndSetters()); + } @Test public void cloneTest() { -- cgit 1.2.3-korg