summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wfenginemgrservice/src/main/java/org/onap/workflow/common/RestClient.java11
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/externalservice/service/activitiservice/ActivitiServiceConsumerTest.java26
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java12
3 files changed, 28 insertions, 21 deletions
diff --git a/wfenginemgrservice/src/main/java/org/onap/workflow/common/RestClient.java b/wfenginemgrservice/src/main/java/org/onap/workflow/common/RestClient.java
index f38fe11..2a6ba34 100644
--- a/wfenginemgrservice/src/main/java/org/onap/workflow/common/RestClient.java
+++ b/wfenginemgrservice/src/main/java/org/onap/workflow/common/RestClient.java
@@ -45,8 +45,7 @@ public class RestClient {
private static final String HTTP = "http";
private static final Logger logger = LoggerFactory.getLogger(RestClient.class);
- //PublicExposureUsedInTest
- public static boolean isTest = false;
+ private static boolean isTest = false;
public enum HttpMethod {
GET, POST, PUT, DELETE
@@ -287,4 +286,12 @@ public class RestClient {
return executeHttpDeleteDeploy(HttpMethod.DELETE, ip, port, url);
}
+ public static boolean getIsTest(){
+ return isTest;
+ }
+
+ public static void setIsTest(boolean arg){
+ isTest = arg;
+ }
+
}
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 af90c41..263cd30 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
@@ -37,32 +37,32 @@ import org.onap.workflow.externalservice.entity.activitientitiy.ActivitiStartPro
public class ActivitiServiceConsumerTest {
@Test
public void undeploybpmnfile() throws ClientProtocolException, IOException {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
RestResponse response = ActivitiServiceConsumer.undeploybpmnfile("22");
Assert.assertTrue(response != null);
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
@Test
public void startBpmnProcess() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
RestResponse response =
ActivitiServiceConsumer.startBpmnProcess(mock(ActivitiStartProcessRequest.class));
Assert.assertTrue(response != null);
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
@Test
public void testDeleteDeployProcess() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
RestResponse response = ActivitiServiceConsumer.deleteDeployProcess("22");
Assert.assertTrue(response != null);
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
@Test
public void testDeleteDeployProcessReturnNull() throws Exception {
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
RestResponse response = ActivitiServiceConsumer.deleteDeployProcess("22");
if (response != null) {
Assert.assertTrue(response.getResult() == null);
@@ -73,16 +73,16 @@ public class ActivitiServiceConsumerTest {
@Test
public void testStartProcessShouldReturnResponse() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
RestResponse response =
ActivitiServiceConsumer.startProcess(mock(ActivitiStartProcessRequest.class));
Assert.assertTrue(response != null);
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
@Test
public void testStartProcessShouldReturnNull() {
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
RestResponse response =
ActivitiServiceConsumer.startProcess(mock(ActivitiStartProcessRequest.class));
Assert.assertTrue(response.getResult() == null);
@@ -90,7 +90,7 @@ public class ActivitiServiceConsumerTest {
@Test
public void deploybpmnfile() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
WorkflowAppConfig workflowAppConfig = new WorkflowAppConfig();
MsbClientConfig msbClientConfig = new MsbClientConfig();
msbClientConfig.setMsbSvrPort(2);
@@ -102,7 +102,7 @@ public class ActivitiServiceConsumerTest {
when(ins.read(Mockito.anyObject())).thenReturn(-21);
ActivitiDeployResponse result = ActivitiServiceConsumer.deploybpmnfile(ins, "result");
Assert.assertTrue(result == null);
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
-} \ No newline at end of file
+}
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 487051f..b2253d6 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
@@ -44,36 +44,36 @@ public class WorkflowInstanceWrapperTest {
@Test
public final void testDeployBpmnFile() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
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;
+ RestClient.setIsTest(false);
}
@Test
public final void testUndeployBpmnFile() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
RestResponse response = WorkflowInstanceWrapper.getInstance().undeployBpmnFile(null);
if (response != null) {
Assert.assertTrue(response.getResult() == null);
}
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
@Test
public final void testStartProcess() throws Exception {
- RestClient.isTest = true;
+ RestClient.setIsTest(true);
ActivitiStartProcessRequest startProcessRequest = new ActivitiStartProcessRequest();
startProcessRequest.setProcessDefinitionKey("first");
StartProcessRequest tt = new StartProcessRequest();
tt.setProcessDefinitionKey("first");
Response reponse = workflowInstanceWrapper.startProcess(tt);
Assert.assertEquals(Response.Status.OK.getStatusCode(), reponse.getStatus());
- RestClient.isTest = false;
+ RestClient.setIsTest(false);
}
}