summaryrefslogtreecommitdiffstats
path: root/vnf-sdk-function-test/src/test
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-04-12 17:59:01 +0530
committerMurali-P <murali.p@huawei.com>2017-04-12 18:46:05 +0530
commit0310cb228f56240d7b067356933169363c669e2e (patch)
treec77d8972ac31c6a93e5263c4427c1a1708368b63 /vnf-sdk-function-test/src/test
parent89965638618c0e1aa19766f7af6fa35bac09568c (diff)
Change Vnf Sdk interface
Resolved:VNFSDK-21 VNF SDK Function test Change-Id: I85563baa45df4a438abe63e098c9fa1de8ee2ea9 Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'vnf-sdk-function-test/src/test')
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java37
1 files changed, 34 insertions, 3 deletions
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 83271af..32a03f5 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
@@ -27,13 +27,18 @@ import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.openo.vnfsdk.functest.FileUtil;
+import org.openo.vnfsdk.functest.externalservice.entity.OperationStatus;
+import org.openo.vnfsdk.functest.externalservice.entity.OperationStatus.operResultCode;
+import org.openo.vnfsdk.functest.externalservice.entity.OperationStatusHandler;
import org.openo.vnfsdk.functest.responsehandler.VnfFuncTestResponseHandler;
+import org.openo.vnfsdk.functest.util.RestResponseUtil;
import org.openo.vnfsdk.functest.util.ZipCompressor;
import mockit.Mock;
@@ -94,7 +99,8 @@ public class CommonManagerTest {
@Test
public void testUploadFuncTestPackage() {
URL url = Thread.currentThread().getContextClassLoader().getResource("RobotScript");
- String zipFileName = url.getPath() + ".zip";
+ // Some temporary folder uploaded in github
+ String zipFileName = "https://github.com/zoul/Finch/zipball/master/";
new MockUp<FileUtil>() {
@@ -106,8 +112,8 @@ public class CommonManagerTest {
};
try {
- InputStream mockInputStream = new FileInputStream(zipFileName);
- response = commonManger.uploadFuncTestPackage(mockInputStream, funcTestId);
+ // InputStream mockInputStream = new FileInputStream(zipFileName);
+ response = commonManger.uploadFuncTestPackage(funcTestId, zipFileName);
assertNotNull(response);
assertEquals(200, response.getStatus());
} catch(Exception e) {
@@ -128,6 +134,31 @@ public class CommonManagerTest {
@Test
public void testDownloadResults() {
+ new MockUp<OperationStatusHandler>() {
+
+ @Mock
+ public Response getOperationStatus(UUID uuid) {
+ OperationStatus operstatus = new OperationStatus();
+ operstatus.setOperFinished(true);
+ operstatus.setoResultCode(operResultCode.SUCCESS);
+ operstatus.setOperResultMessage("finished");
+ return response;
+ }
+ };
+
+ new MockUp<VnfFuncTestResponseHandler>() {
+
+ @Mock
+ public Response downloadResults(String funcTestId) {
+ OperationStatus operstatus = new OperationStatus();
+ operstatus.setOperFinished(true);
+ operstatus.setoResultCode(operResultCode.SUCCESS);
+ operstatus.setOperResultMessage("finished");
+
+ return RestResponseUtil.getSuccessResponse(operstatus);
+ }
+ };
+
try {
response = commonManger.downloadResults(funcTestId);
assertNotNull(response);