From 9714961d2950d00ae66be01e20c1ebb8552a82e9 Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 19 Oct 2020 16:33:00 +0100 Subject: Remove sdc-tosca-parser dependency Change-Id: I762b7a1098505312486d690902f2f10108a601ff Signed-off-by: Vasyl Razinkov Issue-ID: SDC-3317 --- .../services/impl/etsi/ETSIServiceImplTest.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core') 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/services/impl/etsi/ETSIServiceImplTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java index f03d561375..f5570ae4e1 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/etsi/ETSIServiceImplTest.java @@ -31,9 +31,11 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -48,12 +50,12 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; -import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter; -import org.openecomp.sdc.be.config.NonManoConfiguration; import org.onap.sdc.tosca.services.YamlUtil; import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.sdc.be.config.NonManoConfiguration; import org.openecomp.sdc.tosca.csar.Manifest; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.yaml.snakeyaml.Yaml; public class ETSIServiceImplTest { @@ -73,9 +75,8 @@ public class ETSIServiceImplTest { @Before public void setUp() throws IOException { - YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter(); - NonManoConfiguration configuration = yamlToObjectConverter.convert("src/test/resources", - NonManoConfiguration.class, "nonManoConfig.yaml"); + final String fullFileName = Paths.get("src", "test", "resources", "nonManoConfig.yaml").toString(); + final NonManoConfiguration configuration = convert(fullFileName, NonManoConfiguration.class); etsiService = Mockito.spy(new ETSIServiceImpl(configuration)); } @@ -290,4 +291,14 @@ public class ETSIServiceImplTest { containsString(file2Path.toString())); } + private T convert(final String fullFileName, final Class className) throws IOException { + assertTrue((new File(fullFileName)).exists()); + + try (final InputStream in = Files.newInputStream(Paths.get(fullFileName));) { + return (new Yaml()).loadAs(in, className); + } catch (final IOException e) { + throw new IOException(e); + } + } + } -- cgit 1.2.3-korg