From f533d987e5858274c13d35cf28b660a44dcd30c4 Mon Sep 17 00:00:00 2001 From: Piotr Darosz Date: Sun, 1 Sep 2019 15:05:38 +0200 Subject: [PATCH] unit tests - openecomp-be Additional junit tests for dao-types Issue-ID: SDC-2326 Signed-off-by: Piotr Darosz Change-Id: I195610e66628d5d8546846592c98c726ba81824d --- .../type/ComponentDependencyModelEntityTest.java | 65 ++++++++++++++++++++++ .../type/ComponentMonitoringUploadEntityTest.java | 34 +++++++++++ ...chestrationTemplateCandidateDataEntityTest.java | 34 +++++++++++ .../dao/type/PackageInfoTest.java | 34 +++++++++++ .../dao/type/ProcessEntityTest.java | 64 +++++++++++++++++++++ .../dao/type/TranslatedFileDataTest.java | 34 +++++++++++ .../dao/type/VspDetailsTest.java | 35 ++++++++++++ .../dao/type/VspQuestionnaireEntityTest.java | 35 ++++++++++++ 8 files changed, 335 insertions(+) create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/OrchestrationTemplateCandidateDataEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfoTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntityTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileDataTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetailsTest.java create mode 100644 openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntityTest.java diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntityTest.java new file mode 100644 index 0000000000..2af1505b78 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentDependencyModelEntityTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; +import org.openecomp.sdc.versioning.dao.types.Version; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; + +public class ComponentDependencyModelEntityTest { + @Test + public void accessorsTest() { + assertThat(ComponentDependencyModelEntity.class, + hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId")); + } + + + @Test + public void equalsTest() { + String vspId = "1"; + Version version = new Version("2"); + String dependencyId = "3"; + ComponentDependencyModelEntity obj = null; + ComponentDependencyModelEntity componentDependencyModelEntity = + new ComponentDependencyModelEntity(vspId, version, dependencyId); + assertNotEquals(componentDependencyModelEntity, obj); + obj = new ComponentDependencyModelEntity(vspId, version, dependencyId); + assertEquals(componentDependencyModelEntity, obj); + } + + @Test + public void hashCodeTest() { + String vspId = "1"; + Version version = new Version("2"); + String dependencyId = "3"; + ComponentDependencyModelEntity obj = new ComponentDependencyModelEntity(vspId, version, dependencyId); + ComponentDependencyModelEntity componentDependencyModelEntity = + new ComponentDependencyModelEntity(vspId, version, dependencyId); + + assertEquals(obj.hashCode(), componentDependencyModelEntity.hashCode()); + assertNotEquals(obj.hashCode(), null); + assertNotEquals(componentDependencyModelEntity.hashCode(), 0); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntityTest.java new file mode 100644 index 0000000000..525925dd0a --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ComponentMonitoringUploadEntityTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + +public class ComponentMonitoringUploadEntityTest { + @Test + public void accessorsTest() { + assertThat(ComponentMonitoringUploadEntity.class, + hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId")); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/OrchestrationTemplateCandidateDataEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/OrchestrationTemplateCandidateDataEntityTest.java new file mode 100644 index 0000000000..76dc7d0b19 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/OrchestrationTemplateCandidateDataEntityTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + +public class OrchestrationTemplateCandidateDataEntityTest { + @Test + public void accessorsTest() { + assertThat(OrchestrationTemplateCandidateDataEntity.class, + hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId")); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfoTest.java new file mode 100644 index 0000000000..ea8925b330 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/PackageInfoTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class PackageInfoTest { + @Test + public void accessorsTest() { + assertThat(PackageInfo.class, + hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntityTest.java new file mode 100644 index 0000000000..91a92e4e7a --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/ProcessEntityTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; +import org.openecomp.sdc.versioning.dao.types.Version; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; + +public class ProcessEntityTest { + @Test + public void accessorsTest() { + assertThat(ProcessEntity.class, + hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId")); + } + + @Test + public void equalsTest() { + String vspId = "1"; + Version version = new Version("2"); + String componentId = "3"; + String id = "4"; + ProcessEntity obj = null; + ProcessEntity processEntity = new ProcessEntity(vspId, version, componentId, id); + assertNotEquals(processEntity, obj); + obj = new ProcessEntity(vspId, version, componentId, id); + assertEquals(processEntity, obj); + } + + @Test + public void hashCodeTest() { + String vspId = "1"; + Version version = new Version("2"); + String componentId = "3"; + String id = "4"; + ProcessEntity obj = new ProcessEntity(vspId, version, componentId, id); + ProcessEntity processEntity = new ProcessEntity(vspId, version, componentId, id); + + assertEquals(obj.hashCode(), processEntity.hashCode()); + assertNotEquals(obj.hashCode(), null); + assertNotEquals(processEntity.hashCode(), 0); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileDataTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileDataTest.java new file mode 100644 index 0000000000..1d12a4b066 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/TranslatedFileDataTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; +import static org.junit.Assert.assertThat; + +public class TranslatedFileDataTest { + @Test + public void accessorsTest() { + assertThat(TranslatedFileData.class, + hasValidGettersAndSetters()); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetailsTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetailsTest.java new file mode 100644 index 0000000000..66f6bf23f4 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetailsTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + +public class VspDetailsTest { + @Test + public void accessorsTest() { + assertThat(VspDetails.class, + hasValidGettersAndSettersExcluding("compositionData", "compositionEntityId", "entityType", + "firstClassCitizenId", "type")); + } +} \ No newline at end of file diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntityTest.java new file mode 100644 index 0000000000..07e3f31366 --- /dev/null +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspQuestionnaireEntityTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.vendorsoftwareproduct.dao.type; + +import org.junit.Test; + +import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; +import static org.junit.Assert.assertThat; + +public class VspQuestionnaireEntityTest { + @Test + public void accessorsTest() { + assertThat(VspQuestionnaireEntity.class, + hasValidGettersAndSettersExcluding("compositionData", "compositionEntityId", "entityType", + "firstClassCitizenId", "type")); + } +} \ No newline at end of file -- 2.16.6