aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
- }
}