summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-10-19 16:33:00 +0100
committerS�bastien Determe <sebastien.determe@intl.att.com>2020-10-23 14:26:12 +0000
commit9714961d2950d00ae66be01e20c1ebb8552a82e9 (patch)
treef9c46bd321f7ef72614d5e5cfbcb42e0bbb49ac5 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib
parent290420e92809093050a493f34be3cc214459162f (diff)
Remove sdc-tosca-parser dependency
Change-Id: I762b7a1098505312486d690902f2f10108a601ff Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3317
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib')
-rw-r--r--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.java21
1 files changed, 16 insertions, 5 deletions
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> T convert(final String fullFileName, final Class<T> 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);
+ }
+ }
+
}