summaryrefslogtreecommitdiffstats
path: root/vnf-sdk-function-test/src/test/java/org/openo
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-02-14 17:41:22 +0530
committerMurali-P <murali.p@huawei.com>2017-02-14 17:41:22 +0530
commitd469ce9749074ceaa8d815947cb3f87a4817869e (patch)
tree4bd2de06bdf93f105047b81541aeea04994d7caf /vnf-sdk-function-test/src/test/java/org/openo
parentd3d950d789d09cabe6d6aa1eebb8adff58aabf27 (diff)
UT Test cases
Resolved:VNFSDK-21 Function test base code Change-Id: I1e7d41f917e21b2e8753898b727609cb37290c0c Signed-off-by: Murali-P <murali.p@huawei.com>
Diffstat (limited to 'vnf-sdk-function-test/src/test/java/org/openo')
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntityTest.java42
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java40
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java61
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java25
4 files changed, 168 insertions, 0 deletions
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntityTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntityTest.java
new file mode 100644
index 0000000..17b37a7
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntityTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.openo.vnfsdk.functest.externalservice.entity;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ServiceRegisterEntityTest {
+
+ private ServiceRegisterEntity serviceRegistry;
+
+ @Before
+ public void setUp() {
+ serviceRegistry = new ServiceRegisterEntity();
+ }
+
+ @Test
+ public void testSetSingleNode() {
+ serviceRegistry.setSingleNode("127.0.0.1", "80", 10);
+ }
+
+ @Test
+ public void testSetServiceName() {
+ serviceRegistry.setServiceName("nfvo");
+
+ }
+
+}
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java
new file mode 100644
index 0000000..b047633
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.openo.vnfsdk.functest.externalservice.msb;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openo.vnfsdk.functest.externalservice.entity.ServiceRegisterEntity;
+import org.openo.vnfsdk.functest.externalservice.msb.MicroserviceBusConsumer;
+import org.openo.vnfsdk.functest.externalservice.msb.MicroserviceBusRest;
+import org.powermock.api.mockito.PowerMockito;
+
+import com.eclipsesource.jaxrs.consumer.ConsumerFactory;
+
+public class MicroserviceBusConsumerTest {
+
+ @Test
+ public void testRegisterService() {
+ ServiceRegisterEntity entity = Mockito.mock(ServiceRegisterEntity.class);
+ Mockito.mock(MicroserviceBusRest.class);
+ Mockito.mock(ClientConfig.class);
+ PowerMockito.mockStatic(ConsumerFactory.class);
+ PowerMockito.mockStatic(MicroserviceBusConsumer.class);
+ MicroserviceBusConsumer.registerService(entity);
+ }
+}
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
new file mode 100644
index 0000000..97432b0
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/resource/CommonManagerTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.openo.vnfsdk.functest.resource;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class CommonManagerTest {
+
+ private CommonManager commonManger;
+
+ private String instanceId = "1234567";
+
+ @Before
+ public void setUp() {
+ commonManger = new CommonManager();
+ }
+
+ @Test
+ public void testexecuteFunc() throws FileNotFoundException {
+ InputStream mockInputStream = new FileInputStream(new File("src//test//resources//RobotScript.zip"));
+ Response response = commonManger.executeFuncTest(mockInputStream);
+ instanceId = response.getEntity().toString();
+ assertNotNull(instanceId);
+ }
+
+ @Test
+ public void testQueryResultWhenInstanceIdPresent() {
+ Response response = commonManger.queryResultByFuncTest(instanceId);
+ assertNotNull(response);
+ }
+
+ @Test
+ public void testQueryResultWhenInstanceIdAbsent() {
+ Response response = commonManger.queryResultByFuncTest("1234567");
+ assertNotNull(response);
+ }
+}
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java
new file mode 100644
index 0000000..b149812
--- /dev/null
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.openo.vnfsdk.functests;
+
+import org.openo.vnfsdk.functest.VnfSdkFuncTestApp;
+
+public class VnfSdkFuncTestAppTest {
+
+ VnfSdkFuncTestApp vnfSdkFuncTestApp;
+
+}