From 1a6861184c06c2e8ea41c8b5a86350fb2d2d227a Mon Sep 17 00:00:00 2001 From: Murali-P Date: Wed, 15 Feb 2017 16:16:54 +0530 Subject: Remove zip file Resolved:VNFSDK-21 Function test base code Change-Id: Ib870745e42448ec7e3925d0ef9bac5489b03273d Signed-off-by: Murali-P --- .../openo/vnfsdk/functest/resource/CommonManagerTest.java | 13 ++++++++++++- .../test/java/org/openo/vnfsdk/functests/FileUtilTest.java | 8 -------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'vnf-sdk-function-test/src/test/java/org') diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java index 99fced0..5bda1ec 100644 --- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java +++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.util.HashMap; @@ -31,6 +32,7 @@ import javax.ws.rs.core.Response; import org.junit.Before; import org.junit.Test; import org.openo.vnfsdk.functest.responsehandler.VnfFuncTestResponseHandler; +import org.openo.vnfsdk.functest.util.ZipCompressor; public class CommonManagerTest { @@ -45,7 +47,16 @@ public class CommonManagerTest { @Test public void testexecuteFunc() throws FileNotFoundException { - InputStream mockInputStream = new FileInputStream(new File("src//test//resources//RobotScript.zip")); + + URL url = Thread.currentThread().getContextClassLoader().getResource("RobotScript"); + String zipFileName = url.getPath() + ".zip"; + try { + new ZipCompressor(zipFileName).compress(url.getPath()); + } catch(IOException e) { + + } + + InputStream mockInputStream = new FileInputStream(zipFileName); Response response = commonManger.executeFuncTest(mockInputStream); instanceId = response.getEntity().toString(); assertNotNull(instanceId); diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java index 106490d..ba3bd5d 100644 --- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java +++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/FileUtilTest.java @@ -20,8 +20,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; -import java.io.IOException; -import java.util.List; import org.junit.Test; import org.openo.vnfsdk.functest.FileUtil; @@ -48,12 +46,6 @@ public class FileUtilTest { assertTrue(FileUtil.deleteFile(new File(deleteDirPath))); } - @Test - public void testUnzip() throws IOException { - List files = FileUtil.unzip(zipFileName, extractZip); - assertNotNull(files); - } - @Test public void testGetDirectory() { String[] getDirectories = FileUtil.getDirectory("."); -- cgit 1.2.3-korg