diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-11-01 20:27:39 +0200 |
---|---|---|
committer | vempo <vitaliy.emporopulo@amdocs.com> | 2018-11-01 21:01:25 +0200 |
commit | 2da911f8ba408fbbf3d7639796208078fac28e32 (patch) | |
tree | 2ca7779ce88485752a680dca9871276d036d5513 /openecomp-be/lib/openecomp-sdc-enrichment-lib | |
parent | 1276ee10702ae3c1e1e7f9c11d6b2949e3e757e8 (diff) |
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 <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib')
8 files changed, 180 insertions, 93 deletions
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 @@ +<!-- + ~ 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. + --> + <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -15,6 +31,11 @@ <dependencies> <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.openecomp.sdc.core</groupId> <artifactId>openecomp-facade-core</artifactId> <version>${project.version}</version> 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 @@ +<!-- + ~ 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. + --> + <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -25,21 +41,8 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>${testng.version}</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> @@ -56,7 +59,6 @@ <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-enrichment-impl</artifactId> <version>${project.version}</version> - <!--scope>runtime</scope--> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -65,9 +67,8 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> - <version>${mockito.all.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> 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 @@ +<!-- + ~ 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. + --> + <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> @@ -24,23 +40,9 @@ <artifactId>onap-tosca-datatype</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <scope>test</scope> - <version>${testng.version}</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> @@ -65,9 +67,8 @@ </dependency> <dependency> <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> + <artifactId>mockito-core</artifactId> <scope>test</scope> - <version>${mockito.all.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc.core</groupId> @@ -95,16 +96,16 @@ <version>${project.version}</version> </dependency> <dependency> - <scope>runtime</scope> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-vendor-software-product-core</artifactId> <version>${project.version}</version> + <scope>runtime</scope> </dependency> <dependency> - <scope>test</scope> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-model-impl</artifactId> <version>${project.version}</version> + <scope>test</scope> </dependency> </dependencies> 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(); } |