summaryrefslogtreecommitdiffstats
path: root/wfenginemgrservice/src/test/java
diff options
context:
space:
mode:
authorZhaoxing <meng.zhaoxing1@zte.com.cn>2017-09-28 17:04:44 +0800
committerFu Jinhua <fu.jinhua@zte.com.cn>2017-09-28 09:16:41 +0000
commit687a149af6ff59fba9e614e060a598392b68db6b (patch)
tree018b99dc2c64ec32e53d6968fa679369a399ce82 /wfenginemgrservice/src/test/java
parentca57c4bc2ce48c52f10bf6ef816492cf044430e0 (diff)
Add unit test for vfc-nfvo-wfengine
Change-Id: I75acdc20d9aa6ccb650b80d93c675bab7c27dca9 Issue-id: VFC-454 Signed-off-by: Zhaoxing <meng.zhaoxing1@zte.com.cn>
Diffstat (limited to 'wfenginemgrservice/src/test/java')
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java6
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/common/ToolUtilTest.java (renamed from wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java)36
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java59
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/EnumModuleUrlTest.java55
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java4
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java58
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java57
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppTest.java72
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java12
-rw-r--r--wfenginemgrservice/src/test/java/org/onap/workflow/tools/RequestParametersTest.java (renamed from wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java)33
10 files changed, 50 insertions, 342 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
index 27c3ddc..418cff6 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/common/RestClientTest.java
@@ -24,13 +24,10 @@ 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;
@@ -52,6 +49,7 @@ public class RestClientTest {
@After
public void tearDown() throws Exception {}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttp() throws Exception {
HttpEntity httpEntity = mock(HttpEntity.class);
@@ -67,6 +65,7 @@ public class RestClientTest {
restClient.executeHttp(HttpMethod.POST, "127.0.0.1", 80, "test", httpEntity);
}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttpDeleteDeploy() throws Exception {
HttpEntity httpEntity = mock(HttpEntity.class);
@@ -80,6 +79,7 @@ public class RestClientTest {
restClient.executeHttpDeleteDeploy(HttpMethod.DELETE, "127.0.0.1", 80, "test");
}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttpStartIntance() throws Exception {
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/common/ToolUtilTest.java
index 18ee21a..2c6e175 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestResponseTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/common/ToolUtilTest.java
@@ -13,31 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.onap.workflow.common;
-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.Assert;
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 {}
-
-
-
+/**
+ * @author 10175158
+ *
+ */
+public class ToolUtilTest {
+ @Test
+ public void testgetHeader() {
+ String actual = "Basic a2VybWl0Omtlcm1pdA==";
+ Assert.assertEquals(actual, ToolUtil.getHeader());
+ }
}
+
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java
deleted file mode 100644
index e2d91f4..0000000
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ActivitiServiceConsumerTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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
deleted file mode 100644
index 837a8bf..0000000
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/EnumModuleUrlTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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
index 81d63d5..40f5793 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientTest.java
@@ -13,7 +13,6 @@
* 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;
@@ -60,6 +59,7 @@ public class RestClientTest {
@After
public void tearDown() throws Exception {}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttp() throws Exception {
HttpEntity httpEntity = mock(HttpEntity.class);
@@ -73,6 +73,7 @@ public class RestClientTest {
restClient.executeHttp(HttpMethod.POST, "127.0.0.1", 80, "test", httpEntity);
}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttpDeleteDeploy() throws Exception {
HttpEntity httpEntity = mock(HttpEntity.class);
@@ -86,6 +87,7 @@ public class RestClientTest {
restClient.executeHttpDeleteDeploy(HttpMethod.DELETE, "127.0.0.1", 80, "test");
}
+ @SuppressWarnings("static-access")
@Test
public final void testExecuteHttpStartIntance() 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
index bdc11c1..c479085 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/ToolUtilTest.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2016-2017 ZTE Corporation.
+ * 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.
@@ -13,17 +13,11 @@
* 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.Assert;
import org.junit.Test;
-import org.mockito.InjectMocks;
import org.onap.workflow.activitiext.common.ToolUtil;
/**
@@ -31,38 +25,26 @@ import org.onap.workflow.activitiext.common.ToolUtil;
*
*/
public class ToolUtilTest {
+ @Test
+ public void testIsEmptyString() {
+ Assert.assertEquals(true, ToolUtil.isEmptyString(null));
+ Assert.assertEquals(true, ToolUtil.isEmptyString(""));
+ Assert.assertEquals(false, ToolUtil.isEmptyString("test"));
+ }
- @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);
+ public void testisTrimedEmptyString() {
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyString(null));
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyString(""));
+ Assert.assertEquals(false, ToolUtil.isTrimedEmptyString("test"));
}
+ @Test
+ public void testisTrimedEmptyArray() {
+ String[] originArray = new String[1];
+ originArray[0] = "122";
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyArray(null));
+ Assert.assertEquals(true, ToolUtil.isTrimedEmptyArray(new String[0]));
+ Assert.assertEquals(false, ToolUtil.isTrimedEmptyArray(originArray));
+ }
}
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java
deleted file mode 100644
index 4a523d9..0000000
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppConfigTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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
deleted file mode 100644
index 56c5dc6..0000000
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowAppTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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
index 205785b..0d08427 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/resources/WorkflowInstanceWrapperTest.java
@@ -13,7 +13,6 @@
* 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;
@@ -59,13 +58,8 @@ public class WorkflowInstanceWrapperTest {
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";
@@ -80,8 +74,8 @@ public class WorkflowInstanceWrapperTest {
}
@Test
- public final void testUndeployBpmnFile() {
-
+ public final void testUndeployBpmnFile() throws Exception {
+ WorkflowInstanceWrapper.getInstance().undeployBpmnFile(null);
}
@Test
diff --git a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java b/wfenginemgrservice/src/test/java/org/onap/workflow/tools/RequestParametersTest.java
index f79df4a..782ee84 100644
--- a/wfenginemgrservice/src/test/java/org/onap/workflow/resources/RestClientUtilsTest.java
+++ b/wfenginemgrservice/src/test/java/org/onap/workflow/tools/RequestParametersTest.java
@@ -13,34 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package org.onap.workflow.tools;
-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 {}
-
+/**
+ *
+ */
+public class RequestParametersTest {
@Test
- public void testBuildMultipartRequest() {
- //fail("Not yet implemented");
+ public void testToString(){
+ RequestParameters result = new RequestParameters();
+ result.toString();
}
-
}