diff options
author | Fu Jinhua <fu.jinhua@zte.com.cn> | 2017-09-27 05:00:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-27 05:00:10 +0000 |
commit | c4fe44aaa88458d96e628db4fc755c2723c0dcbe (patch) | |
tree | 792f229cd47c11fdc44565b345e80bf03c4f5217 /wfenginemgrservice/src | |
parent | 237281441a22315269d5c56b89c5f22073aba885 (diff) | |
parent | 42a0c09c5b593f64852b7cedc193657ddd6c2470 (diff) |
Merge "Add unit test for vfc-nfvo-wfengine"
Diffstat (limited to 'wfenginemgrservice/src')
10 files changed, 707 insertions, 0 deletions
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java new file mode 100644 index 0000000..27c3ddc --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java @@ -0,0 +1,100 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.workflow.common; + +import static org.powermock.api.mockito.PowerMockito.mock; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpRequest; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.onap.workflow.common.RestClient; +import org.onap.workflow.common.RestClient.HttpMethod; +import org.onap.workflow.externalservice.entity.activitientitiy.ActivitiStartProcessRequest; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + + +@PrepareForTest({RestClient.class, HttpClients.class}) +@RunWith(PowerMockRunner.class) +@PowerMockIgnore("javax.net.ssl.*") +public class RestClientTest { + private RestClient restClient; + @Before + public void setUp() throws Exception { + restClient = new RestClient(); + } + + @After + public void tearDown() throws Exception {} + + @Test + public final void testExecuteHttp() throws Exception { + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + + restClient.executeHttp(HttpMethod.POST, "127.0.0.1", 80, "test", httpEntity); + } + + @Test + public final void testExecuteHttpDeleteDeploy() throws Exception { + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + restClient.executeHttpDeleteDeploy(HttpMethod.DELETE, "127.0.0.1", 80, "test"); + } + + @Test + public final void testExecuteHttpStartIntance() throws Exception { + + ActivitiStartProcessRequest activitiStartProcessRequest = + mock(ActivitiStartProcessRequest.class); + + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + restClient.executeHttpStartIntance(HttpMethod.POST, "127.0.0.1", 80, "test",activitiStartProcessRequest); + + } +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java new file mode 100644 index 0000000..e2d91f4 --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java @@ -0,0 +1,59 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ActivitiServiceConsumerTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception {} + + @After + public void tearDown() throws Exception {} + + @Test + public void testUndeploybpmnfile() { + } + + @Test + public void testStartBpmnProcess() { + } + + @Test + public void testDeleteDeployProcess() { + } + + @Test + public void testStartProcess() { + } + + @Test + public void testDeploybpmnfile() { + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/EnumModuleUrlTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/EnumModuleUrlTest.java new file mode 100644 index 0000000..837a8bf --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/EnumModuleUrlTest.java @@ -0,0 +1,55 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.workflow.common.EnumModuleUrl; + +public class EnumModuleUrlTest { + + + private EnumModuleUrl enumModuleUrl; + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception {} + + @Test + public final void testGetApiRootDomain() { + // enumModuleUrl.getApiRootDomain(); + + } + + @Test + public final void testGetBaseUrl() { + // enumModuleUrl.getApiRootDomain(); + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java new file mode 100644 index 0000000..81d63d5 --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java @@ -0,0 +1,106 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.powermock.api.mockito.PowerMockito.mock; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpRequest; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.onap.workflow.common.RestClient; +import org.onap.workflow.common.RestClient.HttpMethod; +import org.onap.workflow.externalservice.entity.activitientitiy.ActivitiStartProcessRequest; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + + +@PrepareForTest({RestClient.class, HttpClients.class}) +@RunWith(PowerMockRunner.class) +@PowerMockIgnore("javax.net.ssl.*") +public class RestClientTest { + private RestClient restClient; + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + restClient = new RestClient(); + + } + + @After + public void tearDown() throws Exception {} + + @Test + public final void testExecuteHttp() throws Exception { + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + restClient.executeHttp(HttpMethod.POST, "127.0.0.1", 80, "test", httpEntity); + } + + @Test + public final void testExecuteHttpDeleteDeploy() throws Exception { + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + restClient.executeHttpDeleteDeploy(HttpMethod.DELETE, "127.0.0.1", 80, "test"); + } + + @Test + public final void testExecuteHttpStartIntance() throws Exception { + + ActivitiStartProcessRequest activitiStartProcessRequest = + mock(ActivitiStartProcessRequest.class); + + HttpEntity httpEntity = mock(HttpEntity.class); + PowerMockito.mockStatic(HttpClients.class); + CloseableHttpClient tt = mock(CloseableHttpClient.class); + CloseableHttpResponse reponse = mock(CloseableHttpResponse.class); + PowerMockito.when(HttpClients.createDefault()).thenReturn(tt); + PowerMockito.when(tt.execute(Mockito.any(HttpHost.class), Mockito.any(HttpRequest.class))) + .thenReturn(reponse); + PowerMockito.when(reponse.getEntity()).thenReturn(httpEntity); + restClient.executeHttpStartIntance(HttpMethod.POST, "127.0.0.1", 80, "test",activitiStartProcessRequest); + + } +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java new file mode 100644 index 0000000..f79df4a --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java @@ -0,0 +1,46 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class RestClientUtilsTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception {} + + @After + public void tearDown() throws Exception {} + + @Test + public void testBuildMultipartRequest() { + //fail("Not yet implemented"); + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java new file mode 100644 index 0000000..18ee21a --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java @@ -0,0 +1,43 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.junit.Assert.*; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class RestResponseTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception {} + + @After + public void tearDown() throws Exception {} + + + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java new file mode 100644 index 0000000..bdc11c1 --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java @@ -0,0 +1,68 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.onap.workflow.activitiext.common.ToolUtil; + +/** + * @author 10175158 + * + */ +public class ToolUtilTest { + + @InjectMocks + private ToolUtil toolUtil; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception {} + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception {} + + @SuppressWarnings("static-access") + @Test + public void test() { + toolUtil.isEmptyString(null); + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java new file mode 100644 index 0000000..4a523d9 --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java @@ -0,0 +1,57 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.workflow.entity.MsbClientConfig; + +public class WorkflowAppConfigTest { + + private MsbClientConfig msbClientConfig; + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + msbClientConfig = new MsbClientConfig(); + } + + @After + public void tearDown() throws Exception {} + + @Test + public final void testGetMsbClientConfig() { + msbClientConfig.getMsbSvrIp(); + // assertTrue("true", 1 == 1); + } + + + @Test + public final void testSetMsbClientConfig() { + msbClientConfig.setMsbSvrIp("127.0.0.1"); + // assertTrue("true", 1 == 1); + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppTest.java new file mode 100644 index 0000000..56c5dc6 --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppTest.java @@ -0,0 +1,72 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.powermock.api.mockito.PowerMockito.mock; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.workflow.WorkflowApp; +import org.onap.workflow.WorkflowAppConfig; + +import io.dropwizard.setup.Environment; + +public class WorkflowAppTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + private WorkflowApp workflowApp; + private WorkflowAppConfig workflowAppConfig; + private Environment environment; + + @Before + public void setUp() throws Exception { + workflowAppConfig = mock(WorkflowAppConfig.class); + environment = mock(Environment.class); + workflowApp = mock(WorkflowApp.class); + } + + @After + public void tearDown() throws Exception {} + + @Test + public void testMain() { + + } + + @Test + public void testGetName() { + workflowApp.getName(); + } + + @Test + public void testRunWorkflowAppConfigEnvironment() { + try { + workflowApp.run(workflowAppConfig, environment); + } catch (Exception e) { + + } + } + +} diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java new file mode 100644 index 0000000..205785b --- /dev/null +++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java @@ -0,0 +1,101 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.workflow.resources; + +import static org.powermock.api.mockito.PowerMockito.mock; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.workflow.common.RestResponse; +import org.onap.workflow.entity.StartProcessRequest; +import org.onap.workflow.externalservice.entity.activitientitiy.ActivitiDeployResponse; +import org.onap.workflow.externalservice.entity.activitientitiy.ActivitiStartProcessRequest; +import org.onap.workflow.externalservice.service.activitiservice.ActivitiServiceConsumer; +import org.onap.workflow.wrapper.WorkflowInstanceWrapper; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +@PrepareForTest({ActivitiServiceConsumer.class}) +@RunWith(PowerMockRunner.class) +public class WorkflowInstanceWrapperTest { + + private WorkflowInstanceWrapper workflowInstanceWrapper; + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Before + public void setUp() throws Exception { + workflowInstanceWrapper = new WorkflowInstanceWrapper(); + PowerMockito.mockStatic(ActivitiServiceConsumer.class);// 3 + } + + @After + public void tearDown() throws Exception {} + + @Test + public final void testGetInstance() { + // fail("Not yet implemented"); // TODO + } + + @Test + public final void testDeployBpmnFile() throws Exception { + + InputStream fileInputStream = mock(InputStream.class); + FormDataContentDisposition f = mock(FormDataContentDisposition.class); + String filename = "test"; + ActivitiDeployResponse reponse = new ActivitiDeployResponse(); + reponse.setId("123"); + reponse.setUrl("http://url"); + PowerMockito.mockStatic(ActivitiServiceConsumer.class); + PowerMockito.when(ActivitiServiceConsumer.deploybpmnfile(fileInputStream, filename)) + .thenReturn(reponse); + workflowInstanceWrapper.deployBpmnFile(filename, fileInputStream, f); + // assertThat(, is(result)); + } + + @Test + public final void testUndeployBpmnFile() { + + } + + @Test + public final void testStartProcess() throws Exception { + ActivitiStartProcessRequest startProcessRequest = new ActivitiStartProcessRequest(); + startProcessRequest.setProcessDefinitionKey("first"); + StartProcessRequest tt = new StartProcessRequest(); + tt.setProcessDefinitionKey("first"); + RestResponse reponse = new RestResponse(); + reponse.setResult("123"); + PowerMockito.mockStatic(ActivitiServiceConsumer.class); + PowerMockito.when(ActivitiServiceConsumer.startBpmnProcess(startProcessRequest)) + .thenReturn(reponse); + workflowInstanceWrapper.startProcess(tt); + } + +} |