From d6bd31bf81c1eb8e4f3a6b349d021f5533f03b03 Mon Sep 17 00:00:00 2001 From: "k.kedron" Date: Tue, 11 Jun 2019 10:46:26 +0200 Subject: Update the CsarInfoTest. Used common ZipUtil.readData instead local load method. Fix checkstyle (variable named). Issue-ID: SDC-2327 Signed-off-by: Krystian Kedron Change-Id: I6adaed83e45d43268b174fde0ba6ee991e3fb2b0 --- .../sdc/be/components/csar/CsarInfoTest.java | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java index 3c9ae0721e..3ae65c818a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java @@ -27,9 +27,6 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -44,7 +41,7 @@ import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentEx import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.NodeTypeInfo; import org.openecomp.sdc.be.model.User; -import org.openecomp.sdc.common.util.ZipUtil; +import org.openecomp.sdc.ZipUtil; @RunWith(MockitoJUnitRunner.class) public class CsarInfoTest { @@ -55,7 +52,7 @@ public class CsarInfoTest { private User user; private static final String CSAR_UUID = "csarUUID"; - private static final String PAYLOAD_NAME = "mock_service.csar"; + private static final String PAYLOAD_NAME = "/mock_service.csar"; private static final String RESOURCE_NAME = "resourceName"; private static final String MAIN_TEMPLATE_NAME = "Definitions/tosca_mock_vf.yaml"; @@ -67,11 +64,11 @@ public class CsarInfoTest { public void setup() throws IOException, URISyntaxException { // given - Map payload = loadPayload(PAYLOAD_NAME); - String main_template_content = new String(payload.get(MAIN_TEMPLATE_NAME)); + Map payload = ZipUtil.readData(PAYLOAD_NAME); + String mainTemplateContent = new String(payload.get(MAIN_TEMPLATE_NAME)); csarInfo = new CsarInfo(user, CSAR_UUID, payload, RESOURCE_NAME, - MAIN_TEMPLATE_NAME, main_template_content, true); + MAIN_TEMPLATE_NAME, mainTemplateContent, true); } @Test @@ -115,12 +112,4 @@ public class CsarInfoTest { assertEquals(MAIN_TEMPLATE_NAME, csarInfo.getMainTemplateName()); assertEquals(csarInfo.getMainTemplateName(), nodeTypeInfo.getTemplateFileName()); } - - private Map loadPayload(String payloadName) throws IOException, URISyntaxException { - - Path path = Paths.get(getClass().getResource("/" + payloadName).toURI()); - byte[] data = Files.readAllBytes(path); - - return ZipUtil.readZip(data); - } } -- cgit 1.2.3-korg