summaryrefslogtreecommitdiffstats
path: root/wfenginemgrservice/src/test
diff options
context:
space:
mode:
authorZhaoxing <meng.zhaoxing1@zte.com.cn>2017-10-31 12:46:47 +0800
committerZhaoxing <meng.zhaoxing1@zte.com.cn>2017-10-31 12:46:47 +0800
commit20babe4f7936a82c54d43e715efebe1fbc680525 (patch)
tree5535dd53598f574ea35e120721a25981429d1064 /wfenginemgrservice/src/test
parent436b17e7478c6b337a9a241102b900bba3ea7e4d (diff)
Fix the docker build error for vfc-nfvo-wfengine
Change-Id: Ib46e0db064e5a834aa45a4d7448430992afcfd21 Issue-id: VFC-445 Signed-off-by: Zhaoxing <meng.zhaoxing1@zte.com.cn>
Diffstat (limited to 'wfenginemgrservice/src/test')
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java5
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java3
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowResourceTest.java10
3 files changed, 17 insertions, 1 deletions
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java
index e644626..af90c41 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java
@@ -16,13 +16,16 @@
package org.onap.workflow.externalservice.service.activitiservice;
import static org.mockito.Mockito.mock;
+import static org.powermock.api.mockito.PowerMockito.when;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.client.ClientProtocolException;
import org.junit.Assert;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.workflow.WorkflowAppConfig;
import org.onap.workflow.common.Config;
import org.onap.workflow.common.RestClient;
@@ -95,6 +98,8 @@ public class ActivitiServiceConsumerTest {
workflowAppConfig.setMsbClientConfig(msbClientConfig);
Config.setWorkflowAppConfig(workflowAppConfig);
InputStream ins = mock(InputStream.class);
+ // Byte b[]=(Byte) mock(Byte.class);
+ when(ins.read(Mockito.anyObject())).thenReturn(-21);
ActivitiDeployResponse result = ActivitiServiceConsumer.deploybpmnfile(ins, "result");
Assert.assertTrue(result == null);
RestClient.isTest = false;
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
index ea84226..487051f 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
@@ -16,6 +16,7 @@
package org.onap.workflow.resources;
import static org.powermock.api.mockito.PowerMockito.mock;
+import static org.powermock.api.mockito.PowerMockito.when;
import java.io.InputStream;
@@ -25,6 +26,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.workflow.common.RestClient;
import org.onap.workflow.common.RestResponse;
import org.onap.workflow.entity.StartProcessRequest;
@@ -46,6 +48,7 @@ public class WorkflowInstanceWrapperTest {
InputStream fileInputStream = mock(InputStream.class);
FormDataContentDisposition f = mock(FormDataContentDisposition.class);
String filename = "test";
+ when(fileInputStream.read(Mockito.anyObject())).thenReturn(-21);
Response reponse = workflowInstanceWrapper.deployBpmnFile(filename, fileInputStream, f);
Assert.assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), reponse.getStatus());
RestClient.isTest = false;
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowResourceTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowResourceTest.java
index e7d6523..7d8b194 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowResourceTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowResourceTest.java
@@ -21,6 +21,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
+import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.core.Response;
@@ -55,7 +56,14 @@ public class WorkflowResourceTest {
FormDataContentDisposition fileDetail = mock(FormDataContentDisposition.class);
Response result = Response.ok("success").build();
-
+ // when(fileInputStream.read()).thenReturn(-1);
+ try {
+ when(fileInputStream.read(Mockito.anyObject())).thenReturn(-21);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
when(workflowInstanceWrapper.deployBpmnFile(Mockito.anyString(), Mockito.anyObject(), Mockito.anyObject())).thenReturn(result);
assertThat(workflowResource.deployBpmnFile(fileInputStream,fileDetail), is(result));