summaryrefslogtreecommitdiffstats
path: root/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java
diff options
context:
space:
mode:
Diffstat (limited to 'juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java')
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java92
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java84
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties29
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json16
-rw-r--r--juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json18
9 files changed, 371 insertions, 0 deletions
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java
new file mode 100644
index 0000000..1495ad9
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITConfigRoaTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016 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.nfvo.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITConfigRoaTest extends TestManager {
+ private static final String GET_SUCCESS_PATH = "testcase/configroa/setDebugModelTestSuccess.json";
+ private static final String GET_FAIL_PATH = "testcase/configroa/setDebugModelTestFail.json";
+
+ @Test
+ public void setDebugModelTestSuccess() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_SUCCESS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+ @Test
+ public void setDebugModelTestFail() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_FAIL_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status != 200){
+ return true;
+ }
+ return false;
+ }
+
+ });
+ }
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java
new file mode 100644
index 0000000..363e85e
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITJujuClientRoaTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016 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.nfvo.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.jujuvnfmadapter.common.EntityUtils;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITJujuClientRoaTest extends TestManager {
+ private static final String GETVNFSTATUS_PATH = "testcase/jujuclientroa/getVnfStatus.json";
+ private static final String DEPLOYSERIVCE_PATH = "testcase/jujuclientroa/deploySerivce.json";
+// private static final String GETVNFSTATUS_PATH = "testcase/jujuclientroa/getVnfStatus.json";
+
+ @Test
+ public void getVnfStatus() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GETVNFSTATUS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertEquals(dataObj.get(EntityUtils.RESULT_CODE_KEY),"0");
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+
+ @Test
+ public void deploySerivce() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+DEPLOYSERIVCE_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java
new file mode 100644
index 0000000..bb5ff7d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/org/openo/nfvo/jujuvnfmadapter/service/rest/ITVnfRoaTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2016 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.nfvo.jujuvnfmadapter.service.rest;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.testmanager.TestManager;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author quanzhong@huawei.com
+ * @version NFVO 0.5 Sep 29, 2016
+ */
+public class ITVnfRoaTest extends TestManager {
+ private static final String GET_SUCCESS_PATH = "testcase/configroa/setDebugModelTestSuccess.json";
+ private static final String GET_FAIL_PATH = "testcase/configroa/setDebugModelTestFail.json";
+
+ @Test
+ public void addVnfTestSuccess() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_SUCCESS_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status == 200){
+ String data = paramHttpResponse.getData();
+ JSONObject dataObj = JSONObject.fromObject(data);
+ Assert.assertNotNull(dataObj);
+ return true;
+ }
+
+ return false;
+ }
+
+ });
+ }
+ @Test
+ public void addVnfTestFail() throws ServiceException{
+ execTestCase(new File(getClassPath()+File.separator+GET_FAIL_PATH), new IChecker(){
+
+ @Override
+ public boolean check(HttpResponse paramHttpResponse) {
+ int status = paramHttpResponse.getStatus();
+ if(status != 200){
+ return true;
+ }
+ return false;
+ }
+
+ });
+ }
+
+ public static String getClassPath(){
+ String path = ClassLoader.getSystemClassLoader().getResource("./").getPath();
+ if(path.endsWith("/")){
+ path = path.substring(0, path.length()-1);
+ }
+ return path;
+ }
+}
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties
new file mode 100644
index 0000000..55d99f6
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/server.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# Copyright 2016 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.
+###############################################################################
+
+## Integration Test Server Configuration File
+
+## Server IpAddress
+serverip=127.0.0.1
+
+## Server Port
+serverport=8080
+
+## Http Moco Server Port
+mocohttpport=12306
+
+## Https Moco Server Port
+mocohttpsport=12307 \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json
new file mode 100644
index 0000000..258a256
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestFail.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config/debug/1r",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ }
+ },
+ "response": {
+ "status": 500,
+ "json": {
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json
new file mode 100644
index 0000000..2ba2bc4
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/configroa/setDebugModelTestSuccess.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/config",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json
new file mode 100644
index 0000000..e9f9b4d
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/deploySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/deploy",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {"appName":"testApp"}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json
new file mode 100644
index 0000000..5a978a2
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/destroySerivce.json
@@ -0,0 +1,16 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/",
+ "method": "get",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {}
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file
diff --git a/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json
new file mode 100644
index 0000000..1b07b65
--- /dev/null
+++ b/juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/integration-test/java/testcase/jujuclientroa/getVnfStatus.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "uri": "/juju-vnfmadapter-service/rest/openoapi/juju/v1/vnfms/testabc/status",
+ "method": "post",
+ "headers": {
+ "Content-Type": "application/json;charset=UTF-8"
+ },
+ "json": {
+ "appName":"testApp"
+ }
+ },
+ "response": {
+ "status": 200,
+ "json": {
+ "debugModel":false
+ }
+ }
+} \ No newline at end of file