From 2da911f8ba408fbbf3d7639796208078fac28e32 Mon Sep 17 00:00:00 2001 From: vempo Date: Thu, 1 Nov 2018 20:27:39 +0200 Subject: [PATCH] Sorted out unit-test libraries in onboarding Fixed scope, removed junit+tesng combinations, deleted commented-out tests, did minor cleanups. Change-Id: I71d0adf5c1c95435987dbb8b4077cc43bdf09df8 Issue-ID: SDC-1886 Signed-off-by: vempo --- .../onap-sdc-artifact-generator-api/pom.xml | 29 +- common/onap-tosca-datatype/pom.xml | 19 +- .../togglz-rest/togglz-rest-services/pom.xml | 2 - .../vendor-license-rest-services/pom.xml | 5 - .../rest/mapping/ChoiceOrOtherMappingTest.java | 20 +- .../MapChoiceOrOtherDtoToChoiceOrOtherTest.java | 6 +- .../MapChoiceOrOtherToChoiceOrOtherDtoTest.java | 8 +- ...ntPoolEntityToEntitlementPoolEntityDtoTest.java | 13 +- ...tPoolRequestDtoToEntitlementPoolEntityTest.java | 11 +- ...GroupDescriptorDtoToFeatureGroupEntityTest.java | 6 +- ...GroupEntityToFeatureGroupDescriptorDtoTest.java | 6 +- ...tDescriptorDtoToLicenseAgreementEntityTest.java | 6 +- ...tEntityToLicenseAgreementDescriptorDtoTest.java | 6 +- ...yGroupEntityToLicenseKeyGroupEntityDtoTest.java | 13 +- ...GroupRequestDtoToLicenseKeyGroupEntityTest.java | 6 +- .../MapLimitEntityToLimitCreationDtoTest.java | 4 +- .../rest/mapping/MapLimitEntityToLimitDtoTest.java | 6 +- ...tiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java | 9 +- ...tiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java | 9 +- .../MapVendorLicenseModelEntityToDtoTest.java | 6 +- ...elRequestDtoToVendorLicenseModelEntityTest.java | 6 +- .../vendor-software-products-rest-types/pom.xml | 17 + .../backend/openecomp-sdc-action-manager/pom.xml | 23 +- .../pom.xml | 18 +- .../openecomp-sdc-healthcheck-manager/pom.xml | 20 +- .../openecomp-sdc-item-permissions-manager/pom.xml | 20 +- .../openecomp-sdc-validation-manager/pom.xml | 23 +- .../openecomp-sdc-vendor-license-manager/pom.xml | 26 +- .../pom.xml | 35 +- .../sdc/vendorsoftwareproduct/ComputeTest.java | 265 --------- .../DeploymentFlavorTest.java | 404 ------------- .../sdc/vendorsoftwareproduct/VspHealTest.java | 217 ------- .../services/QuestionnaireValidatorTest.java | 94 --- .../services/impl/CandidateServiceImplTest.java | 17 +- .../CompositionDataExtractorImplTest.java | 19 +- .../schemagenerator/SchemaGeneratorTest.java | 250 -------- .../tree/HeatTreeManagerTest.java | 4 +- .../vendorsoftwareproduct/tree/UploadFileTest.java | 19 +- .../HeatCleanup/HeatCleanupOnNewUploadTest.java | 154 ----- .../upload/csar/ManifestParsingTest.java | 23 +- .../upload/csar/UploadCSARFileTest.java | 23 +- .../validation/UploadFileValidationTest.java | 201 ------- .../openecomp-config-lib/pom.xml | 17 +- .../openecomp-nosqldb-api/pom.xml | 19 +- .../openecomp-nosqldb-core/pom.xml | 32 +- .../org/openecomp/core/nosqldb/NoSqlDbTest.java | 63 --- .../nosqldb/util/ConfigurationManagerTest.java | 41 +- .../openecomp-session-lib/pom.xml | 1 + .../openecomp-utilities-lib/pom.xml | 29 +- .../core/utilities/CommonMethodsTest.java | 84 ++- .../utilities/file/FileContentHandlerTest.java | 31 +- .../core/utilities/file/FileUtilsTest.java | 17 +- .../json/JsonSchemaDataGeneratorTest.java | 8 +- .../core/utilities/json/JsonUtilTest.java | 11 +- .../openecomp-sdc-healing-impl/pom.xml | 17 +- openecomp-be/lib/openecomp-heat-lib/pom.xml | 18 +- .../openecomp-item-permissions-core/pom.xml | 18 +- .../openecomp-item-permissions-impl/pom.xml | 4 +- .../lib/openecomp-sdc-datatypes-lib/pom.xml | 18 + .../openecomp-sdc-enrichment-api/pom.xml | 21 + .../openecomp-sdc-enrichment-core/pom.xml | 33 +- .../enrichment/impl/EnrichmentManagerImplTest.java | 28 +- .../openecomp-sdc-enrichment-impl/pom.xml | 37 +- .../artifact/MonitoringMibEnricherTest.java | 43 +- .../artifact/ProcessArtifactEnricherTest.java | 47 +- .../tosca/AbstractSubstituteToscaEnricherTest.java | 35 +- .../impl/tosca/PortMirroringEnricherTest.java | 29 +- .../openecomp-sdc-logging-api/pom.xml | 1 - .../openecomp-sdc-logging-core/pom.xml | 1 - .../openecomp-sdc-model-impl/pom.xml | 22 +- .../openecomp-sdc-notification-api/pom.xml | 20 +- .../openecomp-sdc-notification-core/pom.xml | 20 +- .../openecomp-sdc-tosca-generator-core/pom.xml | 17 +- .../openecomp-sdc-translator-api/pom.xml | 21 + .../openecomp-sdc-translator-core/pom.xml | 28 +- .../openecomp-sdc-validation-core/pom.xml | 20 +- .../openecomp-sdc-validation-impl/pom.xml | 32 +- .../impl/validators/ContrailValidatorTest.java | 9 +- .../impl/validators/ErrorMessagesTest.java | 2 +- .../ForbiddenResourceGuideLineValidatorTest.java | 33 +- .../impl/validators/HeatResourceValidatorTest.java | 23 +- .../impl/validators/HeatValidatorTest.java | 11 +- .../impl/validators/ManifestValidatorTest.java | 7 +- .../SharedResourceGuideLineValidatorTest.java | 23 +- .../impl/validators/YamlValidatorTest.java | 7 +- ...ContrailNetworkPolicyResourceValidatorTest.java | 25 +- .../heatresource/NestedResourceValidatorTest.java | 9 +- .../NeutronPortResourceValidatorTest.java | 25 +- .../NeutronSecurityGroupResourceValidatorTest.java | 25 +- .../NovaServerGroupResourceValidatorTest.java | 25 +- .../NovaServerResourceValidatorTest.java | 25 +- .../ResourceGroupResourceValidatorTest.java | 7 +- .../VirtualMachineInterfaceValidatorTest.java | 7 +- ...rviceInstanceNamingConventionValidatorTest.java | 23 +- ...rviceTemplateNamingConventionValidatorTest.java | 23 +- .../NeutronPortNamingConventionValidatorTest.java | 23 +- ...rverNamingConventionGuideLineValidatorTest.java | 25 +- ...tualMachineInterfaceGuidelineValidatorTest.java | 21 +- .../sdc/validation/util/ValidationTestUtil.java | 19 +- .../openecomp-sdc-validation-sdk/pom.xml | 2 +- .../openecomp-sdc-vendor-license-core/pom.xml | 16 +- .../pom.xml | 26 +- .../dao/ServiceModelDaoFactoryTest.java | 37 +- .../openecomp-sdc-versioning-api/pom.xml | 33 +- .../openecomp-sdc-versioning-core/pom.xml | 16 +- .../dao/impl/zusammen/ItemZusammenDaoImplTest.java | 103 ++-- .../impl/zusammen/VersionZusammenDaoImplTest.java | 55 +- .../versioning/impl/AsdcItemManagerImplTest.java | 43 +- .../sdc/versioning/impl/ItemManagerImplTest.java | 82 ++- .../versioning/impl/VersioningManagerImplTest.java | 627 ++------------------- .../openecomp-tosca-converter-core/pom.xml | 1 - openecomp-be/lib/openecomp-tosca-lib/pom.xml | 22 +- openecomp-be/tools/zusammen-tools/pom.xml | 17 +- 113 files changed, 1512 insertions(+), 2916 deletions(-) delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VspHealTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java delete mode 100644 openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java delete mode 100644 openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/pom.xml b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/pom.xml index b1b734eb1d..931d737092 100644 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/pom.xml +++ b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/pom.xml @@ -1,3 +1,19 @@ + + @@ -62,23 +78,10 @@ reflections ${org.reflections.version} - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - - junit junit test - ${junit.version} diff --git a/common/onap-tosca-datatype/pom.xml b/common/onap-tosca-datatype/pom.xml index 5a8af7bffe..fb9d4ac4a5 100644 --- a/common/onap-tosca-datatype/pom.xml +++ b/common/onap-tosca-datatype/pom.xml @@ -1,10 +1,25 @@ + + 4.0.0 - org.onap.sdc.common onap-tosca-datatype @@ -38,7 +53,6 @@ junit junit test - ${junit.version} org.mockito @@ -54,6 +68,7 @@ org.projectlombok lombok + provided diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml index f3b8e52e6c..283917692b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/togglz-rest/togglz-rest-services/pom.xml @@ -53,14 +53,12 @@ junit junit - ${junit.version} test org.mockito mockito-core test - ${mockito.version} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml index 04f8f4fdf0..f3bc59676a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml @@ -53,11 +53,6 @@ org.testng testng - - - junit - junit - ${junit.version} test diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/ChoiceOrOtherMappingTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/ChoiceOrOtherMappingTest.java index 30a0922bd9..89d57dcac6 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/ChoiceOrOtherMappingTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/ChoiceOrOtherMappingTest.java @@ -1,11 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdcrests.vendorlicense.rest.mapping; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; - /** * Any change to ChoiceOrOther easily break reconstruction of objects of this type. * This test protects from such accidental changes. diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java index 77cedd0033..1a1dae8352 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherDtoToChoiceOrOtherTest.java @@ -16,11 +16,11 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapChoiceOrOtherDtoToChoiceOrOtherTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java index caeba0cddc..aff5237de7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapChoiceOrOtherToChoiceOrOtherDtoTest.java @@ -16,13 +16,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; -import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; -import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; - import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; +import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; +import org.testng.annotations.Test; + public class MapChoiceOrOtherToChoiceOrOtherDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java index 8db209875c..f2010e62de 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.java @@ -16,18 +16,17 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; -import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; -import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; -import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; -import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; +import static org.testng.Assert.assertEquals; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; - -import static org.testng.Assert.assertEquals; +import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto; +import org.testng.annotations.Test; public class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java index f194da1708..7ff6fb78f5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.java @@ -16,16 +16,15 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + +import java.util.Collections; +import java.util.HashSet; import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; - -import java.util.Collections; -import java.util.HashSet; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java index 7edbc364c1..035d36707e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest.java @@ -16,11 +16,11 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapFeatureGroupDescriptorDtoToFeatureGroupEntityTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java index 4ec119701b..cc67603dea 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest.java @@ -16,11 +16,11 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdcrests.vendorlicense.types.FeatureGroupDescriptorDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapFeatureGroupEntityToFeatureGroupDescriptorDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java index 819db1ce2c..2b94178a54 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest.java @@ -16,13 +16,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; import org.openecomp.sdcrests.vendorlicense.types.ChoiceOrOtherDto; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapLicenseAgreementDescriptorDtoToLicenseAgreementEntityTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java index f44f5dcc42..b7c74e0bc1 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest.java @@ -16,13 +16,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.ChoiceOrOther; import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm; import org.openecomp.sdcrests.vendorlicense.types.LicenseAgreementDescriptorDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapLicenseAgreementEntityToLicenseAgreementDescriptorDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java index 5f387fbb45..6a6ae363f7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest.java @@ -16,15 +16,18 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; -import org.openecomp.sdc.vendorlicense.dao.types.*; -import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; +import static org.testng.Assert.assertEquals; import java.util.Collections; import java.util.HashSet; import java.util.Set; - -import static org.testng.Assert.assertEquals; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; +import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; +import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; +import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupEntityDto; +import org.testng.annotations.Test; public class MapLicenseKeyGroupEntityToLicenseKeyGroupEntityDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java index 806c3b6297..a4c1cd9d45 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.java @@ -16,15 +16,15 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType; import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope; import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit; import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto; import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java index 68a5811ba5..2137914f82 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitCreationDtoTest.java @@ -15,10 +15,10 @@ */ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import static org.junit.Assert.assertEquals; +import static org.testng.Assert.assertEquals; -import org.junit.Test; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; +import org.testng.annotations.Test; public class MapLimitEntityToLimitCreationDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java index e58b570003..d8034dd65b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitEntityToLimitDtoTest.java @@ -16,13 +16,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitType; import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapLimitEntityToLimitDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java index 377fbf1a5b..21f572963e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest.java @@ -16,14 +16,13 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; -import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; -import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; +import static org.testng.Assert.assertEquals; import java.util.HashSet; import java.util.Set; - -import static org.testng.Assert.assertEquals; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; +import org.testng.annotations.Test; public class MapMultiChoiceOrOtherDtoToMultiChoiceOrOtherTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java index fbffad4884..a0db43e4cd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.java @@ -16,15 +16,14 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; -import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; -import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; +import static org.testng.Assert.assertEquals; import java.util.Collections; import java.util.HashSet; import java.util.Set; - -import static org.testng.Assert.assertEquals; +import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther; +import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto; +import org.testng.annotations.Test; public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java index ea57f412d2..b40c6692e5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelEntityToDtoTest.java @@ -16,11 +16,11 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelEntityDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapVendorLicenseModelEntityToDtoTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java index 208242062b..bd4869ee49 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/test/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest.java @@ -16,11 +16,11 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; -import org.junit.Test; +import static org.testng.Assert.assertEquals; + import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelRequestDto; - -import static org.testng.Assert.assertEquals; +import org.testng.annotations.Test; public class MapVendorLicenseModelRequestDtoToVendorLicenseModelEntityTest { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml index 9fd4c104e5..9267963fe2 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml @@ -1,4 +1,20 @@ + + @@ -33,6 +49,7 @@ org.projectlombok lombok + provided diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml index 6ffa7d314b..e136620afb 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-action-manager/pom.xml @@ -1,4 +1,20 @@ + + @@ -30,16 +46,9 @@ openecomp-nosqldb-core ${project.version} - - org.testng - testng - ${testng.version} - test - junit junit - ${junit.version} test diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml index 87f13bb293..59e409f5b4 100644 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/pom.xml @@ -1,10 +1,25 @@ + + 4.0.0 - org.openecomp.sdc openecomp-sdc-application-config-manager @@ -22,7 +37,6 @@ org.testng testng - ${testng.version} test diff --git a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml index 83630a11c7..8d612d07b8 100644 --- a/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-healthcheck-manager/pom.xml @@ -1,4 +1,20 @@ + + @@ -42,14 +58,12 @@ org.mockito - mockito-all - ${mockito.all.version} + mockito-core test junit junit - ${junit.version} test diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/pom.xml index c6ea03de32..5b34aa80a2 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/pom.xml @@ -1,4 +1,20 @@ + + @@ -58,13 +74,11 @@ org.testng testng - ${testng.version} test org.mockito - mockito-all - ${mockito.all.version} + mockito-core test diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml index 4fd780c95b..b6c3bbb8a0 100644 --- a/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-validation-manager/pom.xml @@ -1,4 +1,20 @@ + + @@ -23,16 +39,9 @@ openecomp-heat-lib ${project.version} - - org.testng - testng - ${testng.version} - test - junit junit - ${junit.version} test diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml index b68b5eded7..3ebfb06470 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -19,21 +35,13 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.testng testng test - ${testng.version} - - - snakeyaml - org.yaml - - javax.el diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml index f995274c5d..d0117deb5b 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml @@ -1,4 +1,20 @@ + + @@ -52,19 +68,11 @@ org.testng testng - ${testng.version} - test - - - junit - junit - ${junit.version} test org.mockito - mockito-all - ${mockito.all.version} + mockito-core test @@ -160,22 +168,21 @@ org.powermock powermock-module-testng-common - 1.6.3 + ${powermock.version} test org.powermock - powermock-api-mockito - 1.6.5 + powermock-api-mockito2 + ${powermock.version} test org.powermock powermock-module-testng - 1.6.3 + ${powermock.version} test - org.openecomp.sdc openecomp-sdc-activity-log-api diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java deleted file mode 100644 index 3df06ba8eb..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/ComputeTest.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.openecomp.sdc.vendorsoftwareproduct; - -public class ComputeTest { - - /*private static final String USER1 = "componentsTestUser1"; - private static final String USER2 = "componentsTestUser2"; - private static final Version VERSION01 = new Version(0, 1); - private static final VendorSoftwareProductManager vendorSoftwareProductManager = - new VendorSoftwareProductManagerImpl(); - private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory - .getInstance().createInterface(); - - private static String vsp1Id; - private static String vsp2Id; - private static String comp1 = "{\"displayName\": \"VFC_Manual\", " + - "\"description\": \"desc manual\"}"; - private static String compute1 = "{\"name\": \"Compute_A\", " + - "\"description\": \"desc manual compute\"}"; - private static String computeDelete = "{\"name\": \"Compute_Delete\", " + - "\"description\": \"desc manual compute delete\"}"; - - private static String comp1Id; - private static String compute1Id; - private ComputeEntity createdCompute; - - static ComponentEntity createComponent(String vspId, Version version, String compId) { - ComponentEntity componentEntity = new ComponentEntity(vspId, version, compId); - ComponentData compData = new ComponentData(); - compData.setName(compId + " name"); - compData.setDisplayName(compId + " display name"); - compData.setDescription(compId + " desc"); - componentEntity.setComponentCompositionData(compData); - vendorSoftwareProductDao.createComponent(componentEntity); - return componentEntity; - } - - static ComputeEntity createComputeEntity(String vspId, String componentId, String data ){ - ComputeEntity comp = new ComputeEntity(); - comp.setVspId(vspId); - comp.setComponentId(componentId); - comp.setCompositionData(data); - return comp; - } - - @BeforeClass - private void init() { - VspDetails - vsp1 = vendorSoftwareProductManager.createNewVsp(VSPCommon - .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName", - "vlm1Id", "icon", "category", "subCategory", "123", null, - VSPCommon.OnboardingMethod.HEAT.name()), USER1 - ); - vsp1Id = vsp1.getId(); //HEAT onboarded - - VspDetails vsp2 = vendorSoftwareProductManager.createNewVsp(VSPCommon - .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp3", - "vendorName", - "vlm1Id", "icon", "category", "subCategory", "123", null, VSPCommon - .OnboardingMethod.Manual.name()), USER1); - vsp2Id = vsp2.getId(); //MANUAL onboarded - - ComponentEntity component = new ComponentEntity(); - component.setVspId(vsp2Id); - component.setCompositionData(comp1); - ComponentEntity createdComp = vendorSoftwareProductManager.createComponent(component, USER1); - comp1Id = createdComp.getId(); - } - - @Test - public void testListWhenNone() { - - final Collection listComputeResponses = - vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1); - Assert.assertEquals(listComputeResponses.size(), 0); - } - - @Test - public void testCreateComputeInHeatOnboardedVsp_negative() { - ComputeEntity comp = createComputeEntity(vsp1Id,comp1Id,compute1); - try { - createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1); - Assert.fail(); - } - catch(CoreException exception){ - Assert.assertEquals(exception.code().id(),ADD_COMPUTE_NOT_ALLOWED_IN_HEAT_ONBOARDING); - } - } - - @Test(dependsOnMethods = "testListWhenNone") - public void testCreateCompute() { - ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,compute1); - - createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1); - compute1Id = createdCompute.getId(); - Assert.assertNotNull(compute1Id); - Assert.assertNotNull(createdCompute.getCompositionData()); - Assert.assertNotNull( - vendorSoftwareProductManager.getCompute(vsp2Id, VERSION01, comp1Id,compute1Id, - USER1).getData()); - } - - @Test(dependsOnMethods = "testCreateCompute") - public void testCreateComputeNegative() { - ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,compute1); - - try { - ComputeEntity createdCompute = vendorSoftwareProductManager.createCompute(comp, USER1); - Assert.fail(); - } - catch (CoreException exception) { - Assert.assertEquals(exception.code().id(),DUPLICATE_COMPUTE_NAME_NOT_ALLOWED); - } - } - - @Test - public void testGetNonExistingComponentId_negative() { - testGet_negative(vsp1Id, null, "non existing component id", compute1Id, USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testGetNonExistingVspId_negative() { - testGet_negative("non existing vsp id", null, comp1Id, compute1Id, USER1, - VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); - } - - @Test - public void testGetNonExistingComputeId_negative() { - testGet_negative(vsp1Id, null, comp1Id, "non existing compute id", USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test(dependsOnMethods = "testCreateCompute") - public void testGetCompute() { - testGet(vsp2Id, VERSION01, comp1Id, compute1Id, USER1, createdCompute); - } - - - @Test(dependsOnMethods = "testCreateCompute") - public void testListCompute() { - - final Collection actual = - vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1); - Assert.assertEquals(actual.size(), 1); - actual.forEach(listComputeResponse -> { - Assert.assertEquals(listComputeResponse.isAssociatedWithDeploymentFlavor(), false); - } ); - } - - - @Test(dependsOnMethods = "testListCompute") - public void testListComputeAssociatedWithDeployment() { - - //Create DF and associate compute1Id CF to it - String deployment1Id = null; - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id, - VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("DF_testListComputeAssociatedWithDeployment"); - deploymentFlavor.setDescription("creating a deployment flavor with compute flavor association"); - ComponentComputeAssociation association = new ComponentComputeAssociation(); - association.setComponentId(comp1Id); - association.setComputeFlavorId(compute1Id); - List associations = new ArrayList(); - associations.add(association); - deploymentFlavor.setComponentComputeAssociations(associations); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - - DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - Assert.assertEquals((createddeployment.getId() != null), true); - deployment1Id = createddeployment.getId(); - - final Collection actual = - vendorSoftwareProductManager.listCompute(vsp2Id, null, comp1Id, USER1); - Assert.assertEquals(actual.size(), 1); - actual.forEach(listComputeResponse -> { - Assert.assertEquals(listComputeResponse.isAssociatedWithDeploymentFlavor(), true); - } ); - } - - @Test - public void testUpdateNonExistingComponentId_negative() { - testUpdate_negative(vsp1Id, "non existing component id", USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testUpdateNonExistingVspId_negative() { - testUpdate_negative("non existing vsp id", comp1Id, USER1, - VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); - } - - @Test - public void testDelete() { - ComputeEntity comp = createComputeEntity(vsp2Id,comp1Id,computeDelete); - - ComputeEntity created = vendorSoftwareProductManager.createCompute(comp, USER1); - - vendorSoftwareProductManager.deleteCompute(vsp2Id,comp1Id,created.getId(),USER1); - testGet_negative(vsp2Id,null, comp1Id, created.getId(),USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testDeleteNonExistingComputeId_negative() { - testDelete_negative(vsp2Id,comp1Id,"InvalidComputeId",USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testDeleteNonExistingComponentId_negative() { - testDelete_negative(vsp2Id,"InvalidComponentId",compute1Id,USER1, - VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testDeleteNonExistingVspId_negative() { - testDelete_negative("InvalidVspId",comp1Id,compute1Id,USER1, - VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST); - } - - private void testGet(String vspId, Version version, String componentId, String computeId, String - user, ComputeEntity expected) { - CompositionEntityResponse - response = vendorSoftwareProductManager.getCompute(vspId, null, componentId, computeId, - user); - Assert.assertEquals(response.getId(), expected.getId()); - Assert.assertEquals(response.getData(), expected.getComputeCompositionData()); - Assert.assertNotNull(response.getSchema()); - } - - private void testGet_negative(String vspId, Version version, String componentId, String computeId, - String user, String expectedErrorCode) { - try { - vendorSoftwareProductManager.getCompute(vspId, version, componentId, computeId, user); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - } - - private void testDelete_negative(String vspId, String componentId, String computeId, String user, - String expectedErrorCode){ - try { - vendorSoftwareProductManager.deleteCompute(vspId, componentId, computeId, user); - Assert.fail(); - } - catch(CoreException exception){ - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - } - - private void testUpdate_negative(String vspId, String componentId, String user, - String expectedErrorCode) { - try { - vendorSoftwareProductManager - .updateComponent(new ComponentEntity(vspId, null, componentId), user); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - }*/ -} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java deleted file mode 100644 index 77c81111a5..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/DeploymentFlavorTest.java +++ /dev/null @@ -1,404 +0,0 @@ -package org.openecomp.sdc.vendorsoftwareproduct; - -public class DeploymentFlavorTest { - /*private static final String USER1 = "deploymentTestUser1"; - private static final String USER2 = "deploymentTestUser2"; - private static final Version VERSION01 = new Version(0, 1); - private static final VendorSoftwareProductManager vendorSoftwareProductManager = - new VendorSoftwareProductManagerImpl(); - private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface(); - - private static String vsp1Id; - private static String vsp2Id; - private static String vsp3Id; - private static String component11Id; - private static String component21Id; - private static String deployment1Id = "deployment1"; - private static String deployment2Id = "deployment2"; - - @BeforeClass - private void init() { - List featureGroups = new ArrayList<>(); - featureGroups.add("fg01"); - featureGroups.add("fg02"); - vsp1Id = vendorSoftwareProductManager.createNewVsp(VSPCommon - .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp1", "vendorName1", - "vlm1Id", "icon", "category", "subCategory", "123", featureGroups, - VSPCommon.OnboardingMethod. - Manual.name()), USER1).getId(); - component11Id = ComponentsTest.createComponent(vsp1Id, VERSION01, "component11").getId(); - - vsp2Id = vendorSoftwareProductManager.createNewVsp(VSPCommon - .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp2", "vendorName1", - "vlm1Id", "icon", "category", "subCategory", "123", null, - VSPCommon.OnboardingMethod.Manual.name()), USER1).getId(); - component21Id = ComponentsTest.createComponent(vsp2Id, VERSION01, "component21").getId(); - - vsp3Id = vendorSoftwareProductManager.createNewVsp(VSPCommon - .createVspDetails(null, null, "VSP_" + CommonMethods.nextUuId(), "Test-vsp3forDeployment", - "vendorName1", - "vlm1Id", "icon", "category", "subCategory", "123", null, - VSPCommon.OnboardingMethod.HEAT.name()), USER1).getId(); - } - - static DeploymentFlavorEntity createDeploymentFlavor(String vspId, Version version, String deploymentFlavorId) { - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vspId, version, deploymentFlavorId); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel(deploymentFlavorId + " name"); - deploymentFlavor.setDescription(deploymentFlavorId + " desc"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager - .createDeploymentFlavor(deploymentFlavorEntity, USER1); - deployment2Id = createdDeployment.getId(); - return deploymentFlavorEntity; - } - - @Test - public void testCreate() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentcreatewithoutFG"); - deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " + - "association"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - Assert.assertEquals((createddeployment.getId() != null), true); - deployment1Id = createddeployment.getId(); - } - - @Test(dependsOnMethods = "testCreate") - public void testUniqueModelCreate() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentcreatewithoutFG"); - deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " + - "association"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), DUPLICATE_DEPLOYMENT_FLAVOR_MODEL_NOT_ALLOWED); - } - } - - @Test - public void testInvalidFeatureGroup() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestInvalidFeatureGroup"); - deploymentFlavor.setDescription("creating a deployment flavor with invalid FG and without any" + - " " + - "association"); - deploymentFlavor.setFeatureGroupId("fg01"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), FEATURE_GROUP_NOT_EXIST_FOR_VSP); - } - } - - @Test - public void testInvalidAssociation() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("testInvalidAssociation"); - deploymentFlavor.setDescription("creating a deployment flavor with wrong association with " + - "null compute flavor id"); - List componentComputeAssociationList = new ArrayList<>(); - ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation(); - componentComputeAssociation.setComputeFlavorId("72138712"); - componentComputeAssociationList.add(componentComputeAssociation); - deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), INVALID_COMPONENT_COMPUTE_ASSOCIATION); - } - - } - - @Test - public void testInvalidComputeFlavorIdAssociation() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("testInvalidComputeFlavorIdAssociation"); - deploymentFlavor.setDescription("creating a deployment flavor with wrong compute flavor id in" + - " assocation"); - List componentComputeAssociationList = new ArrayList<>(); - ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation(); - componentComputeAssociation.setComponentId(component21Id); - componentComputeAssociation.setComputeFlavorId("123123"); - componentComputeAssociationList.add(componentComputeAssociation); - deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), INVALID_COMPUTE_FLAVOR_ID); - } - - } - - @Test - public void testInvalidVfcIdAssociation() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("testInvalidVfcIdAssociation"); - deploymentFlavor.setDescription("creating a deployment flavor with invalid vfcid association"); - List componentComputeAssociationList = new ArrayList<>(); - ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation(); - componentComputeAssociation.setComponentId("WRONGVFCID"); - componentComputeAssociation.setComputeFlavorId("123123"); - componentComputeAssociationList.add(componentComputeAssociation); - deploymentFlavor.setComponentComputeAssociations(componentComputeAssociationList); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - } - - @Test - public void testNegativeforVspHeatOnboarded() { - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp3Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentcreatewithoutFG"); - deploymentFlavor.setDescription("creating a deployment flavor for VSP onboarded with HEAT"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - try { - vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), - CREATE_DEPLOYMENT_FLAVOR_NOT_ALLOWED_IN_HEAT_ONBOARDING); - } - } - - @Test - public void testGetNegative_InvalidVspId(){ - testGetNegative("InvalidVspId", VERSION01, deployment1Id, USER1, VERSIONABLE_ENTITY_NOT_EXIST); - } - - @Test - public void testGetNegative_InvalidDeploymentFlavorId(){ - testGetNegative(vsp1Id, VERSION01, deployment1Id, USER1, VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testGet(){ - DeploymentFlavorEntity expected = createDeploymentFlavor(vsp1Id, VERSION01,deployment2Id); - testGet(vsp1Id, VERSION01, deployment2Id, USER1, expected); - } - - private void testGet(String vspId, Version version, String componentId, String user, - DeploymentFlavorEntity expected) { - CompositionEntityResponse response = vendorSoftwareProductManager - .getDeploymentFlavor(vspId, null, componentId, user); - Assert.assertEquals(response.getId(), expected.getId()); - Assert.assertEquals(response.getData().getDescription(), - expected.getDeploymentFlavorCompositionData().getDescription()); - Assert.assertEquals(response.getData().getModel(), - expected.getDeploymentFlavorCompositionData().getModel()); - Assert.assertEquals(response.getData().getFeatureGroupId(), - expected.getDeploymentFlavorCompositionData().getFeatureGroupId()); - Assert.assertEquals(response.getData().getComponentComputeAssociations(), - expected.getDeploymentFlavorCompositionData().getComponentComputeAssociations()); - Assert.assertNotNull(response.getSchema()); - } - - private void testGetNegative(String vspId, Version version, String deploymentFlavorId, String User, - String expectedErrorCode){ - try{ - vendorSoftwareProductManager.getDeploymentFlavor(vspId, version, deploymentFlavorId, User); - Assert.fail(); - } catch (CoreException exception){ - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - } - - @Test - public void testUpdateNegative_InvalidVspId(){ - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity("InvalidVspId", - VERSION01,deployment2Id); - DeploymentFlavor deploymentFlavorData = new DeploymentFlavor(); - deploymentFlavorData.setModel(deployment2Id); - deploymentFlavorData.setDescription("updating a deployment flavor with invalid VspId and without any" + - "association"); - deploymentFlavorData.setFeatureGroupId("fg01"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData); - - testUpdateNegative(deploymentFlavorEntity, USER1, VERSIONABLE_ENTITY_NOT_EXIST); - } - - @Test - public void testUpdateNegative_InvalidDeploymentFlavorId(){ - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp1Id, - VERSION01,"InvalidDeploymentFlavorId"); - testUpdateNegative(deploymentFlavorEntity, USER1, VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test(dependsOnMethods = "testCreate") - public void testUpdateNegative_InvalidFeatureGroup(){ - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id, - VERSION01,deployment1Id); - DeploymentFlavor deploymentFlavorData = new DeploymentFlavor(); - deploymentFlavorData.setModel("TestDeploymentCreateWithoutFG"); - deploymentFlavorData.setDescription("updating a deployment flavor with invalid FeatureGroupId and without any" + - "association"); - deploymentFlavorData.setFeatureGroupId("fg01"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData); - String expectedError = "#/featureGroupId: " - +deploymentFlavorData.getFeatureGroupId()+" is not a valid value. Possible values: "; - - final CompositionEntityValidationData validationData = vendorSoftwareProductManager - .updateDeploymentFlavor(deploymentFlavorEntity, USER1); - final Collection errors = validationData.getErrors(); - final Object[] objects = errors.toArray(); - Assert.assertEquals(errors.size(), 1); - Assert.assertEquals(objects[0], expectedError); - } - - @Test(dependsOnMethods = "testCreate") - public void testUpdateNegative_InvalidComputeFlavorIdAssociation(){ - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id, - VERSION01,deployment1Id); - DeploymentFlavor deploymentFlavorData = new DeploymentFlavor(); - deploymentFlavorData.setModel("TestDeploymentcreatewithInvalidComputFlavorId"); - deploymentFlavorData.setDescription("updating a deployment flavor with wrong compute flavor id in" + - " assocation"); - List componentComputeAssociationList = new ArrayList<>(); - ComponentComputeAssociation componentComputeAssociation = new ComponentComputeAssociation(); - componentComputeAssociation.setComponentId(component21Id); - componentComputeAssociation.setComputeFlavorId("123123"); - componentComputeAssociationList.add(componentComputeAssociation); - deploymentFlavorData.setComponentComputeAssociations(componentComputeAssociationList); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavorData); - - testUpdateNegative(deploymentFlavorEntity, USER1, INVALID_COMPUTE_FLAVOR_ID); - } - - @Test - public void testUpdate(){ - //Creating a separate deployment flavor for testing deletion - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp1Id, VERSION01, deployment2Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentCreateforUpdate"); - deploymentFlavor.setDescription("creating a deployment flavor for updation"); - deploymentFlavor.setFeatureGroupId("fg01"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - deployment2Id = createdDeployment.getId(); - - final DeploymentFlavor deploymentFlavorCompositionData = createdDeployment.getDeploymentFlavorCompositionData(); - deploymentFlavorCompositionData.setModel("TestDeploymentCreateforUpdate"); //no change - deploymentFlavorCompositionData.setDescription("updating deployment flavor"); //allow change - deploymentFlavorCompositionData.setFeatureGroupId("fg01"); //no change - createdDeployment.setDeploymentFlavorCompositionData(deploymentFlavorCompositionData); - - vendorSoftwareProductManager.updateDeploymentFlavor(createdDeployment, USER1); - CompositionEntityResponse deploymentFlavorCompositionEntityResponse = vendorSoftwareProductManager - .getDeploymentFlavor(vsp1Id, VERSION01, deployment2Id, USER1); - final DeploymentFlavor data = deploymentFlavorCompositionEntityResponse.getData(); - - Assert.assertEquals( - data.getDescription(),createdDeployment.getDeploymentFlavorCompositionData().getDescription()); - } - - @Test - public void testUpdateVspWithNoFeatureGroup(){ - //Creating a separate deployment flavor for testing deletion - DeploymentFlavorEntity deploymentFlavorEntity = new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment1Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentCreateforUpdate"); - deploymentFlavor.setDescription("creating a deployment flavor for updation"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - DeploymentFlavorEntity createdDeployment = vendorSoftwareProductManager - .createDeploymentFlavor(deploymentFlavorEntity, USER1); - deployment1Id = createdDeployment.getId(); - - final DeploymentFlavor deploymentFlavorCompositionData = createdDeployment.getDeploymentFlavorCompositionData(); - deploymentFlavorCompositionData.setModel("TestDeploymentCreateforUpdate"); //no change - deploymentFlavorCompositionData.setDescription("updating deployment flavor"); //allow change - createdDeployment.setDeploymentFlavorCompositionData(deploymentFlavorCompositionData); - - vendorSoftwareProductManager.updateDeploymentFlavor(createdDeployment, USER1); - CompositionEntityResponse deploymentFlavorCompositionEntityResponse = - vendorSoftwareProductManager.getDeploymentFlavor(vsp2Id, VERSION01, deployment1Id, USER1); - final DeploymentFlavor data = deploymentFlavorCompositionEntityResponse.getData(); - - Assert.assertEquals(data.getDescription(),createdDeployment.getDeploymentFlavorCompositionData() - .getDescription()); - } - - private void testUpdateNegative(DeploymentFlavorEntity deploymentFlavorEntity, String user, - String expectedErrorCode) { - try { - vendorSoftwareProductManager - .updateDeploymentFlavor(deploymentFlavorEntity, user); - System.out.print("updated"); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - } - - @Test - public void testDelete(){ - //Creating a separate deployment flavor for testing deletion - DeploymentFlavorEntity deploymentFlavorEntity = - new DeploymentFlavorEntity(vsp2Id, VERSION01, deployment2Id); - DeploymentFlavor deploymentFlavor = new DeploymentFlavor(); - deploymentFlavor.setModel("TestDeploymentcreateWithoutFG"); - deploymentFlavor.setDescription("creating a deployment flavor without any FG and any " + - "association"); - deploymentFlavorEntity.setDeploymentFlavorCompositionData(deploymentFlavor); - DeploymentFlavorEntity createddeployment = vendorSoftwareProductManager.createDeploymentFlavor - (deploymentFlavorEntity, USER1); - deployment2Id = createddeployment.getId(); - vendorSoftwareProductManager.deleteDeploymentFlavor(vsp2Id, deployment2Id, USER1); - testDeleteNegative(vsp2Id, deployment2Id, USER1, - VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - @Test - public void testDeleteNegative_InvalidVspId(){ - testDeleteNegative("InvalidVspId", deployment2Id, USER1, - VERSIONABLE_ENTITY_NOT_EXIST); - } - - @Test - public void testDeleteNegative_NonExistingDeploymentFlavorId(){ - testDeleteNegative(vsp2Id, "NonExistingDeploymentFlavorId", USER1, - VERSIONABLE_SUB_ENTITY_NOT_FOUND); - } - - private void testDeleteNegative(String vspId, String deploymentId, String user, - String expectedErrorCode) { - try { - vendorSoftwareProductManager - .deleteDeploymentFlavor(vspId, deploymentId, user); - Assert.fail(); - } catch (CoreException exception) { - Assert.assertEquals(exception.code().id(), expectedErrorCode); - } - }*/ -} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VspHealTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VspHealTest.java deleted file mode 100644 index c091dcadac..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/VspHealTest.java +++ /dev/null @@ -1,217 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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; - -public class VspHealTest {/* - private static VendorSoftwareProductManager vendorSoftwareProductManager = null; - //new VendorSoftwareProductManagerImpl(); - private VendorSoftwareProductManagerImplTest vendorSoftwareProductManagerTest = - new VendorSoftwareProductManagerImplTest(); - private static OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao = - OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface(); - private static VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface(); - private static ComponentDao componentDao = - ComponentDaoFactory.getInstance().createInterface(); - private static CompositionDataExtractor compositionDataExtractor = - CompositionDataExtractorFactory.getInstance().createInterface(); - private static NetworkDao networkDao = NetworkDaoFactory.getInstance().createInterface(); - private static NicDao nicDao = NicDaoFactory.getInstance().createInterface(); - private static VspDetails vspDetails; - private static final String USER = "vspTestUser1"; - public static final Version VERSION01 = new Version(0, 1); - private static String vspId; - private OrchestrationTemplateCandidateManager candidateManager; - - @BeforeTest - private void init() { - try { - vspDetails = new VspDetails(); - vspDetails.setName("vspName_" + CommonMethods.nextUuId()); - vspDetails.setVendorName("vendor"); - vspId = vendorSoftwareProductManager.createVsp(vspDetails, USER).getId(); - - } catch (Exception ignored) { - System.out.println(ignored.getMessage()); - } - } - - @Test - public void shouldReturnEmptyFileDataStructureBeforeZipUpload() { - Optional candidateFilesDataStructure = candidateManager - .getFilesDataStructure(vspId, VERSION01, USER); - Assert.assertNotNull(candidateFilesDataStructure); - Assert.assertTrue(candidateFilesDataStructure.isPresent()); - - checkFileDataStructureListsAreEmpty(candidateFilesDataStructure.get()); - } - - @Test(dependsOnMethods = "shouldReturnEmptyFileDataStructureBeforeZipUpload") - public void shouldReturnFileDataStructureOnEmptyFileDataStructureInDB() { - uploadAndProcessOrchestrationTemplate(vspId, USER, "/vspmanager/zips/emptyComposition.zip"); - - orchestrationTemplateCandidateDataDao - .deleteOrchestrationTemplateCandidateFileDataStructure(vspId, VERSION01); - Assert.assertEquals(Optional.empty(), orchestrationTemplateCandidateDataDao - .getOrchestrationTemplateCandidateFileDataStructure(vspId, VERSION01)); - - Optional candidateFilesDataStructure = candidateManager - .getFilesDataStructure(vspId, VERSION01, USER); - Assert.assertNotNull(candidateFilesDataStructure); - Assert.assertTrue(candidateFilesDataStructure.isPresent()); - } - - @Test(dependsOnMethods = "shouldReturnEmptyFileDataStructureBeforeZipUpload") - public void shouldReturnEmptyFileDataStructureOnEmptyUpload() { - try { - uploadAndProcessOrchestrationTemplate(vspId, USER, "/vspmanager/zips/zipFileWithFolder.zip"); - } catch (Exception e) { - Assert.assertEquals(e.getMessage(), - "Failed to get orchestration template for VSP with id " + vspId); - } - } - - @Test(dependsOnMethods = {"shouldReturnEmptyFileDataStructureOnEmptyUpload"}) - public void shouldHealVspOnIsOldTrue() { - vspDetails.setOldVersion(VersionHealingValues.True); - vendorSoftwareProductDao.updateQuestionnaire(vspId, VERSION01, null); - - vendorSoftwareProductManager.heal(vspId, VERSION01, USER); - - VspQuestionnaireEntity questionnaire = - vendorSoftwareProductDao.getQuestionnaire(vspId, VERSION01); - - Assert.assertNotNull(questionnaire.getQuestionnaireData()); - } - - @Test(dependsOnMethods = {"shouldHealVspOnIsOldTrue"}) - public void shouldHealNullQuestionnaire() { - vendorSoftwareProductDao.updateQuestionnaire(vspId, VERSION01, null); - vendorSoftwareProductManager.heal(vspId, VERSION01, USER); - QuestionnaireResponse vspQuestionnaire = - vendorSoftwareProductManager.getVspQuestionnaire(vspId, VERSION01, USER); - - Assert.assertNotNull(vspQuestionnaire.getData()); - } - - @Test(dependsOnMethods = {"shouldHealNullQuestionnaire"}) - public void shouldHealNullCompositionData() { - uploadAndProcessOrchestrationTemplate(vspId, USER, "/vspmanager/zips/fullComposition.zip"); - - Collection componentEntitiesBeforeHeal = - vendorSoftwareProductDao.listComponents(vspId, VERSION01); - Collection networkEntitiesBeforeHeal = - vendorSoftwareProductDao.listNetworks(vspId, VERSION01); - - deleteCompositionData(vspId, VERSION01); - - vendorSoftwareProductManager.heal(vspId, VERSION01, USER); - - Collection componentEntitiesAfterHeal = - vendorSoftwareProductDao.listComponents(vspId, VERSION01); - Collection networkEntitiesAfterHeal = - vendorSoftwareProductDao.listNetworks(vspId, VERSION01); - - checkCompositionDataIsHealed(componentEntitiesBeforeHeal, networkEntitiesBeforeHeal, - componentEntitiesAfterHeal, networkEntitiesAfterHeal); - } - - @Test(dependsOnMethods = {"shouldHealNullCompositionData"}) - public void shouldChangeComponentDisplayName() { - uploadAndProcessOrchestrationTemplate(vspId, USER, "/vspmanager/zips/vCDN.zip"); - - List componentEntitiesBeforeHeal = - (List) vendorSoftwareProductDao.listComponents(vspId, VERSION01); - Collection componentsToHeal = new ArrayList<>(); - - for (ComponentEntity component : componentEntitiesBeforeHeal) { - changeComponentDisplayNameToOldVersion(component); - } - - vendorSoftwareProductManager.heal(vspId, VERSION01, USER); - - List componentEntitiesAfterHeal = - (List) vendorSoftwareProductDao.listComponents(vspId, VERSION01); - - assertComponentdisplayNameAsExpected(componentEntitiesBeforeHeal, componentEntitiesAfterHeal); - } - - private void assertComponentdisplayNameAsExpected( - List componentEntitiesBeforeHeal, - List componentEntitiesAfterHeal) { - ComponentEntity componentBefore = componentEntitiesBeforeHeal.get(0); - ComponentEntity componentAfter = componentEntitiesAfterHeal.get(0); - Assert.assertNotEquals(componentBefore, componentAfter); - - ComponentData componsitionDataBefore = componentBefore.getComponentCompositionData(); - ComponentData compositionDataAfter = componentAfter.getComponentCompositionData(); - Assert.assertTrue( - componsitionDataBefore.getDisplayName().contains(compositionDataAfter.getDisplayName())); - Assert.assertEquals( - compositionDataExtractor.getComponentDisplayName(componsitionDataBefore.getName()), - compositionDataAfter.getDisplayName()); - } - - private void changeComponentDisplayNameToOldVersion(ComponentEntity component) { - ComponentData componentData = component.getComponentCompositionData(); - componentData.setDisplayName(componentData.getName()); - componentData.setVfcCode(componentData.getDisplayName()); - component.setComponentCompositionData(componentData); - vendorSoftwareProductDao.updateComponent(component); - } - - - private void uploadAndProcessOrchestrationTemplate(String vspId, String user, - String filePath) { - - candidateManager.upload(vspId, VERSION01, - vendorSoftwareProductManagerTest - .getFileInputStream(filePath), user); - candidateManager.process(vspId, VERSION01, user); - } - - private void deleteCompositionData(String vspId, Version version) { - componentDao.deleteAll(vspId, version); - networkDao.deleteAll(vspId, version); - nicDao.deleteByVspId(vspId, version); - } - - private void checkCompositionDataIsHealed(Collection componentEntitiesBeforeHeal, - Collection networkEntitiesBeforeHeal, - Collection componentEntitiesAfterHeal, - Collection networkEntitiesAfterHeal) { - Assert.assertNotNull(componentEntitiesAfterHeal); - Assert.assertNotNull(networkEntitiesAfterHeal); - - Assert.assertEquals(componentEntitiesBeforeHeal.size(), componentEntitiesAfterHeal.size()); - Assert.assertEquals(networkEntitiesBeforeHeal.size(), networkEntitiesAfterHeal.size()); - } - - - private void checkFileDataStructureListsAreEmpty(FilesDataStructure filesDataStructure) { - Assert.assertEquals(filesDataStructure.getArtifacts().size(), 0); - Assert.assertEquals(filesDataStructure.getModules().size(), 0); - Assert.assertEquals(filesDataStructure.getNested().size(), 0); - Assert.assertEquals(filesDataStructure.getUnassigned().size(), 0); - } - -*/ -} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java deleted file mode 100644 index fbd8371d7b..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/QuestionnaireValidatorTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.services; - -public class QuestionnaireValidatorTest { -/* - public static QuestionnaireValidator validator = new QuestionnaireValidator(); - - @Test(expectedExceptions = CoreException.class) - public void testAddSubEntityBeforeRoot_negative() { - validator.addSubEntity(createComponent("componentId2"), CompositionEntityType.vsp); - } - - @Test(dependsOnMethods = "testAddSubEntityBeforeRoot_negative") - public void testAddRootEntity() { - validator.addRootEntity(createVspQuestionnaireEntity()); - } - - @Test(dependsOnMethods = "testAddRootEntity", expectedExceptions = CoreException.class) - public void testAddRootEntityWhenAlreadyExist_negative() { - validator.addRootEntity(createVspQuestionnaireEntity()); - } - - @Test(dependsOnMethods = "testAddRootEntity") - public void testAddSubEntity() { - validator.addSubEntity(createComponent("componentId1"), CompositionEntityType.vsp); - } - - @Test(dependsOnMethods = "testAddRootEntity", expectedExceptions = CoreException.class) - public void testAddSubEntityWithNonExistingParentType() { - validator.addSubEntity(new ComponentEntity("vspId1", new Version(0, 1), "componentId2"), CompositionEntityType.nic); - } - - @Test(dependsOnMethods = "testAddSubEntity") - public void testAddSubEntities() throws Exception { - Collection nics = new ArrayList<>(); - nics.add(createNic("nicId1", "componentId1")); - nics.add(createNic("nicId2", "componentId1")); - nics.add(createNic("nicId3", "componentId1")); - - validator.addSubEntities(nics, CompositionEntityType.component); - } - - - @Test(dependsOnMethods = "testAddSubEntities") - public void testValidate() throws Exception { - QuestionnaireValidationResult validationResult = validator.validate(); - Assert.assertTrue(validationResult.isValid()); - } - - private static VspQuestionnaireEntity createVspQuestionnaireEntity() { - VspQuestionnaireEntity vspQuestionnaireEntity = new VspQuestionnaireEntity(); - vspQuestionnaireEntity.setId("vspId1"); - vspQuestionnaireEntity.setVersion(new Version(0, 1)); - vspQuestionnaireEntity.setQuestionnaireData("{\n" + - " \"name\": \"bla bla\"\n" + - "}"); - return vspQuestionnaireEntity; - } - - private static ComponentEntity createComponent(String componentId) { - ComponentEntity component = new ComponentEntity("vspId1", new Version(0, 1), componentId); - component.setQuestionnaireData("{\n" + - " \"name\": \"bla bla\"\n" + - "}"); - return component; - } - - private static UnifiedCompositionEntity createNic(String nicId, String componentId) { - NicEntity nic = new NicEntity("vspId1", new Version(0, 1), componentId, nicId); - nic.setQuestionnaireData("{\n" + - " \"name\": \"bla bla\"\n" + - "}"); - return nic; - }*/ -} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java index 5c4557360e..ea2d068bfd 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/CandidateServiceImplTest.java @@ -20,6 +20,14 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl; +import static org.mockito.Mockito.doReturn; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import org.apache.commons.collections4.CollectionUtils; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -40,15 +48,6 @@ import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -import static org.mockito.Mockito.doReturn; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - /** * @author Avrahamg * @since November 09, 2016 diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java index dc5b126482..9aabef6234 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImplTest.java @@ -16,6 +16,15 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.composition; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.NotDirectoryException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.mockito.InjectMocks; import org.mockito.MockitoAnnotations; @@ -31,16 +40,6 @@ import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.nio.file.NotDirectoryException; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - /** * @author shiria * @since July 17, 2016. diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java deleted file mode 100644 index 237e9cce8f..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/schemagenerator/SchemaGeneratorTest.java +++ /dev/null @@ -1,250 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.services.schemagenerator; - -public class SchemaGeneratorTest { - /* - - private static int getMinOfVmMax(JSONObject schemaJson) { - return schemaJson.getJSONObject("properties").getJSONObject("compute") - .getJSONObject("properties").getJSONObject("numOfVMs").getJSONObject("properties") - .getJSONObject("maximum").getInt("minimum"); - } - - private static JSONObject validateSchema(String schema) { - System.out.println(schema); - Assert.assertNotNull(schema); - Assert.assertTrue(JsonUtil.isValidJson(schema)); - JSONObject schemaJson = new JSONObject(schema); - Assert.assertFalse(SchemaLoader.load(schemaJson) instanceof EmptySchema); - return schemaJson; - } - - // TODO: 3/15/2017 fix and enable //@Test - public void testGenerateVspQuestionnaire() { - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.vsp, null); - validateSchema(schema); - } - - @Test - public void testGenerateNetworkCompositionUpload() { - Network network = new Network(); - network.setName("upload network1 name"); - network.setDhcp(true); - - NetworkCompositionSchemaInput input = new NetworkCompositionSchemaInput(); - input.setManual(false); - input.setNetwork(network); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.network, input); - validateSchema(schema); - } - - @Test - public void testGenerateNetworkCompositionManual() { - NetworkCompositionSchemaInput input = new NetworkCompositionSchemaInput(); - input.setManual(true); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.network, input); - - validateSchema(schema); - } - - @Test - public void testGenerateComponentQuestionnaireWithoutInput() { - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, null); - validateSchema(schema); - } - - @Test - public void testGenerateComponentQuestionnaireWithMissingInput() { - ComponentQuestionnaireSchemaInput - input = new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), - JsonUtil.json2Object("{\n" + - " \"compute\": {\n" + - " \"numOfVMs\": {\n" + - " \"blabla\": 70\n" + // no minimum - " }\n" + - " }\n" + - "}", Map.class)); - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); - JSONObject schemaJson = validateSchema(schema); - //Assert.assertEquals(getMinOfVmMax(schemaJson), 0); - } - - @Test - public void testGenerateComponentQuestionnaireWithInvalidTypeInput() { - ComponentQuestionnaireSchemaInput input = - new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), - JsonUtil.json2Object("{\n" + - " \"compute\": {\n" + - " \"numOfVMs\": {\n" + - " \"minimum\": \"some string instead of integer\"\n" + - // invalid minimum - string - " }\n" + - " }\n" + - "}", Map.class)); - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); - JSONObject schemaJson = validateSchema(schema); - Assert.assertEquals(getMinOfVmMax(schemaJson), 0); - } - - @Test - public void testGenerateComponentQuestionnaireWithInvalidRangeInput() { - ComponentQuestionnaireSchemaInput input = - new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), - JsonUtil.json2Object("{\n" + - " \"compute\": {\n" + - " \"numOfVMs\": {\n" + - " \"minimum\": 150\n" + // invalid minimum - integer out of range (0-100) - " }\n" + - " }\n" + - "}", Map.class)); - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); - JSONObject schemaJson = validateSchema(schema); - Assert.assertEquals(getMinOfVmMax(schemaJson), 0); - } - - @Test - public void testGenerateComponentQuestionnaireWithValidInput() { - ComponentQuestionnaireSchemaInput input = - new ComponentQuestionnaireSchemaInput(Arrays.asList("nic1", "nic2"), - JsonUtil.json2Object("{\n" + - " \"compute\": {\n" + - " \"numOfVMs\": {\n" + - " \"minimum\": 30\n" + // valid minimum - integer at the correct range (0-100) - " }\n" + - " }\n" + - "}", Map.class)); - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.component, input); - JSONObject schemaJson = validateSchema(schema); - Assert.assertEquals(getMinOfVmMax(schemaJson), 30); - } - - @Test - public void testGenerateNicQuestionnaire() { - String schema = SchemaGenerator - .generate(SchemaTemplateContext.questionnaire, CompositionEntityType.nic, null); - validateSchema(schema); - } - - @Test - public void testGenerateComponentCompositionUpload() { - ComponentData component = new ComponentData(); - component.setName("upload comp1 name"); - component.setDescription("upload comp1 desc"); - - ComponentCompositionSchemaInput input = new ComponentCompositionSchemaInput(); - input.setManual(false); - input.setComponent(component); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.component, input); - validateSchema(schema); - } - - @Test - public void testGenerateComponentCompositionManual() { - ComponentCompositionSchemaInput input = new ComponentCompositionSchemaInput(); - input.setManual(true); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.component, input); - validateSchema(schema); - } - - @Test - public void testGenerateNicCompositionUpload() { - Nic nic = new Nic(); - nic.setName("upload nic1 name"); - nic.setDescription("upload nic1 desc"); - nic.setNetworkId("upload nic1 networkId"); - //nic.setNetworkName("upload nic1 networkName"); - nic.setNetworkType(NetworkType.External); - - NicCompositionSchemaInput input = new NicCompositionSchemaInput(); - input.setManual(false); - input.setNic(nic); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); - validateSchema(schema); - } - - -// @Test -// public void testGenerateNicCompositionManualWithoutNetworkId() { -// Nic nic = new Nic(); -// nic.setName("upload nic1 name"); -// nic.setDescription("upload nic1 desc"); -// //nic.setNetworkName("upload nic1 networkName"); -// nic.setNetworkType(NetworkType.External); -// -// NicCompositionSchemaInput input = new NicCompositionSchemaInput(); -// input.setManual(true); -// input.setNic(nic); -// -// String schema = SchemaGenerator.generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); -// validateSchema(schema); -// } - - @Test - public void testGenerateNicCompositionUploadWithoutNetworkId() { - Nic nic = new Nic(); - nic.setName("upload nic1 name"); - nic.setDescription("upload nic1 desc"); - //nic.setNetworkName("upload nic1 networkName"); - nic.setNetworkType(NetworkType.External); - - NicCompositionSchemaInput input = new NicCompositionSchemaInput(); - input.setManual(false); - input.setNic(nic); - - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); - validateSchema(schema); - } - - @Test - public void testGenerateNicCompositionManual() {Nic nic = new Nic(); - nic.setName("upload nic1 name"); - nic.setDescription("upload nic1 desc"); - nic.setNetworkType(NetworkType.Internal); - NicCompositionSchemaInput input = new NicCompositionSchemaInput(); - - input.setManual(true); - input.setNetworkIds( - Arrays.asList("manual networkId1", "manual networkId2", "manual networkId3")); - input.setNic(nic); - String schema = SchemaGenerator - .generate(SchemaTemplateContext.composition, CompositionEntityType.nic, input); - validateSchema(schema); - } - */ -} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java index 6f2bfd8a06..61c8f0515f 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/HeatTreeManagerTest.java @@ -20,12 +20,12 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; import org.openecomp.sdc.heat.services.tree.HeatTreeManager; -import org.testng.Assert; -import org.testng.annotations.Test; import java.io.IOException; import java.net.URISyntaxException; import java.util.*; +import org.testng.Assert; +import org.testng.annotations.Test; public class HeatTreeManagerTest extends TreeBaseTest { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java index 2e0cbbbf05..10f09260ef 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java @@ -21,6 +21,17 @@ package org.openecomp.sdc.vendorsoftwareproduct.tree; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.testng.Assert.assertEquals; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.zip.ZipOutputStream; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -44,14 +55,6 @@ import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.*; -import java.net.URL; -import java.util.zip.ZipOutputStream; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.testng.Assert.assertEquals; - public class UploadFileTest { private static final String USER1 = "vspTestUser1"; diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java deleted file mode 100644 index 13f3859c0c..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/HeatCleanup/HeatCleanupOnNewUploadTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.upload.HeatCleanup; - -public class HeatCleanupOnNewUploadTest {/* - private static final String USER1 = "vspTestUser1"; - - private static final VendorSoftwareProductManager - vendorSoftwareProductManager = new VendorSoftwareProductManagerImpl(); - private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory - .getInstance().createInterface(); - private static final ServiceModelDao serviceModelDao = - ServiceModelDaoFactory.getInstance().createInterface(); - - private static String vspId = null; - private static Version vspActiveVersion = null; - - private static void validateUploadContentExistence(boolean exist) { - UploadDataEntity uploadDataEntity = - vendorSoftwareProductDao.getUploadData(new UploadDataEntity(vspId, vspActiveVersion)); - Assert.assertTrue((uploadDataEntity.getContentData() != null) == exist); - Assert.assertTrue((uploadDataEntity.getInfo() != null) == exist); - Assert.assertTrue((uploadDataEntity.getPackageName() != null) == exist); - Assert.assertTrue((uploadDataEntity.getPackageVersion() != null) == exist); - //TODO: talio - delete enrich data on new upload - //Assert.assertTrue((serviceModelDao.getServiceModel(vspId, vspActiveVersion) != null) == ex - } - - private static void validateCompositionDataExistence(boolean exist) { - Assert.assertTrue(CollectionUtils - .isNotEmpty(vendorSoftwareProductDao.listNetworks(vspId, vspActiveVersion)) == exist); - Assert.assertTrue(CollectionUtils - .isNotEmpty(vendorSoftwareProductDao.listComponents(vspId, vspActiveVersion)) == exist); - Assert.assertTrue(CollectionUtils - .isNotEmpty(vendorSoftwareProductDao.listNicsByVsp(vspId, vspActiveVersion)) == exist); - } - - private static InputStream getFileInputStream(String fileName) { - URL url = HeatCleanupOnNewUploadTest.class.getResource(fileName); - try { - return url.openStream(); - } catch (IOException exception) { - exception.printStackTrace(); - return null; - } - } - - @BeforeClass - private void init() { - UniqueValueUtil - .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, - "VSPTestEmpty"); - - VspDetails vspDetails = vendorSoftwareProductManager.createVsp(VSPCommon - .createVspDetails(null, null, "VSPTestEmpty", "Test-vsp-empty", "vendorName", "vlm1Id", - "icon", "category", "subCategory", "123", null, VSPCommon.OnboardingMethod.HEAT.name()), - USER1); - vspId = vspDetails.getId(); - vspActiveVersion = vspDetails.getVersion(); - } - - @Test - public void testUploadWithComposition() { - InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip"); - - vendorSoftwareProductManager.upload(vspId, zis, USER1); - OrchestrationTemplateActionResponse orchestrationTemplateActionResponse = - vendorSoftwareProductManager.process(vspId, USER1); - - Assert.assertEquals(orchestrationTemplateActionResponse.getStatus(), UploadFileStatus.Success); - Assert.assertTrue(MapUtils.isEmpty(MessageContainerUtil - .getMessageByLevel(ErrorLevel.ERROR, orchestrationTemplateActionResponse.getErrors()))); - - validateUploadContentExistence(true); - validateCompositionDataExistence(true); - } - - @Test(dependsOnMethods = {"testUploadWithComposition"}) - public void testProccesesMIBsDeletionAfterNewUpload() { - InputStream zis1 = getFileInputStream("/vspmanager/zips/fullComposition.zip"); - InputStream zis2 = getFileInputStream("/vspmanager/zips/fullComposition.zip"); - InputStream mib = getFileInputStream("/vspmanager/zips/vDNS.zip"); - - vendorSoftwareProductManager.upload(vspId, zis1, USER1); - vendorSoftwareProductManager.process(vspId, USER1); - List components = - (List) vendorSoftwareProductDao.listComponents(vspId, vspActiveVersion); - String componentId = components.get(0).getId(); - - vendorSoftwareProductManager - .upload(mib, "vDNS.zip", vspId, componentId, MonitoringUploadType.SNMP_TRAP, USER1); - vendorSoftwareProductManager - .createProcess(new ProcessEntity(vspId, vspActiveVersion, componentId, null), USER1); - - vendorSoftwareProductManager.upload(vspId, zis2, USER1); - vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertTrue( - vendorSoftwareProductManager.listFilenames(vspId, componentId, USER1).getSnmpTrap() == - null); - Assert.assertTrue(CollectionUtils - .isEmpty(vendorSoftwareProductDao.listProcesses(vspId, vspActiveVersion, componentId))); - } - - @Test(dependsOnMethods = {"testProccesesMIBsDeletionAfterNewUpload"}) - public void testInvalidUploadAfterFullComposition() { - InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip"); - - vendorSoftwareProductManager.upload(vspId, zis, USER1); - OrchestrationTemplateActionResponse uploadFileResponse = - vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Failure); - Assert.assertTrue(MapUtils.isNotEmpty( - MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); - - validateUploadContentExistence(true); - //TODO: talio - check upload cleanup -// validateCompositionDataExistence(false); - } - - @Test(dependsOnMethods = {"testInvalidUploadAfterFullComposition"}) - public void testEmptyCompositionUploadAfterFullComposition() throws IOException { - testUploadWithComposition(); - - InputStream zis = getFileInputStream("/vspmanager/zips/emptyComposition.zip"); - vendorSoftwareProductManager.upload(vspId, zis, USER1); - OrchestrationTemplateActionResponse uploadFileResponse = - vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertEquals(uploadFileResponse.getStatus(), UploadFileStatus.Success); - Assert.assertTrue(MapUtils.isEmpty( - MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, uploadFileResponse.getErrors()))); - - validateUploadContentExistence(true); - validateCompositionDataExistence(false); - } -*/} diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java index f0b37f5ffe..687ddc18c4 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java @@ -1,13 +1,32 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.vendorsoftwareproduct.upload.csar; -import org.junit.Test; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest; import java.io.IOException; import java.io.InputStream; +import org.testng.annotations.Test; -import static org.junit.Assert.*; public class ManifestParsingTest { diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java index 5d56ffa061..42b7dc37d4 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java @@ -17,6 +17,17 @@ package org.openecomp.sdc.vendorsoftwareproduct.upload.csar; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.function.Predicate; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -34,18 +45,6 @@ import org.openecomp.sdc.versioning.dao.types.Version; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.function.Predicate; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; - public class UploadCSARFileTest { public static final Version VERSION01 = new Version("0.1"); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java deleted file mode 100644 index 0aa3e4037d..0000000000 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/validation/UploadFileValidationTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.upload.validation; - -public class UploadFileValidationTest { -/* - - private static final String USER1 = "UploadFileValidationTest"; - private static final String EMPTY_ZIP_FILE = "/validation/zips/emptyZip.zip"; - private static final String MISSING_MANIFEST_IN_ZIP_FILE = - "/validation/zips/missingManifestInZip.zip"; - private static final String ZIP_FILE_WITH_FOLDER = "/validation/zips/zipFileWithFolder.zip"; - private static VendorSoftwareProductManager vendorSoftwareProductManager = - new VendorSoftwareProductManagerImpl(); - private static String vspId; - - public static VendorLicenseModelEntity createVendorLicenseModel(String name, String desc, - String icon) { - VendorLicenseModelEntity vendorLicenseModel = new VendorLicenseModelEntity(); - vendorLicenseModel.setVendorName(name); - vendorLicenseModel.setDescription(desc); - vendorLicenseModel.setIconRef(icon); - return vendorLicenseModel; - } - - @BeforeTest - private void init() { - VspDetails vspDetails = new VspDetails(); - vspDetails.setVendorName("vspName_" + CommonMethods.nextUuId()); - vspId = vendorSoftwareProductManager.createVsp(vspDetails, USER1).getId(); - - UniqueValueUtil - .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, - "VSP_syb_upload_various"); - UniqueValueUtil - .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, - "vsp_syb_upload_no_error"); - UniqueValueUtil - .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME, - "vsp_syb"); - } - - @Test - public void testUploadZipNull() { - try { - vendorSoftwareProductManager.upload(vspId, null, USER1); - OrchestrationTemplateActionResponse response = - vendorSoftwareProductManager.process(vspId, USER1); - } catch (Exception exception) { - Assert.assertEquals(exception.getMessage(), - "Failed to get orchestration template for VSP with id " + vspId); - } - } - - @Test(dependsOnMethods = "testUploadZipNull") - public void testUploadEmptyFile() { - UploadFileResponse uploadFileResponse = vendorSoftwareProductManager - .upload(vspId, new ByteArrayInputStream("".getBytes()), - USER1); - Assert.assertEquals(uploadFileResponse.getErrors().get(SdcCommon.UPLOAD_FILE).get(0) - .getMessage(), - Messages.NO_FILE_WAS_UPLOADED_OR_FILE_NOT_EXIST.getErrorMessage()); - } - - @Test(dependsOnMethods = "testUploadEmptyFile") - public void testUploadEmptyZip() { - UploadFileResponse uploadFileResponse = vendorSoftwareProductManager - .upload(vspId, getFileInputStream(EMPTY_ZIP_FILE), USER1); - Assert.assertEquals(uploadFileResponse.getErrors().get(SdcCommon.UPLOAD_FILE).get(0) - .getMessage(), - Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage()); - */ -/*Assert.assertEquals(exception.getMessage(), - Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());*//* - - } - - @Test(dependsOnMethods = "testUploadEmptyZip") - public void testUploadMissingManifestInZip() { - vendorSoftwareProductManager.upload(vspId, - getFileInputStream(MISSING_MANIFEST_IN_ZIP_FILE), USER1); - OrchestrationTemplateActionResponse response = - vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertEquals(response.getErrors().size(), 2); - } - - @Test(dependsOnMethods = "testUploadMissingManifestInZip") - public void testUploadZipWithFolder() { - vendorSoftwareProductManager - .upload(vspId, getFileInputStream(ZIP_FILE_WITH_FOLDER), - USER1); - OrchestrationTemplateActionResponse response = - vendorSoftwareProductManager.process(vspId, USER1); - Assert.assertEquals(response.getErrors().size(), 2); - } - - @Test(dependsOnMethods = "testUploadZipWithFolder") - public void testUploadVariousZips() { - - File[] files = getFileList("/validation/zips/various"); - InputStream is; - for (File file : files) { - if (file.isFile()) { - OrchestrationTemplateActionResponse response; - try { - - is = new FileInputStream(file); - vendorSoftwareProductManager.upload(vspId, is, USER1); - response = - vendorSoftwareProductManager.process(vspId, USER1); - - } catch (FileNotFoundException exception) { - throw new RuntimeException(exception); - } catch (RuntimeException re) { - - throw new RuntimeException("failed upload:" + file.getName(), re); - } - System.out.println("zip:" + file.getName() + " Errors:" + calculateNumberOfMessages( - MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors())) + - " Warnings:" + calculateNumberOfMessages( - MessageContainerUtil.getMessageByLevel(ErrorLevel.WARNING, response.getErrors()))); - } - } - } - - @Test(dependsOnMethods = "testUploadVariousZips") - public void testUploadNoErrorVariousZips() { - - - File[] files = getFileList("/validation/zips/various/noError"); - InputStream is; - for (File file : files) { - if (file.isFile()) { - try { - is = new FileInputStream(file); - vendorSoftwareProductManager.upload(vspId, is, USER1); - OrchestrationTemplateActionResponse response = - vendorSoftwareProductManager.process(vspId, USER1); - Map> errors = response.getErrors(); - Assert.assertTrue( - MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, errors))); - - - } catch (FileNotFoundException exception) { - throw new RuntimeException(exception); - } catch (RuntimeException re) { - Assert.fail("failed upload:" + file.getName() + " exception:" + re.getMessage()); - } - } - } - } - - private InputStream getFileInputStream(String fileName) { - URL url = this.getClass().getResource(fileName); - try { - return url.openStream(); - } catch (IOException exception) { - exception.printStackTrace(); - return null; - } - } - - private File[] getFileList(String dir) { - URL url = UploadFileValidationTest.class.getResource(dir); - - String path = url.getPath(); - File pathFile = new File(path); - return pathFile.listFiles(); - - - } - - private int calculateNumberOfMessages(Map> messages) { - int sum = 0; - for (List errors : messages.values()) { - sum += errors.size(); - } - return sum; - } - -*/ - -} diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml index e2fa2f09d9..5a7d0588ea 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml @@ -1,4 +1,20 @@ + + @@ -22,7 +38,6 @@ org.testng testng - ${testng.version} test diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml index 423c4aa8e1..1eb46dff3a 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -48,13 +64,12 @@ org.testng testng - ${testng.version} test org.projectlombok lombok - compile + provided org.mockito diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml index 9ff599f0d5..3f1b7700cf 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -28,27 +44,13 @@ org.mockito - mockito-all - test - ${mockito.all.version} - - - org.testng - testng + mockito-core test - ${testng.version} - - - snakeyaml - org.yaml - - junit junit test - ${junit.version} org.openecomp.sdc.core diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java deleted file mode 100644 index 2bab7e0d67..0000000000 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/NoSqlDbTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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.core.nosqldb; - -import org.openecomp.core.nosqldb.api.NoSqlDb; - - -public class NoSqlDbTest { - - private NoSqlDb noSqlDb; -/* - - @Test - public void testNoSqlDbFactoryFactoryInit() { - this.noSqlDb = NoSqlDbFactory.getInstance().createInterface(); - Assert.assertNotNull(this.noSqlDb); - Assert.assertEquals(this.noSqlDb.getClass().getName(), - "org.openecomp.core.nosqldb.impl.cassandra.CassandraNoSqlDbImpl"); - } - - @Test(dependsOnMethods = {"testNoSqlDbFactoryFactoryInit"}) - public void testCreateTable() { - this.noSqlDb.execute("test.drop", null); - this.noSqlDb.execute("test.create", null); - } - - @Test(dependsOnMethods = {"testCreateTable"}) - public void testInsertTable() { - this.noSqlDb - .insert("test", new String[]{"name", "value"}, new String[]{"TestName", "testValue"}); - this.noSqlDb.execute("test.insert", new String[]{"TestName2", "testValue2"}); - } - - @Test(dependsOnMethods = {"testInsertTable"}) - public void gettestSelectTable() { - ResultSet result = this.noSqlDb.execute("test.select.all", null); - List rows = result.all(); - Assert.assertEquals(rows.size(), 2); - for (Row row : rows) { - System.out.format("%s %s\n", row.getString("name"), row.getString("value")); - } - } - - */ -} diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/util/ConfigurationManagerTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/util/ConfigurationManagerTest.java index 7a6343d15c..86543398a8 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/util/ConfigurationManagerTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/test/java/org/openecomp/core/nosqldb/util/ConfigurationManagerTest.java @@ -1,13 +1,31 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.core.nosqldb.util; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +import static org.hamcrest.core.StringContains.containsString; +import static org.junit.Assert.assertNotNull; import java.io.Closeable; import java.io.IOException; import java.lang.reflect.Field; - -import static org.testng.Assert.assertNotNull; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; /** * @author EVITALIY @@ -15,19 +33,24 @@ import static org.testng.Assert.assertNotNull; */ public class ConfigurationManagerTest { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + private static final String NON_EXISTENT = "unexistentfile"; - @BeforeMethod + @Before public void resetInstance() throws NoSuchFieldException, IllegalAccessException { Field field = ConfigurationManager.class.getDeclaredField("instance"); field.setAccessible(true); field.set(null, null); } - @Test(expectedExceptions = IOException.class, - expectedExceptionsMessageRegExp = ".*" + NON_EXISTENT + ".*") + @Test public void testGetInstanceSystemProperty() throws Throwable { + expectedException.expect(IOException.class); + expectedException.expectMessage(containsString(NON_EXISTENT)); + try (ConfigurationSystemPropertyUpdater updater = new ConfigurationSystemPropertyUpdater(NON_EXISTENT)) { ConfigurationManager.getInstance(); } catch (RuntimeException e) { @@ -37,7 +60,7 @@ public class ConfigurationManagerTest { } @Test() - public void testGetInstanceDefault() throws Exception { + public void testGetInstanceDefault() { try (ConfigurationSystemPropertyUpdater property = new ConfigurationSystemPropertyUpdater()) { ConfigurationManager manager = ConfigurationManager.getInstance(); @@ -61,7 +84,7 @@ public class ConfigurationManagerTest { } @Override - public void close() throws IOException { + public void close() { if (oldValue == null) { System.clearProperty(ConfigurationManager.CONFIGURATION_YAML_FILE); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/pom.xml index 2d98487876..09b5efc223 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/pom.xml @@ -27,6 +27,7 @@ org.projectlombok lombok + provided org.testng diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml index 4bc6e5617a..684ee54017 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -53,7 +69,6 @@ junit junit test - ${junit.version} org.codehaus.jackson @@ -65,18 +80,6 @@ org.everit.json.schema ${org.everit.json.schema.version} - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - - org.openecomp.sdc openecomp-sdc-logging-api diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/CommonMethodsTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/CommonMethodsTest.java index c6d87def2b..5da9675536 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/CommonMethodsTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/CommonMethodsTest.java @@ -16,10 +16,10 @@ package org.openecomp.core.utilities; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.util.AbstractMap; import java.util.ArrayList; @@ -31,10 +31,8 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - import org.apache.commons.lang3.ArrayUtils; -import org.testng.Assert; -import org.testng.annotations.Test; +import org.junit.Test; public class CommonMethodsTest { @@ -71,7 +69,7 @@ public class CommonMethodsTest { assertEquals(CommonMethods.arrayToCommaSeparatedString(new String[] {"", ""}), ","); } - @Test(expectedExceptions = NullPointerException.class) + @Test(expected = NullPointerException.class) public void testArrayToCommaSeparatedStringNull() { CommonMethods.arrayToCommaSeparatedString(null); } @@ -96,7 +94,7 @@ public class CommonMethodsTest { assertEquals(CommonMethods.arrayToSeparatedString(new String[] {"", ""}, '/'), "/"); } - @Test(expectedExceptions = NullPointerException.class) + @Test(expected = NullPointerException.class) public void testArrayToSeparatedStringNull() { CommonMethods.arrayToSeparatedString(null, '/'); } @@ -121,7 +119,7 @@ public class CommonMethodsTest { assertEquals(CommonMethods.collectionToCommaSeparatedString(Collections.emptySet()), ""); } - @Test(expectedExceptions = NullPointerException.class) + @Test(expected = NullPointerException.class) public void testCollectionToCommaSeparatedStringNull() { assertNull(CommonMethods.collectionToCommaSeparatedString(null)); } @@ -138,8 +136,8 @@ public class CommonMethodsTest { String []resultArray = CommonMethods.concat(firstArray, secondArray); - Assert.assertEquals(resultArray.length, 4); - Assert.assertTrue(ArrayUtils.contains(resultArray, secondArray[0]) + assertEquals(resultArray.length, 4); + assertTrue(ArrayUtils.contains(resultArray, secondArray[0]) && ArrayUtils.contains(resultArray, firstArray[0])); } @@ -149,8 +147,8 @@ public class CommonMethodsTest { String []resultArray = CommonMethods.concat(firstArray, null); - Assert.assertEquals(resultArray.length, 2); - Assert.assertTrue(Arrays.asList(resultArray).containsAll(Arrays.asList(firstArray))); + assertEquals(resultArray.length, 2); + assertTrue(Arrays.asList(resultArray).containsAll(Arrays.asList(firstArray))); } @Test @@ -159,45 +157,45 @@ public class CommonMethodsTest { String []resultArray = CommonMethods.concat(null, secondArray); - Assert.assertEquals(resultArray.length, 2); - Assert.assertTrue(Arrays.asList(resultArray).containsAll(Arrays.asList(secondArray))); + assertEquals(resultArray.length, 2); + assertTrue(Arrays.asList(resultArray).containsAll(Arrays.asList(secondArray))); } @Test public void testConcatBothValueNull() { - Assert.assertNull(CommonMethods.concat(null, null)); + assertNull(CommonMethods.concat(null, null)); } @Test public void testNewInstance() { Object obj = CommonMethods.newInstance(JAVA_LANG_STRING); - Assert.assertNotNull(obj); - Assert.assertTrue(obj instanceof String); + assertNotNull(obj); + assertTrue(obj instanceof String); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testNewInstanceIncorrectClassProvided() { - Assert.assertNull(CommonMethods.newInstance("java.lang.Stringss")); + assertNull(CommonMethods.newInstance("java.lang.Stringss")); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testNewInstanceClassNotProvided() { - Assert.assertNull(CommonMethods.newInstance(null, Object.class)); + assertNull(CommonMethods.newInstance(null, Object.class)); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testNewInstanceObjectNotProvided() { - Assert.assertNull(CommonMethods.newInstance(JAVA_LANG_STRING, null)); + assertNull(CommonMethods.newInstance(JAVA_LANG_STRING, null)); } - @Test(expectedExceptions = ClassCastException.class) + @Test(expected = ClassCastException.class) public void testNewInstanceClassCastException() { - Assert.assertNull(CommonMethods.newInstance(JAVA_LANG_STRING, ArrayList.class)); + assertNull(CommonMethods.newInstance(JAVA_LANG_STRING, ArrayList.class)); } - @Test(expectedExceptions = RuntimeException.class) + @Test(expected = RuntimeException.class) public void testNewInstanceInvalidClassProvided() { - Assert.assertNull(CommonMethods.newInstance(List.class)); + assertNull(CommonMethods.newInstance(List.class)); } @Test @@ -206,26 +204,26 @@ public class CommonMethodsTest { String result = CommonMethods.listToSeparatedString( Stream.of("Concat", "String").collect(Collectors.toList()), ','); - Assert.assertNotNull(result); - Assert.assertEquals(str, result); + assertNotNull(result); + assertEquals(str, result); } @Test public void testDuplicateStringWithDelimiter() { String duplicateStr = CommonMethods.duplicateStringWithDelimiter("Duplicate", '#', 4); - Assert.assertNotNull(duplicateStr); + assertNotNull(duplicateStr); String[] duplicateStrArray = duplicateStr.split("#"); - Assert.assertTrue(duplicateStr.contains("Duplicate")); - Assert.assertEquals(duplicateStrArray.length, 4); + assertTrue(duplicateStr.contains("Duplicate")); + assertEquals(duplicateStrArray.length, 4); } @Test public void testRoSingleElement() { Set stringSet = CommonMethods.toSingleElementSet("Set Element"); - Assert.assertNotNull(stringSet); - Assert.assertTrue(stringSet.contains("Set Element")); + assertNotNull(stringSet); + assertTrue(stringSet.contains("Set Element")); } @Test @@ -253,7 +251,7 @@ public class CommonMethodsTest { List> resultList = CommonMethods.mergeListsOfMap(list1, list2); - Assert.assertEquals(resultList.size(), 6); + assertEquals(resultList.size(), 6); //Verify for duplicate key int count = 0; @@ -262,7 +260,7 @@ public class CommonMethodsTest { count++; } - Assert.assertEquals(1, count); + assertEquals(1, count); } @Test @@ -272,9 +270,9 @@ public class CommonMethodsTest { List resultList = CommonMethods.mergeLists(list1, list2); - Assert.assertEquals(resultList.size(), 4); - Assert.assertTrue(resultList.containsAll(list1)); - Assert.assertTrue(resultList.containsAll(list2)); + assertEquals(resultList.size(), 4); + assertTrue(resultList.containsAll(list1)); + assertTrue(resultList.containsAll(list2)); } @Test @@ -294,7 +292,7 @@ public class CommonMethodsTest { Map resultMap = CommonMethods.mergeMaps(map1, map2); - Assert.assertEquals(resultMap.size(), 4); - Assert.assertEquals(resultMap.get("Port"), "VMI"); + assertEquals(resultMap.size(), 4); + assertEquals(resultMap.get("Port"), "VMI"); } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java index 1b06f37a16..8fe9d40536 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileContentHandlerTest.java @@ -1,8 +1,24 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.core.utilities.file; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -12,9 +28,8 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; - -import org.testng.Assert; -import org.testng.annotations.Test; +import org.junit.Assert; +import org.junit.Test; /** * @author EVITALIY @@ -82,9 +97,9 @@ public class FileContentHandlerTest { Assert.assertEquals(contentHandler.getFiles().size(), 2); Assert.assertEquals(contentHandler.getFileList().size(), 2); - Assert.assertFalse(contentHandler.isEmpty()); + assertFalse(contentHandler.isEmpty()); contentHandler.remove("file1"); - Assert.assertFalse(contentHandler.containsFile("file1")); + assertFalse(contentHandler.containsFile("file1")); } @Test diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileUtilsTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileUtilsTest.java index 74c1b1424d..187f6c35a8 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileUtilsTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/file/FileUtilsTest.java @@ -16,9 +16,9 @@ package org.openecomp.core.utilities.file; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import java.io.File; import java.io.IOException; @@ -31,10 +31,9 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; - import org.apache.commons.io.IOUtils; -import org.testng.Assert; -import org.testng.annotations.Test; +import org.junit.Assert; +import org.junit.Test; /** * @author EVITALIY @@ -64,12 +63,12 @@ public class FileUtilsTest { assertTrue(FileUtils.readViaInputStream(TEST_RESOURCE, TEST_FUNCTION) > 0); } - @Test(expectedExceptions = NullPointerException.class) + @Test(expected = NullPointerException.class) public void testReadViaInputStreamNull() { FileUtils.readViaInputStream((String) null, TEST_FUNCTION); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testReadViaInputStreamNotFound() { FileUtils.readViaInputStream("notfound.txt", TEST_FUNCTION); } @@ -176,7 +175,7 @@ public class FileUtilsTest { Assert.assertNotNull(inputStream); } - @Test(expectedExceptions = RuntimeException.class) + @Test(expected = RuntimeException.class) public void testLoadFileToInputStreamIncorrectFilePath() { FileUtils.loadFileToInputStream("invalidfilepath"); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java index e57cdc2a80..918d7beea7 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java @@ -22,9 +22,9 @@ package org.openecomp.core.utilities.json; import org.json.JSONException; import org.json.JSONObject; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.utilities.file.FileUtils; -import org.testng.Assert; -import org.testng.annotations.Test; public class JsonSchemaDataGeneratorTest { @@ -53,7 +53,7 @@ public class JsonSchemaDataGeneratorTest { + "\"phoneNumber\":[{\"code\":1,\"location\":\"Home\"},{\"code\":2,\"location\":\"Office\"}]}")); } - @Test(expectedExceptions = JSONException.class) + @Test(expected = JSONException.class) public void testSchemaWithInvalidDefault() { testGenerate(SCHEMA_WITH_INVALID_DEFAULT, null); } @@ -64,7 +64,7 @@ public class JsonSchemaDataGeneratorTest { new JSONObject("{\"ipConfiguration\":{\"ipv4Required\":true,\"ipv6Required\":false}}")); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testConstructorException() { Assert.assertNull(new JsonSchemaDataGenerator(null)); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java index 02bc568c39..17e48ca69c 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java @@ -26,10 +26,9 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; - +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.utilities.file.FileUtils; -import org.testng.Assert; -import org.testng.annotations.Test; public class JsonUtilTest { @@ -70,7 +69,7 @@ public class JsonUtilTest { + "It does not match pattern (0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)"); } - @Test(expectedExceptions = IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testInValidJsonValidateNullJson() { JsonUtil.validate(null, null); } @@ -102,7 +101,7 @@ public class JsonUtilTest { Assert.assertEquals(list.size(), 3); } - @Test(expectedExceptions = RuntimeException.class) + @Test(expected = RuntimeException.class) public void testJson2ObjectIncorrectJson() { String inputStr = "{[Json, Util, Test]}"; List list = JsonUtil.json2Object(inputStr, ArrayList.class); @@ -117,7 +116,7 @@ public class JsonUtilTest { Assert.assertEquals(list.size(), 3); } - @Test(expectedExceptions = RuntimeException.class) + @Test(expected = RuntimeException.class) public void testJson2ObjectIncorrectJsonInputStream() { String inputStr = "{[Json, Util, Test]}"; List list = JsonUtil.json2Object(new ByteArrayInputStream(inputStr.getBytes()), ArrayList.class); diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml index b59220f818..bb4658c301 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml @@ -1,4 +1,20 @@ + + @@ -25,7 +41,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-heat-lib/pom.xml b/openecomp-be/lib/openecomp-heat-lib/pom.xml index eb02a3d833..099079f2a1 100644 --- a/openecomp-be/lib/openecomp-heat-lib/pom.xml +++ b/openecomp-be/lib/openecomp-heat-lib/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -16,6 +32,7 @@ org.projectlombok lombok + provided org.onap.sdc.common @@ -51,7 +68,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/pom.xml b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/pom.xml index 1700d75d0c..33f2d08816 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/pom.xml +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -52,7 +68,7 @@ org.mockito - mockito-all + mockito-core test diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/pom.xml b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/pom.xml index f5aa6b77d2..bb5c8ff03e 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/pom.xml +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/pom.xml @@ -24,15 +24,13 @@ org.mockito - mockito-all - ${mockito.all.version} + mockito-core test org.testng testng test - ${testng.version} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml index f8d3b958db..7261db7f67 100644 --- a/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-datatypes-lib/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -40,10 +56,12 @@ org.projectlombok lombok + provided org.testng testng + test diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml index 0511e5e562..3fcdcb3c27 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml @@ -1,3 +1,19 @@ + + @@ -14,6 +30,11 @@ + + org.projectlombok + lombok + provided + org.openecomp.sdc.core openecomp-facade-core diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml index 2987bfc509..07b414dadc 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml @@ -1,3 +1,19 @@ + + @@ -24,22 +40,9 @@ onap-tosca-datatype ${project.version} - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - - junit junit - ${junit.version} test @@ -56,7 +59,6 @@ org.openecomp.sdc openecomp-sdc-enrichment-impl ${project.version} - org.openecomp.sdc @@ -65,9 +67,8 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.openecomp.sdc diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java index 492630453e..e9d891dc94 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java @@ -16,17 +16,14 @@ package org.openecomp.sdc.enrichment.impl; -import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; -import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; -import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; -import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.openecomp.sdc.tosca.services.ToscaFileOutputService; -import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; -import org.testng.Assert; -import org.testng.annotations.Test; +import static org.junit.Assert.assertEquals; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.nio.file.NotDirectoryException; import java.util.HashMap; @@ -35,8 +32,15 @@ import java.util.Map; import java.util.Set; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; - -import static org.junit.Assert.assertEquals; +import org.junit.Assert; +import org.junit.Test; +import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; +import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.services.ToscaFileOutputService; +import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; public class EnrichmentManagerImplTest { diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml index b878d64079..0c52ea62d0 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml @@ -1,3 +1,19 @@ + + @@ -24,23 +40,9 @@ onap-tosca-datatype ${project.version} - - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - - junit junit - ${junit.version} test @@ -65,9 +67,8 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.openecomp.sdc.core @@ -95,16 +96,16 @@ ${project.version} - runtime org.openecomp.sdc openecomp-sdc-vendor-software-product-core ${project.version} + runtime - test org.openecomp.sdc openecomp-sdc-model-impl ${project.version} + test diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java index 48cf8d4dc1..694b28c5a3 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java @@ -20,8 +20,32 @@ package org.openecomp.sdc.enrichment.impl.external.artifact; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.times; + +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.apache.commons.collections4.CollectionUtils; -import org.mockito.*; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.enrichment.types.ArtifactCategory; @@ -39,21 +63,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.io.File; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.*; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.times; public class MonitoringMibEnricherTest { @@ -68,7 +77,7 @@ public class MonitoringMibEnricherTest { private MonitoringMibEnricher monitoringMibEnricher; - @BeforeMethod(alwaysRun = true) + @Before public void injectDoubles() { MockitoAnnotations.initMocks(this); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java index d13571ca52..182e992eb0 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java @@ -1,6 +1,38 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.enrichment.impl.external.artifact; -import org.mockito.*; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; import org.openecomp.core.enrichment.types.ArtifactCategory; import org.openecomp.core.model.dao.EnrichedServiceModelDao; import org.openecomp.core.model.types.ServiceArtifact; @@ -12,17 +44,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.io.File; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.*; public class ProcessArtifactEnricherTest { @Mock @@ -34,7 +55,7 @@ public class ProcessArtifactEnricherTest { @InjectMocks ProcessArtifactEnricher processArtifactEnricher; - @BeforeMethod(alwaysRun = true) + @Before public void injectDoubles() { MockitoAnnotations.initMocks(this); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java index d2fb48cb7d..8430556f87 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java @@ -1,3 +1,19 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.enrichment.impl.tosca; @@ -6,25 +22,24 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AV import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY; import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES; import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE; import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_FUNCTION; import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.NFC_NAMING_CODE; +import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.collections.map.HashedMap; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest { @@ -37,7 +52,7 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest String vspId = null; Version version = new Version(); - @BeforeMethod(alwaysRun = true) + @Before public void injectDoubles() { MockitoAnnotations.initMocks(this); vspId = "123"; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java index b48fd8d8d7..d04c1f6776 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java @@ -1,20 +1,35 @@ -package org.openecomp.sdc.enrichment.impl.tosca; +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ -import org.openecomp.sdc.datatypes.error.ErrorMessage; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +package org.openecomp.sdc.enrichment.impl.tosca; import java.io.IOException; import java.util.List; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; public class PortMirroringEnricherTest extends BaseToscaEnrichmentTest { private PortMirroringEnricher portMirroringEnricher; - @BeforeMethod(alwaysRun = true) - public void init() throws IOException { + @Before + public void init() { portMirroringEnricher = new PortMirroringEnricher(); } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml index 7fce7eec0d..01afbb141a 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/pom.xml @@ -30,7 +30,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/pom.xml b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/pom.xml index 638a8f0c6d..053bbe3574 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-core/pom.xml @@ -31,7 +31,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml index 4f30e69599..d91b405b2f 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml @@ -1,3 +1,19 @@ + + @@ -45,12 +61,6 @@ openecomp-sdc-datatypes-lib ${project.version} - - org.mockito - mockito-all - test - ${mockito.all.version} - commons-io commons-io diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml index c319a31d5d..905c0de9bf 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml @@ -1,3 +1,19 @@ + + 4.0.0 @@ -8,7 +24,7 @@ org.openecomp.sdc openecomp-sdc-lib 1.3.2-SNAPSHOT - ../.. + ../../pom.xml @@ -24,7 +40,7 @@ org.projectlombok lombok - compile + provided diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml index a066015cd8..6341bb926a 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml @@ -1,3 +1,19 @@ + + @@ -21,15 +37,13 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} junit junit test - ${junit.version} org.powermock diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml index 1b40000148..0ce44c8207 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml @@ -1,3 +1,19 @@ + + @@ -28,7 +44,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml index f12d9d74e4..beb7506991 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml @@ -1,3 +1,19 @@ + + @@ -57,6 +73,11 @@ onap-configuration-management-api ${project.version} + + org.projectlombok + lombok + provided + diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml index 0ab79fb52d..862615fd5a 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml @@ -1,3 +1,19 @@ + + @@ -28,15 +44,12 @@ junit junit - ${junit.version} test - org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.openecomp.sdc.core @@ -83,13 +96,6 @@ org.apache.maven.plugins maven-surefire-plugin ${mvn.surefire.version} - - - org.apache.maven.surefire - surefire-junit47 - ${mvn.surefire.version} - - classes 1 diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml index 34577c882c..91fc517dc6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml @@ -1,3 +1,19 @@ + + @@ -49,9 +65,8 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.onap.sdc.common @@ -67,7 +82,6 @@ org.testng testng - ${testng.version} test diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml index 4ccdb76ee2..55d8a7cade 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml @@ -1,3 +1,19 @@ + + @@ -20,18 +36,6 @@ logback-classic ${logback.version} - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - - org.openecomp.sdc openecomp-sdc-logging-core @@ -46,7 +50,6 @@ junit junit - ${junit.version} test @@ -66,9 +69,8 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.openecomp.sdc.core diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java index 96db0fd19d..c0a84b5f9d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java @@ -20,15 +20,14 @@ package org.openecomp.sdc.validation.impl.validators; +import java.util.List; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.List; -import java.util.Map; /** * @author Avrahamg diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ErrorMessagesTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ErrorMessagesTest.java index 5c2c0c0bf0..8179ea86c7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ErrorMessagesTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ErrorMessagesTest.java @@ -20,11 +20,11 @@ package org.openecomp.sdc.validation.impl.validators; +import org.junit.Assert; import org.junit.Test; import org.openecomp.core.validation.ErrorMessageCode; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.sdc.common.errors.Messages; -import org.testng.Assert; public class ErrorMessagesTest { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java index e5240a3147..a6e3d11cf3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java @@ -1,13 +1,28 @@ -package org.openecomp.sdc.validation.impl.validators; +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ -import org.openecomp.core.validation.types.MessageContainer; -import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; +package org.openecomp.sdc.validation.impl.validators; import java.io.IOException; import java.util.Map; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openecomp.core.validation.types.MessageContainer; +import org.openecomp.sdc.validation.util.ValidationTestUtil; /** * Created by TALIO on 2/16/2017. @@ -19,17 +34,15 @@ public class ForbiddenResourceGuideLineValidatorTest { private static String mockConfigFileName = "/org/openecomp/validation/configuration/mock_resource_validator_configuration.json"; - ForbiddenResourceGuideLineValidator forbiddenResourceGuideLineValidator = new + private static ForbiddenResourceGuideLineValidator forbiddenResourceGuideLineValidator = new ForbiddenResourceGuideLineValidator(); @BeforeClass - public void init() throws IOException { + public static void init() throws IOException { Map resourcesMap = ValidationTestUtil.getResourceMap(mockConfigFileName); Map resourceBaseValidatorMap = (Map) resourcesMap.get("forbiddenResourceGuideLineValidator"); - String implementationClass = - (String) resourceBaseValidatorMap.get("implementationClass"); Map properties = (Map) resourceBaseValidatorMap.get("properties"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java index d073d5050b..d687e5e512 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java @@ -1,12 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; public class HeatResourceValidatorTest { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java index 96b9ad613d..ffcedbbbc8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java @@ -21,17 +21,16 @@ package org.openecomp.sdc.validation.impl.validators; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.List; -import java.util.Map; public class HeatValidatorTest { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java index 391eb633ac..9e860ef2b3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java @@ -21,14 +21,13 @@ package org.openecomp.sdc.validation.impl.validators; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; public class ManifestValidatorTest { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java index 58400b91da..5c97b63bdd 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java @@ -1,12 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * Created by TALIO on 2/15/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java index 98a8122ed6..637510abba 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java @@ -21,13 +21,12 @@ package org.openecomp.sdc.validation.impl.validators; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; public class YamlValidatorTest { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java index fd6f1d42bb..43041140a3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java index 14a23d66d9..b864a2d557 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java @@ -16,16 +16,15 @@ package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.util.Map; +import java.util.Optional; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; -import java.util.Optional; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java index 83e06ee5b7..10c70b64d4 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java index 8b83669037..fabc833106 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java index af43dd1d78..e9c70b0251 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java index 1022270a8f..63523329cc 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java index 4948c53cde..07cfaf7481 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java @@ -16,14 +16,13 @@ package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java index d9b5f6815d..9fcef284a9 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java @@ -16,14 +16,13 @@ package org.openecomp.sdc.validation.impl.validators.heatresource; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * @author KATYR diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java index 2fb86f8556..b9720281a8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java @@ -1,13 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.namingconvention; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java index 0db8c221b9..f9e0765158 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java @@ -1,13 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.namingconvention; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.HeatResourceValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index 3837f3b260..de047b8fee 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -1,13 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.namingconvention; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.NamingConventionGuideLineValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java index fea0b7f5e2..26aad3cdf8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java @@ -1,14 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.namingconvention; +import java.io.IOException; +import java.util.Map; +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.NamingConventionGuideLineValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Map; /** * Created by TALIO on 2/28/2017. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java index 4d3718ee8d..b09eeb7b0a 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java @@ -1,13 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.validation.impl.validators.namingconvention; import java.util.Map; - +import org.junit.Assert; +import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.validation.impl.validators.NamingConventionGuideLineValidator; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; public class VirtualMachineInterfaceGuidelineValidatorTest { private static final String PATH = diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 75a581e776..68ba5c911d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -16,8 +16,17 @@ package org.openecomp.sdc.validation.util; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; import org.apache.commons.collections4.MapUtils; import org.apache.commons.io.IOUtils; +import org.junit.Assert; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; @@ -33,16 +42,6 @@ import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.base.ResourceBaseValidator; -import org.testng.Assert; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; /** * @author TALIO diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml index a0035767b1..d655853a36 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml @@ -22,7 +22,6 @@ org.testng testng - ${testng.version} test @@ -43,6 +42,7 @@ org.projectlombok lombok + provided diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml index 708f31df84..e9e5cfad9e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml @@ -32,27 +32,13 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} - - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - junit junit test - ${junit.version} com.fasterxml.jackson.dataformat diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml index 359bcb703d..4e27bd64f3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -28,12 +44,6 @@ openecomp-nosqldb-api ${project.version} - - org.testng - testng - ${testng.version} - test - org.openecomp.sdc.core openecomp-config-lib @@ -57,14 +67,12 @@ org.mockito - mockito-all - ${mockito.all.version} + mockito-core test junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java index 0aed663250..3e37125442 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/ServiceModelDaoFactoryTest.java @@ -20,13 +20,33 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao; -import com.amdocs.zusammen.adaptor.inbound.api.types.item.*; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementConflict; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ItemVersionConflict; +import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; -import com.amdocs.zusammen.datatypes.item.*; +import com.amdocs.zusammen.datatypes.item.ElementContext; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.Item; +import com.amdocs.zusammen.datatypes.item.ItemVersion; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.datatypes.item.ItemVersionStatus; +import com.amdocs.zusammen.datatypes.item.Resolution; import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions; import com.amdocs.zusammen.datatypes.itemversion.Tag; +import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.utilities.CommonMethods; @@ -37,13 +57,6 @@ import org.openecomp.sdc.datatypes.model.ElementType; import org.openecomp.sdc.model.impl.zusammen.ServiceModelDaoZusammenImpl; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.io.ByteArrayInputStream; -import java.util.*; public class ServiceModelDaoFactoryTest { @@ -53,13 +66,13 @@ public class ServiceModelDaoFactoryTest { private static String artifact001; private static final String tenant = "dox"; - @BeforeMethod + @Before public void setUp(){ SessionContextProviderFactory.getInstance().createInterface().create("test", tenant); } - @AfterMethod - public void tearDaown(){ + @After + public void tearDown(){ SessionContextProviderFactory.getInstance().createInterface().close(); } diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml index 319df1925e..bcec34f226 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml @@ -1,3 +1,19 @@ + + @@ -16,6 +32,7 @@ org.projectlombok lombok + provided com.datastax.cassandra @@ -69,27 +86,13 @@ org.mockito - mockito-all - test - ${mockito.all.version} - - - org.testng - testng + mockito-core test - ${testng.version} - - - snakeyaml - org.yaml - - junit junit test - ${junit.version} org.openecomp.sdc diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml index 29b79c45cb..6684daad8d 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml @@ -33,27 +33,13 @@ org.mockito - mockito-all + mockito-core test - ${mockito.all.version} - - - org.testng - testng - test - ${testng.version} - - - snakeyaml - org.yaml - - junit junit test - ${junit.version} org.openecomp.sdc diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java index e67dc57de2..6808c958d0 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java @@ -1,20 +1,29 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.versioning.dao.impl.zusammen; +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext; + import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.item.Info; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.core.zusammen.api.ZusammenAdaptor; -import org.openecomp.sdc.common.session.SessionContextProviderFactory; -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.openecomp.sdc.versioning.types.Item; -import org.openecomp.sdc.versioning.types.ItemStatus; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -24,12 +33,18 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; -import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext; -import static org.testng.Assert.assertEquals; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.openecomp.core.zusammen.api.ZusammenAdaptor; +import org.openecomp.sdc.common.session.SessionContextProviderFactory; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.Item; +import org.openecomp.sdc.versioning.types.ItemStatus; public class ItemZusammenDaoImplTest { @@ -45,7 +60,7 @@ public class ItemZusammenDaoImplTest { @InjectMocks private ItemZusammenDaoImpl itemDao; - @BeforeMethod + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); SessionContextProviderFactory.getInstance().createInterface().create(USER, tenant); @@ -79,7 +94,7 @@ public class ItemZusammenDaoImplTest { doReturn(returnedItems).when(zusammenAdaptorMock).listItems(eq(createZusammenContext(USER))); Collection items = itemDao.list(); - Assert.assertEquals(items.size(), 3); + assertEquals(items.size(), 3); Iterator itemIterator = items.iterator(); assertItemEquals(itemIterator.next(), returnedItems.get(0)); @@ -136,17 +151,17 @@ public class ItemZusammenDaoImplTest { Item item = itemDao.create(inputItem); Info capturedInfo = capturedZusammenInfo.getValue(); - Assert.assertEquals(capturedInfo.getName(), inputItem.getName()); - Assert.assertEquals(capturedInfo.getDescription(), inputItem.getDescription()); - Assert.assertEquals(capturedInfo.getProperty(ITEM_TYPE), inputItem.getType()); - Assert.assertEquals(capturedInfo.getProperty(ITEM_VERSIONS_STATUSES), + assertEquals(capturedInfo.getName(), inputItem.getName()); + assertEquals(capturedInfo.getDescription(), inputItem.getDescription()); + assertEquals(capturedInfo.getProperty(ITEM_TYPE), inputItem.getType()); + assertEquals(capturedInfo.getProperty(ITEM_VERSIONS_STATUSES), inputItem.getVersionStatusCounters()); - Assert.assertEquals(item.getId(), itemId); - Assert.assertEquals(item.getName(), inputItem.getName()); - Assert.assertEquals(item.getDescription(), inputItem.getDescription()); - Assert.assertEquals(item.getType(), inputItem.getType()); - Assert.assertEquals(item.getVersionStatusCounters(), inputItem.getVersionStatusCounters()); + assertEquals(item.getId(), itemId); + assertEquals(item.getName(), inputItem.getName()); + assertEquals(item.getDescription(), inputItem.getDescription()); + assertEquals(item.getType(), inputItem.getType()); + assertEquals(item.getVersionStatusCounters(), inputItem.getVersionStatusCounters()); } @Test @@ -169,10 +184,10 @@ public class ItemZusammenDaoImplTest { capturedZusammenInfo.capture()); Info capturedInfo = capturedZusammenInfo.getValue(); - Assert.assertEquals(capturedInfo.getName(), item.getName()); - Assert.assertEquals(capturedInfo.getDescription(), item.getDescription()); - Assert.assertEquals(capturedInfo.getProperty(ITEM_TYPE), item.getType()); - Assert.assertEquals(capturedInfo.getProperty(ITEM_VERSIONS_STATUSES), + assertEquals(capturedInfo.getName(), item.getName()); + assertEquals(capturedInfo.getDescription(), item.getDescription()); + assertEquals(capturedInfo.getProperty(ITEM_TYPE), item.getType()); + assertEquals(capturedInfo.getProperty(ITEM_VERSIONS_STATUSES), item.getVersionStatusCounters()); } @@ -197,24 +212,24 @@ public class ItemZusammenDaoImplTest { } private void assertItemEquals(Item item, com.amdocs.zusammen.datatypes.item.Item zusammenItem) { - Assert.assertEquals(item.getId(), zusammenItem.getId().getValue()); - Assert.assertEquals(item.getName(), zusammenItem.getInfo().getName()); - Assert.assertEquals(item.getDescription(), zusammenItem.getInfo().getDescription()); - Assert.assertEquals(item.getType(), zusammenItem.getInfo().getProperty(ITEM_TYPE)); - Assert.assertEquals(item.getProperties().get(APP_PROP_1), + assertEquals(item.getId(), zusammenItem.getId().getValue()); + assertEquals(item.getName(), zusammenItem.getInfo().getName()); + assertEquals(item.getDescription(), zusammenItem.getInfo().getDescription()); + assertEquals(item.getType(), zusammenItem.getInfo().getProperty(ITEM_TYPE)); + assertEquals(item.getProperties().get(APP_PROP_1), zusammenItem.getInfo().getProperty(APP_PROP_1)); - Assert.assertEquals(item.getProperties().get(APP_PROP_2), + assertEquals(item.getProperties().get(APP_PROP_2), zusammenItem.getInfo().getProperty(APP_PROP_2)); Map zusammenStatusesMap = zusammenItem.getInfo().getProperty(ITEM_VERSIONS_STATUSES); Map statusesMap = item.getVersionStatusCounters(); - zusammenStatusesMap.entrySet().forEach(entry -> Assert - .assertEquals(statusesMap.get(VersionStatus.valueOf(entry.getKey())), entry.getValue())); + zusammenStatusesMap.entrySet() + .forEach(entry -> assertEquals(statusesMap.get(VersionStatus.valueOf(entry.getKey())), entry.getValue())); - Assert.assertEquals(item.getCreationTime(), zusammenItem.getCreationTime()); - Assert.assertEquals(item.getModificationTime(), zusammenItem.getModificationTime()); + assertEquals(item.getCreationTime(), zusammenItem.getCreationTime()); + assertEquals(item.getModificationTime(), zusammenItem.getModificationTime()); } } \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java index 106464811c..66157bf428 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java @@ -1,9 +1,44 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.versioning.dao.impl.zusammen; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext; + import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; -import com.amdocs.zusammen.datatypes.item.*; +import com.amdocs.zusammen.datatypes.item.Info; +import com.amdocs.zusammen.datatypes.item.ItemVersion; +import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.datatypes.item.ItemVersionStatus; +import com.amdocs.zusammen.datatypes.item.SynchronizationStatus; import com.amdocs.zusammen.datatypes.itemversion.ItemVersionRevisions; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -13,22 +48,6 @@ import org.openecomp.sdc.common.session.SessionContextProviderFactory; import org.openecomp.sdc.versioning.dao.types.Revision; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; -import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext; public class VersionZusammenDaoImplTest { @@ -39,7 +58,7 @@ public class VersionZusammenDaoImplTest { @InjectMocks private VersionZusammenDaoImpl versionDao; - @BeforeMethod + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); SessionContextProviderFactory.getInstance().createInterface().create(USER, tenant); diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java index 85a7f28d8c..0af5d5034a 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java @@ -1,5 +1,35 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.versioning.impl; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.junit.Before; +import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -9,17 +39,6 @@ import org.openecomp.sdc.notification.services.SubscriptionService; import org.openecomp.sdc.versioning.dao.ItemDao; import org.openecomp.sdc.versioning.dao.types.VersionStatus; import org.openecomp.sdc.versioning.types.Item; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.*; -import static org.testng.Assert.*; public class AsdcItemManagerImplTest { @@ -38,7 +57,7 @@ public class AsdcItemManagerImplTest { @InjectMocks private AsdcItemManagerImpl itemManager; - @BeforeMethod + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java index 8aa076728b..26f4c31111 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/ItemManagerImplTest.java @@ -1,5 +1,31 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + package org.openecomp.sdc.versioning.impl; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.verify; + +import org.hamcrest.Description; +import org.hamcrest.TypeSafeMatcher; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; @@ -9,21 +35,16 @@ import org.openecomp.sdc.notification.services.SubscriptionService; import org.openecomp.sdc.versioning.dao.ItemDao; import org.openecomp.sdc.versioning.types.Item; import org.openecomp.sdc.versioning.types.ItemStatus; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import static org.mockito.Mockito.verify; -import static org.testng.Assert.assertEquals; public class ItemManagerImplTest { - private static final String USER = "user1"; + @Rule + public ExpectedException expectedException = ExpectedException.none(); + private static final String ITEM_ID = "item1"; private static final String ITEM_NAME = "item 1 name"; private static final String ITEM_TYPE_A = "A"; private static final String ITEM_TYPE_B = "B"; - private static final String tenant = "dox"; @Mock private ItemDao itemDao; @Mock @@ -33,18 +54,18 @@ public class ItemManagerImplTest { @InjectMocks private ItemManagerImpl itemManager; - @BeforeMethod + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } - @AfterMethod + @After public void tearDown(){ itemManager = null; } @Test - public void ArchiveTest(){ + public void archiveTest(){ Item item = createItem(ITEM_ID,ITEM_NAME,ITEM_TYPE_A); itemManager.archive(item); @@ -53,9 +74,11 @@ public class ItemManagerImplTest { assertEquals(item.getStatus(), ItemStatus.ARCHIVED); } - @Test(expectedExceptions = CoreException.class,expectedExceptionsMessageRegExp = - "Archive item failed, item .* is already Archived") - public void ArchiveTestNegative(){ + @Test + public void archiveTestNegative(){ + + expectedException.expect(CoreException.class); + expectedException.expectMessage(new RegexMatcher("Archive item failed, item .* is already Archived")); Item item = createItem(ITEM_ID,ITEM_NAME,ITEM_TYPE_B); item.setStatus(ItemStatus.ARCHIVED); @@ -64,7 +87,7 @@ public class ItemManagerImplTest { } @Test - public void RestoreTest(){ + public void restoreTest(){ Item item = createItem(ITEM_ID,ITEM_NAME,ITEM_TYPE_A); item.setStatus(ItemStatus.ARCHIVED); @@ -74,17 +97,17 @@ public class ItemManagerImplTest { assertEquals(item.getStatus(), ItemStatus.ACTIVE); } - @Test(expectedExceptions = CoreException.class,expectedExceptionsMessageRegExp = - "Restore item failed, item .* is already Active") - public void RestoreTestNegative(){ + @Test + public void restoreTestNegative(){ + + expectedException.expect(CoreException.class); + expectedException.expectMessage(new RegexMatcher("Restore item failed, item .* is already Active")); Item item = createItem(ITEM_ID,ITEM_NAME,ITEM_TYPE_B); item.setStatus(ItemStatus.ACTIVE); itemManager.restore(item); - } - private Item createItem(String id, String name, String type) { Item item = new Item(); item.setId(id); @@ -92,4 +115,23 @@ public class ItemManagerImplTest { item.setType(type); return item; } + + private static class RegexMatcher extends TypeSafeMatcher { + + private final String regex; + + private RegexMatcher(String regex) { + this.regex = regex; + } + + @Override + protected boolean matchesSafely(String s) { + return s.matches(regex); + } + + @Override + public void describeTo(Description description) { + description.appendText("Regular expression: " + regex); + } + } } diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java index a58356a1a4..bed576fee7 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java @@ -20,6 +20,28 @@ package org.openecomp.sdc.versioning.impl; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.openecomp.sdc.versioning.dao.types.SynchronizationState.OutOfSync; +import static org.openecomp.sdc.versioning.dao.types.SynchronizationState.UpToDate; +import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified; +import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -28,30 +50,20 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.versioning.ItemManager; import org.openecomp.sdc.versioning.VersionCalculator; import org.openecomp.sdc.versioning.dao.VersionDao; -import org.openecomp.sdc.versioning.dao.types.*; +import org.openecomp.sdc.versioning.dao.types.Revision; +import org.openecomp.sdc.versioning.dao.types.SynchronizationState; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.dao.types.VersionState; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; import org.openecomp.sdc.versioning.types.VersionCreationMethod; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.*; -import static org.openecomp.sdc.versioning.dao.types.SynchronizationState.OutOfSync; -import static org.openecomp.sdc.versioning.dao.types.SynchronizationState.UpToDate; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Certified; -import static org.openecomp.sdc.versioning.dao.types.VersionStatus.Draft; public class VersioningManagerImplTest { private static final String ITEM_ID = "itemId"; private static final String VERSION_ID = "versionId"; + @Rule + public ExpectedException expectedException = ExpectedException.none(); + @Mock private VersionDao versionDaoMock; @Mock @@ -61,13 +73,13 @@ public class VersioningManagerImplTest { @InjectMocks private VersioningManagerImpl versioningManager; - @BeforeMethod + @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } @Test - public void testListWhenNone() throws Exception { + public void testListWhenNone() { doReturn(new ArrayList<>()).when(versionDaoMock).list(ITEM_ID); List versions = versioningManager.list(ITEM_ID); @@ -76,7 +88,7 @@ public class VersioningManagerImplTest { } @Test - public void testList() throws Exception { + public void testList() { List returnedVersions = Stream.of(createVersion("1", null, null, false), createVersion("2", null, null, false), createVersion("3", null, null, false)).collect(Collectors.toList()); @@ -86,7 +98,7 @@ public class VersioningManagerImplTest { Assert.assertEquals(versions, returnedVersions); } - @Test(expectedExceptions = Exception.class) + @Test(expected = Exception.class) public void testGetNonExisting() throws Exception { Version version = new Version(VERSION_ID); @@ -97,7 +109,7 @@ public class VersioningManagerImplTest { } @Test - public void testGetNonExistingForUser() throws Exception { + public void testGetNonExistingForUser() { Version requestedVersion = new Version(VERSION_ID); Version returnedVersion = createVersion(VERSION_ID, Draft, UpToDate, false); @@ -112,7 +124,7 @@ public class VersioningManagerImplTest { } @Test - public void testGetOutOfSyncCertified() throws Exception { + public void testGetOutOfSyncCertified() { Version requestedVersion = new Version(VERSION_ID); Version returnedVersion = createVersion(VERSION_ID, Certified, UpToDate, false); @@ -128,7 +140,7 @@ public class VersioningManagerImplTest { } @Test - public void testGet() throws Exception { + public void testGet() { Version requestedVersion = new Version(VERSION_ID); Version returnedVersion = createVersion(VERSION_ID, Draft, OutOfSync, true); @@ -143,7 +155,7 @@ public class VersioningManagerImplTest { } @Test - public void testCreate() throws Exception { + public void testCreate() { Version requestedVersion = new Version(); String versionName = "versionName"; @@ -166,7 +178,7 @@ public class VersioningManagerImplTest { } @Test - public void testCreateBasedOn() throws Exception { + public void testCreateBasedOn() { Version requestedVersion = new Version(); requestedVersion.setBaseId("baseVersionId"); @@ -193,9 +205,12 @@ public class VersioningManagerImplTest { verify(versionDaoMock).publish(eq(ITEM_ID), eq(requestedVersion), eq("Create version: 4.0")); } - @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = - "Item itemId: create version failed, a version with the name 2.0 already exist") - public void testCreateWithExistingName() throws Exception { + @Test + public void testCreateWithExistingName() { + + expectedException.expect(CoreException.class); + expectedException.expectMessage("Item itemId: create version failed, a version with the name 2.0 already exist"); + Version version = new Version(); version.setBaseId("baseVersionId"); @@ -215,9 +230,12 @@ public class VersioningManagerImplTest { versioningManager.create(ITEM_ID, version, VersionCreationMethod.major); } - @Test(expectedExceptions = CoreException.class, expectedExceptionsMessageRegExp = - "Item itemId: submit version failed, version versionId is already Certified") - public void testSubmitCertified() throws Exception { + @Test + public void testSubmitCertified() { + + expectedException.expect(CoreException.class); + expectedException.expectMessage("Item itemId: submit version failed, version versionId is already Certified"); + Version version = new Version(VERSION_ID); Version returnedVersion = createVersion(VERSION_ID, Certified, UpToDate, false); @@ -227,7 +245,7 @@ public class VersioningManagerImplTest { } @Test - public void testSubmit() throws Exception { + public void testSubmit() { Version version = new Version(VERSION_ID); ArgumentCaptor versionArgumentCaptor = ArgumentCaptor.forClass(Version.class); @@ -245,7 +263,7 @@ public class VersioningManagerImplTest { } @Test - public void testPublish() throws Exception { + public void testPublish() { Version version = new Version(VERSION_ID); String publishDescription = "Publish message"; @@ -255,7 +273,7 @@ public class VersioningManagerImplTest { } @Test - public void testSync() throws Exception { + public void testSync() { Version version = new Version(VERSION_ID); versioningManager.sync(ITEM_ID, version); @@ -264,7 +282,7 @@ public class VersioningManagerImplTest { } @Test - public void testForceSync() throws Exception { + public void testForceSync() { Version version = new Version(VERSION_ID); versioningManager.forceSync(ITEM_ID, version); @@ -273,7 +291,7 @@ public class VersioningManagerImplTest { } @Test - public void testRevert() throws Exception { + public void testRevert() { Version version = new Version(VERSION_ID); String revisionId = "revisionId"; @@ -283,7 +301,7 @@ public class VersioningManagerImplTest { } @Test - public void testListRevisions() throws Exception { + public void testListRevisions() { Version version = new Version(VERSION_ID); List returnedRevisions = @@ -308,535 +326,4 @@ public class VersioningManagerImplTest { version.setState(state); return version; } - -/* - private static final String USR1 = "usr1"; - private static final String USR2 = "usr2"; - private static final String TYPE1 = "Type1"; -*/ -/* private static final String TYPE2 = "Type2";*//* - - private static final String ID1 = "Id1"; -*/ -/* private static final String ID2 = "Id2"; - private static final String ID3 = "Id3"; - private static final String TYPE1_TABLE_NAME = "vendor_license_model"; - private static final String TYPE1_ID_NAME = "vlm_id"; - private static final String TYPE1_VERSION_NAME = "version"; - private static final String TYPE2_TABLE_NAME = "feature_group"; - private static final String TYPE2_ID_NAME = "vlm_id"; - private static final String TYPE2_VERSION_NAME = "version";*//* - - private static final Version VERSION0 = new Version(0, 0); - private static final Version VERSION01 = new Version(0, 1); - private static final Version VERSION02 = new Version(0, 2); - private static final Version VERSION10 = new Version(1, 0); - private static final Version VERSION11 = new Version(1, 1); - - */ -/* private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); - - private static UDTMapper versionMapper = - noSqlDb.getMappingManager().udtMapper(Version.class);*//* - - @Mock - private VersionInfoDao versionInfoDaoMock; - @Mock - private VersionInfoDeletedDao versionInfoDeletedDaoMock; - @InjectMocks - private VersioningManagerImpl versioningManager; - - @Captor - private ArgumentCaptor versionInfoEntityArg; - - @BeforeMethod - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - */ -/* @BeforeClass - private void init() { - versionInfoDaoMock.delete(new VersionInfoEntity(TYPE1, ID1)); - versionInfoDaoMock.delete(new VersionInfoEntity(TYPE1, ID2)); - versionInfoDaoMock.delete(new VersionInfoEntity(TYPE2, ID3)); - String deleteFromType1 = String - .format("delete from %s where %s=? and %s=?", TYPE1_TABLE_NAME, TYPE1_ID_NAME, - TYPE1_VERSION_NAME); - noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION01)); - noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION02)); - noSqlDb.execute(deleteFromType1, ID1, versionMapper.toUDT(VERSION11)); - - versioningManager.register(TYPE1, - new VersionableEntityMetadata(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME)); - versioningManager.register(TYPE2, - new VersionableEntityMetadata(TYPE2_TABLE_NAME, TYPE2_ID_NAME, TYPE2_VERSION_NAME)); - }*//* - - -*/ -/* @Test - public void testRegister() throws Exception { - VersionableEntityMetadata entityMetadata = - new VersionableEntityMetadata(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME); - versioningManager.register(TYPE1, entityMetadata); - - Map> versionableEntities = - versionableEntitiesCapture.capture(); - Set type1Entities = versionableEntities.get(TYPE1); - Assert.assertNotNull(type1Entities); - Assert.assertTrue(type1Entities.contains(entityMetadata)); - }*//* - - - @Test(expectedExceptions = CoreException.class) - public void testCreateAlreadyExisting() { - doReturn(new VersionInfoEntity()).when(versionInfoDaoMock).get(anyObject()); - versioningManager.create(TYPE1, ID1, USR1); - } - - @Test - public void testCreate() { - Version version = versioningManager.create(TYPE1, ID1, USR1); - Assert.assertEquals(version, VERSION01); - -*/ -/* createVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1, - version);*//* - - verify(versionInfoDaoMock).create(versionInfoEntityArg.capture()); - VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue(); - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, new Version(0, 0), VERSION01, USR1, - VersionStatus.Locked, new HashSet<>(), null); - } - - @Test(expectedExceptions = CoreException.class) - public void testDeleteNonExisting() { - versioningManager.delete(TYPE1, ID1, USR1); - } - - @Test(expectedExceptions = CoreException.class) - public void testDeleteLocked() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null); - versioningManager.delete(TYPE1, ID1, USR1); - } - - @Test - public void testDelete() { - VersionInfoEntity versionInfoEntity = new VersionInfoEntity(); - versionInfoEntity.setStatus(VersionStatus.Draft); - doReturn(versionInfoEntity).when(versionInfoDaoMock).get(anyObject()); - - versioningManager.delete(TYPE1, ID1, USR1); - - verify(versionInfoDaoMock).delete(versionInfoEntity); - ArgumentCaptor versionInfoDeletedEntityArg = - ArgumentCaptor.forClass(VersionInfoDeletedEntity.class); - verify(versionInfoDeletedDaoMock).create(versionInfoDeletedEntityArg.capture()); - } - - @Test(expectedExceptions = CoreException.class) - public void testUndoDeleteNonExisting() { - versioningManager.undoDelete(TYPE1, ID1, USR1); - } - - @Test - public void testUndoDelete() { - VersionInfoDeletedEntity versionInfoDeletedEntity = new VersionInfoDeletedEntity(); - versionInfoDeletedEntity.setStatus(VersionStatus.Draft); - doReturn(versionInfoDeletedEntity).when(versionInfoDeletedDaoMock).get(anyObject()); - - versioningManager.undoDelete(TYPE1, ID1, USR1); - - verify(versionInfoDeletedDaoMock).delete(versionInfoDeletedEntity); - verify(versionInfoDaoMock).create(versionInfoEntityArg.capture()); -*/ -/* - VersionInfoDeletedEntity versionInfoDeletedEntity = - versionInfoDeletedDaoMock.get(new VersionInfoDeletedEntity(TYPE1, ID1)); - Assert.assertNotNull(versionInfoDeletedEntity); - - Map entitiesInfoMap = - versioningManager.listDeletedEntitiesVersionInfo(TYPE1, USR2, null); - Assert.assertEquals(entitiesInfoMap.size(), 1); - VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1)); - Assert.assertNull(versionInfoEntity); - versioningManager.undoDelete(TYPE1, ID1, USR1); - versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1)); - Assert.assertNotNull(versionInfoEntity);*//* - - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckoutNonExisting() { - versioningManager.checkout(TYPE1, ID1, USR2); - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckoutOnLockedSameUser() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null); - versioningManager.checkout(TYPE1, ID1, USR1); - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckoutOnLockedOtherUser() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null); - versioningManager.checkout(TYPE1, ID1, USR1); - } - - @Test - public void testCheckoutOnFinalized() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION10); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Certified, VERSION10, null, viewableVersions, - VERSION10); - - Version version = versioningManager.checkout(TYPE1, ID1, USR1); - Assert.assertEquals(version, VERSION11); - - VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1)); - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION10, VERSION11, USR1, - VersionStatus.Locked, viewableVersions, VERSION10); -*/ -/* - ResultSet results = - loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1, - VERSION11); - Assert.assertTrue(results.iterator().hasNext());*//* - - } - - @Test - public void testCheckout() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, VERSION01, null, viewableVersions, - null); - - Version version = versioningManager.checkout(TYPE1, ID1, USR1); - Assert.assertEquals(version, VERSION02); - - verify(versionInfoDaoMock).update(versionInfoEntityArg.capture()); - VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue(); - - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, VERSION02, USR1, - VersionStatus.Locked, viewableVersions, null); - -*/ -/* ResultSet results = - loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1, - VERSION02); - Assert.assertTrue(results.iterator().hasNext());*//* - - } - - @Test(expectedExceptions = CoreException.class) - public void testUndoCheckoutNonExisting() { - versioningManager.undoCheckout(TYPE1, ID1, USR1); - } - - @Test(expectedExceptions = CoreException.class) - public void testUndoCheckoutOnAvailable() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, VERSION01, null, viewableVersions, - null); - - versioningManager.undoCheckout(TYPE1, ID1, USR1); - } - - @Test(expectedExceptions = CoreException.class) - public void testUndoCheckouOnFinalized() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION10); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Certified, VERSION10, null, viewableVersions, - VERSION10); - versioningManager.undoCheckout(TYPE1, ID1, USR2); - } - - @Test(expectedExceptions = CoreException.class) - public void testUndoCheckoutOnLockedOtherUser() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null); - - versioningManager.undoCheckout(TYPE1, ID1, USR1); - } - - @Test - public void testUndoCheckout() { - HashSet viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01, - new UserCandidateVersion(USR1, VERSION02), viewableVersions, null); - - Version version = versioningManager.undoCheckout(TYPE1, ID1, USR1); - Assert.assertEquals(version, VERSION01); - - VersionInfoEntity versionInfoEntity = versionInfoDaoMock.get(new VersionInfoEntity(TYPE1, ID1)); - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null, - VersionStatus.Draft, viewableVersions, null); - -*/ -/* ResultSet results = - loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1, - VERSION02); - Assert.assertFalse(results.iterator().hasNext());*//* - - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckinNonExisting() { - versioningManager.checkin(TYPE1, ID1, USR1, ""); - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckinOnAvailable() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, VERSION01, null, viewableVersions, - null); - - versioningManager.checkin(TYPE1, ID1, USR1, "fail checkin"); - } - - - @Test(expectedExceptions = CoreException.class) - public void testCheckinOnFinalized() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION10); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Certified, VERSION10, null, viewableVersions, - VERSION10); - - versioningManager.checkin(TYPE1, ID1, USR1, "failed checkin"); - } - - @Test(expectedExceptions = CoreException.class) - public void testCheckinOnLockedOtherUser() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR2, VERSION01), Collections.emptySet(), null); - - versioningManager.checkin(TYPE1, ID1, USR1, ""); - } - - @Test - public void testCheckin() { - HashSet viewableVersions = new HashSet<>(); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR1, VERSION01), viewableVersions, null); - - Version version = versioningManager.checkin(TYPE1, ID1, USR1, "checkin 0.1"); - Assert.assertEquals(version, VERSION01); - - verify(versionInfoDaoMock).update(versionInfoEntityArg.capture()); - VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue(); - - viewableVersions.add(VERSION01); - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, VERSION01, null, null, - VersionStatus.Draft, viewableVersions, null); - } - - @Test(expectedExceptions = CoreException.class) - public void testSubmitNonExisting() { - versioningManager.submit(TYPE1, ID1, USR2, "failed submit"); - } - - @Test(expectedExceptions = CoreException.class) - public void testSubmitOnLocked() { - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION0, - new UserCandidateVersion(USR1, VERSION01), Collections.emptySet(), null); - versioningManager.submit(TYPE1, ID1, USR2, "failed submit"); - } - - - @Test(expectedExceptions = CoreException.class) - public void testSubmitOnFinalized() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION10); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Certified, VERSION10, null, viewableVersions, - VERSION10); - versioningManager.submit(TYPE1, ID1, USR2, "failed submit"); - } - - @Test - public void testSubmit() { - Version version32 = new Version(3, 2); - Version version40 = new Version(4, 0); - - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION10); - viewableVersions.add(new Version(2, 0)); - viewableVersions.add(new Version(3, 0)); - viewableVersions.add(new Version(3, 1)); - viewableVersions.add(version32); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, version32, null, viewableVersions, - new Version(3, 0)); - - Version version = versioningManager.submit(TYPE1, ID1, USR1, "submit msg"); - Assert.assertEquals(version, version40); - viewableVersions.remove(new Version(3, 1)); - viewableVersions.remove(version32); - viewableVersions.add(version40); - - verify(versionInfoDaoMock).update(versionInfoEntityArg.capture()); - VersionInfoEntity versionInfoEntity = versionInfoEntityArg.getValue(); - - assretVersionInfoEntity(versionInfoEntity, TYPE1, ID1, version40, null, null, - VersionStatus.Certified, viewableVersions, version40); - -*/ -/* ResultSet results = - loadVersionableEntityRecord(TYPE1_TABLE_NAME, TYPE1_ID_NAME, TYPE1_VERSION_NAME, ID1, - VERSION10); - Assert.assertTrue(results.iterator().hasNext());*//* - - } - - @Test(expectedExceptions = CoreException.class) - public void testGetVersionInfoOnNonExistingEntity() { - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read); - } - - @Test - public void testGetVersionInfoForReadOnAvailable() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, VERSION01, null, viewableVersions, - null); - - VersionInfo versionInfo = - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read); - assertVersionInfo(versionInfo, VERSION01, VersionStatus.Draft, null, - viewableVersions, null); - } - - @Test(expectedExceptions = CoreException.class) - public void testGetVersionInfoForWriteOnAvailable() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Draft, VERSION01, null, viewableVersions, - null); - - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write); - } - - @Test - public void testGetVersionInfoForReadOnLockedSameUser() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01, - new UserCandidateVersion(USR1, VERSION02), viewableVersions, null); - - VersionInfo versionInfo = - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read); - viewableVersions.add(VERSION02); - assertVersionInfo(versionInfo, VERSION02, VersionStatus.Locked, USR1, viewableVersions, null); - } - - @Test - public void testGetVersionInfoForReadOnLockedOtherUser() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01, - new UserCandidateVersion(USR2, VERSION02), viewableVersions, null); - - VersionInfo versionInfo = - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Read); - Assert.assertEquals(versionInfo.getActiveVersion(), VERSION01); - assertVersionInfo(versionInfo, VERSION01, VersionStatus.Locked, USR2, viewableVersions, null); - } - - @Test(expectedExceptions = CoreException.class) - public void testGetVersionInfoForWriteOnLockedOtherUser() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01, - new UserCandidateVersion(USR2, VERSION02), viewableVersions, null); - - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write); - } - - @Test - public void testGetVersionInfoForWriteOnLockedSameUser() { - Set viewableVersions = new HashSet<>(); - viewableVersions.add(VERSION01); - mockVersionInfoEntity(TYPE1, ID1, VersionStatus.Locked, VERSION01, - new UserCandidateVersion(USR1, VERSION02), viewableVersions, null); - - VersionInfo versionInfo = - versioningManager.getEntityVersionInfo(TYPE1, ID1, USR1, VersionableEntityAction.Write); - viewableVersions.add(VERSION02); - assertVersionInfo(versionInfo, VERSION02, VersionStatus.Locked, USR1, viewableVersions, null); - } - -*/ -/* private void createVersionableEntityRecord(String tableName, String idName, String versionName, - String id, Version version) { - noSqlDb.execute( - String.format("insert into %s (%s,%s) values (?,?)", tableName, idName, versionName), id, - versionMapper.toUDT(version)); - } - - private ResultSet loadVersionableEntityRecord(String tableName, String idName, String versionName, - String id, Version version) { - return noSqlDb.execute( - String.format("select * from %s where %s=? and %s=?", tableName, idName, versionName), id, - versionMapper.toUDT(version)); - }*//* - - - - private static void assretVersionInfoEntity(VersionInfoEntity actual, String entityType, - String entityId, Version activeVersion, - Version candidateVersion, String candidateUser, - VersionStatus status, Set viewbleVersions, - Version latestFinalVersion) { - Assert.assertNotNull(actual); - Assert.assertEquals(actual.getEntityType(), entityType); - Assert.assertEquals(actual.getEntityId(), entityId); - Assert.assertEquals(actual.getActiveVersion(), activeVersion); - if (candidateVersion != null && candidateUser != null) { - Assert.assertEquals(actual.getCandidate().getVersion(), candidateVersion); - Assert.assertEquals(actual.getCandidate().getUser(), candidateUser); - } else { - Assert.assertNull(actual.getCandidate()); - } - Assert.assertEquals(actual.getStatus(), status); - Assert.assertEquals(actual.getViewableVersions().size(), viewbleVersions.size()); - Assert.assertEquals(actual.getViewableVersions(), viewbleVersions); - Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion); - } - - private static void assertVersionInfo(VersionInfo actual, Version activeVersion, - VersionStatus status, String lockingUser, - Set viewableVersions, Version latestFinalVersion) { - Assert.assertNotNull(actual); - Assert.assertEquals(actual.getActiveVersion(), activeVersion); - Assert.assertEquals(actual.getStatus(), status); - Assert.assertEquals(actual.getLockingUser(), lockingUser); - Assert.assertEquals(actual.getViewableVersions().size(), viewableVersions.size()); - Assert.assertEquals(actual.getViewableVersions(), viewableVersions); - Assert.assertEquals(actual.getLatestFinalVersion(), latestFinalVersion); - } - - private VersionInfoEntity mockVersionInfoEntity(String entityType, String entityId, - VersionStatus status, Version activeVersion, - UserCandidateVersion candidate, - Set viewableVersions, - Version latestFinalVersion) { - VersionInfoEntity mock = new VersionInfoEntity(); - mock.setEntityType(entityType); - mock.setEntityId(entityId); - mock.setStatus(status); - mock.setActiveVersion(activeVersion); - mock.setCandidate(candidate); - mock.setViewableVersions(viewableVersions); - mock.setLatestFinalVersion(latestFinalVersion); - - doReturn(mock).when(versionInfoDaoMock).get(anyObject()); - return mock; - } -*/ } diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml index 18af8f205e..56362ef4d2 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml @@ -27,7 +27,6 @@ junit junit - ${junit.version} test diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-lib/pom.xml index 776b3fad48..22d329b276 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-lib/pom.xml @@ -1,3 +1,19 @@ + + @@ -47,14 +63,12 @@ junit junit - ${junit.version} test org.mockito - mockito-all + mockito-core test - ${mockito.all.version} org.openecomp.sdc @@ -81,7 +95,7 @@ org.projectlombok lombok - compile + provided diff --git a/openecomp-be/tools/zusammen-tools/pom.xml b/openecomp-be/tools/zusammen-tools/pom.xml index 28bc4d7e40..0821d5a7a1 100644 --- a/openecomp-be/tools/zusammen-tools/pom.xml +++ b/openecomp-be/tools/zusammen-tools/pom.xml @@ -1,3 +1,19 @@ + + @@ -77,7 +93,6 @@ org.testng testng - ${testng.version} test -- 2.16.6