aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authork.kedron <k.kedron@partner.samsung.com>2019-06-11 10:46:26 +0200
committerk.kedron <k.kedron@partner.samsung.com>2019-06-14 16:48:51 +0200
commitd6bd31bf81c1eb8e4f3a6b349d021f5533f03b03 (patch)
tree3e00939f1c0b6a1b9ec56c00a8f0a2e587dad7ad /catalog-be/src
parent0df9d305dc0fe6551a1c11362e9d077f5801475f (diff)
Update the CsarInfoTest.
Used common ZipUtil.readData instead local load method. Fix checkstyle (variable named). Issue-ID: SDC-2327 Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com> Change-Id: I6adaed83e45d43268b174fde0ba6ee991e3fb2b0
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/csar/CsarInfoTest.java21
1 files 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<String, byte[]> payload = loadPayload(PAYLOAD_NAME);
- String main_template_content = new String(payload.get(MAIN_TEMPLATE_NAME));
+ Map<String, byte[]> 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<String, byte[]> loadPayload(String payloadName) throws IOException, URISyntaxException {
-
- Path path = Paths.get(getClass().getResource("/" + payloadName).toURI());
- byte[] data = Files.readAllBytes(path);
-
- return ZipUtil.readZip(data);
- }
}