summaryrefslogtreecommitdiffstats
path: root/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java
diff options
context:
space:
mode:
authorvictor.gao <victor.gao@huawei.com>2017-07-03 11:44:26 +0800
committervictor.gao <victor.gao@huawei.com>2017-07-03 11:44:26 +0800
commit7c9d941a80634d40d03f38c3f24ea503822d4b79 (patch)
tree247416f9c660e9eb2d05c71184fc3fe91bfe7160 /huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java
parent52543689bca23d9bd6b759a8dbf8f06bf61701f3 (diff)
Change: add OPEN-O seed code for VF-C
Change-Id: Iecacac039e86db2eae006c8947d6dd681e458b83 Signed-off-by: victor.gao <victor.gao@huawei.com>
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java103
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java61
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java60
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java61
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java60
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java61
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java60
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java68
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java69
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java49
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java44
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java53
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java65
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java163
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java46
15 files changed, 1023 insertions, 0 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java
new file mode 100644
index 00000000..8554f7ae
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/mocoserver/VnfmAdapterSuccessServer.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 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.vnfmadapter.mocoserver;
+
+import org.openo.sdno.testframework.http.model.HttpRequest;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.http.model.HttpRquestResponse;
+import org.openo.sdno.testframework.moco.MocoHttpServer;
+import org.openo.sdno.testframework.moco.responsehandler.MocoResponseHandler;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 2, 2016
+ */
+public class VnfmAdapterSuccessServer extends MocoHttpServer {
+
+ private static final String GET_ALL_CLOUD_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json";
+
+ private static final String ADD_AUTH_INFO_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json";
+
+ private static final String GRANT_VNF_RES_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json";
+
+ private static final String GET_CSAR_INFO_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json";
+
+ private static final String GET_VNFM_INFO_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json";
+
+ private static final String UPLOAD_VNF_INFO_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json";
+
+ private static final String GET_VNFD_VER_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json";
+
+ private static final String GET_VNFD_PLAN_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json";
+
+ private static final String REMOVE_VNF_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json";
+
+ private static final String GET_VNF_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json";
+
+ private static final String GET_AUTH_INFO_FILE =
+ "src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json";
+
+ public VnfmAdapterSuccessServer() {
+ super();
+ }
+
+ public VnfmAdapterSuccessServer(int port) {
+ super(port);
+ }
+
+ @Override
+ public void addRequestResponsePairs() {
+ this.addRequestResponsePair(GET_ALL_CLOUD_FILE);
+ this.addRequestResponsePair(ADD_AUTH_INFO_FILE);
+ this.addRequestResponsePair(GRANT_VNF_RES_FILE);
+ this.addRequestResponsePair(GET_CSAR_INFO_FILE);
+ this.addRequestResponsePair(GET_VNFM_INFO_FILE);
+ this.addRequestResponsePair(UPLOAD_VNF_INFO_FILE);
+ this.addRequestResponsePair(GET_VNFD_VER_FILE);
+ this.addRequestResponsePair(GET_VNFD_PLAN_FILE);
+ this.addRequestResponsePair(REMOVE_VNF_FILE);
+ this.addRequestResponsePair(GET_VNF_FILE);
+ this.addRequestResponsePair(GET_AUTH_INFO_FILE);
+ }
+
+ private class CreateVimResponseHandler extends MocoResponseHandler {
+
+ @Override
+ public void processRequestandResponse(HttpRquestResponse httpObject) {
+ System.out.println("***********************");
+ System.out.println(httpObject);
+ System.out.println("***********************");
+ HttpRequest httpRequest = httpObject.getRequest();
+ HttpResponse httpResponse = httpObject.getResponse();
+ }
+ }
+
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java
new file mode 100644
index 00000000..14469b29
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaFail.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.AddSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.FailureChecker;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 20, 2016
+ */
+public class ITAuthRoaFail extends MyTestManager {
+
+ private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfofail.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*30);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess1() throws ServiceException {
+ execTestCase(new File(POST_PATH),new FailureChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java
new file mode 100644
index 00000000..0393571e
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITAuthRoaSuccess.java
@@ -0,0 +1,60 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.AddSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 20, 2016
+ */
+public class ITAuthRoaSuccess extends MyTestManager {
+
+ private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/authroa/addauthinfosuccess.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*30);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess1() throws ServiceException {
+ execTestCase(new File(POST_PATH));
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java
new file mode 100644
index 00000000..8ef66b03
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaFail.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.FailureChecker;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+import org.openo.nfvo.vnfmadapter.util.SuccessChecker;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfAdapterResourceRoaFail extends MyTestManager {
+
+ private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfofail.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(31943);
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*30);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_PATH),new FailureChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java
new file mode 100644
index 00000000..64ad1275
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfAdapterResourceRoaSuccess.java
@@ -0,0 +1,60 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+import org.openo.nfvo.vnfmadapter.util.SuccessChecker;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfAdapterResourceRoaSuccess extends MyTestManager {
+
+ private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfadapterresourceroa/querygetallcloudinfosuccess.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer(31943);
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*30);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_PATH),new GetSuccessChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java
new file mode 100644
index 00000000..25aeaa67
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaFail.java
@@ -0,0 +1,61 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.FailureChecker;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+import org.openo.nfvo.vnfmadapter.util.SuccessChecker;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfResourceRoaFail extends MyTestManager {
+
+ private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcefail.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*60);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_PATH),new FailureChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java
new file mode 100644
index 00000000..549ae1ca
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfResourceRoaSuccess.java
@@ -0,0 +1,60 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+import org.openo.nfvo.vnfmadapter.util.SuccessChecker;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfResourceRoaSuccess extends MyTestManager {
+
+ private static final String GET_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfresourceroa/grantvnfresourcesuccess.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*60);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_PATH),new GetSuccessChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java
new file mode 100644
index 00000000..784aa9df
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaFail.java
@@ -0,0 +1,68 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.FailureChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfRoaFail extends MyTestManager {
+
+ private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnffail.json";
+
+ private static final String DEL_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnffail.json";
+
+ private static final String GET_VNF_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnffail.json";
+
+ private static final String GET_JOB_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobfail.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*30);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_VNF_PATH),new FailureChecker());
+ execTestCase(new File(POST_PATH),new FailureChecker());
+ execTestCase(new File(GET_JOB_PATH),new FailureChecker());
+ execTestCase(new File(DEL_PATH),new FailureChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java
new file mode 100644
index 00000000..b2109e1f
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/test/ITVnfRoaSuccess.java
@@ -0,0 +1,69 @@
+/*
+ * 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.vnfmadapter.test;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.nfvo.vnfmadapter.mocoserver.VnfmAdapterSuccessServer;
+import org.openo.nfvo.vnfmadapter.util.GetSuccessChecker;
+import org.openo.nfvo.vnfmadapter.util.MyTestManager;
+import org.openo.nfvo.vnfmadapter.util.SuccessChecker;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 24, 2016
+ */
+public class ITVnfRoaSuccess extends MyTestManager {
+
+ private static final String POST_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/addvnfsuccess.json";
+
+ private static final String DEL_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/deletevnfsuccess.json";
+
+ private static final String GET_VNF_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getvnfsuccess.json";
+
+ private static final String GET_JOB_PATH = "src/integration-test/resources/vnfmadapter/testcase/vnfroa/getjobsuccess.json";
+
+ private VnfmAdapterSuccessServer vnfmAdapterServer = new VnfmAdapterSuccessServer();
+
+
+ @Before
+ public void setup() throws ServiceException, InterruptedException {
+ vnfmAdapterServer.start();
+// Thread.sleep(1000*60);
+ }
+
+ @After
+ public void tearDown() throws ServiceException {
+ vnfmAdapterServer.stop();
+ }
+
+ @Test
+ public void testOperateSuccess() throws ServiceException {
+ execTestCase(new File(GET_VNF_PATH),new GetSuccessChecker());
+// execTestCase(new File(POST_PATH),new GetSuccessChecker());
+ execTestCase(new File(GET_JOB_PATH),new GetSuccessChecker());
+ execTestCase(new File(DEL_PATH),new GetSuccessChecker());
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java
new file mode 100644
index 00000000..ea0dc396
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/AddSuccessChecker.java
@@ -0,0 +1,49 @@
+/*
+ * 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.vnfmadapter.util;
+
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 21, 2016
+ */
+public class AddSuccessChecker implements IChecker {
+
+ String addMsg = "org.openo.nfvo.resmanage.common.update.success";
+
+ @Override
+ public boolean check(HttpResponse response) {
+ System.out.println("====================");
+ System.out.println(response);
+ String data = response.getData();
+ System.out.println("********************");
+ System.out.println(data);
+// JSONObject dataObj = JSONObject.fromObject(data);
+ if(response.getStatus() == 201 && data != null && !data.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java
new file mode 100644
index 00000000..f1b8f248
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/FailureChecker.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 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.vnfmadapter.util;
+
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 16, 2016
+ */
+public class FailureChecker implements IChecker {
+
+ @Override
+ public boolean check(HttpResponse response) {
+ String data = response.getData();
+ if(response.getStatus() != 200) {
+ return true;
+ }
+ JSONObject dataObj = JSONObject.fromObject(data);
+ int retCode = (int)dataObj.get("retCode");
+ return retCode == -1;
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java
new file mode 100644
index 00000000..37856822
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/GetSuccessChecker.java
@@ -0,0 +1,53 @@
+/*
+ * 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.vnfmadapter.util;
+
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 21, 2016
+ */
+public class GetSuccessChecker implements IChecker {
+
+ String addMsg = "org.openo.nfvo.resmanage.common.add.success";
+
+ @Override
+ public boolean check(HttpResponse response) {
+ System.out.println("====================");
+ System.out.println(response);
+ String data = response.getData();
+ System.out.println("********************");
+ System.out.println(data);
+// JSONObject dataObj = JSONObject.fromObject(data);
+// if(response.getStatus() == 200 && !dataObj.isEmpty()) {
+// System.out.println(dataObj.isEmpty());
+// return true;
+// }
+ if(response.getStatus() == 200 && data != null && !data.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java
new file mode 100644
index 00000000..6ff60919
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyChecker.java
@@ -0,0 +1,65 @@
+/*
+ * 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.vnfmadapter.util;
+
+import org.openo.sdno.testframework.checker.DefaultChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 21, 2016
+ */
+public class MyChecker extends DefaultChecker {
+
+ private HttpResponse expectedResponse;
+
+ /**
+ * Constructor<br>
+ * <p>
+ * </p>
+ *
+ * @param expectedResponse
+ * @since NFVO 0.5
+ */
+ public MyChecker(HttpResponse expectedResponse) {
+ super(expectedResponse);
+ this.expectedResponse = expectedResponse;
+ }
+
+ /**
+ * <br>
+ *
+ * @param response
+ * @return
+ * @since NFVO 0.5
+ */
+ @Override
+ public boolean check(HttpResponse response) {
+ System.out.println("expectedResponse:");
+ System.out.println(expectedResponse.getData());
+ System.out.println("response:");
+ System.out.println(JSONObject.fromObject(response.getData()));
+ return (JSONObject.fromObject(expectedResponse.getData())).equals(JSONObject.fromObject(response.getData()));
+ }
+
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java
new file mode 100644
index 00000000..aa866bb3
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/MyTestManager.java
@@ -0,0 +1,163 @@
+/*
+ * 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.vnfmadapter.util;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.openo.baseservice.roa.util.restclient.RestfulParametes;
+import org.openo.baseservice.roa.util.restclient.RestfulResponse;
+import org.openo.sdno.testframework.checker.DefaultChecker;
+import org.openo.sdno.testframework.http.model.HttpModelUtils;
+import org.openo.sdno.testframework.http.model.HttpRequest;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+import org.openo.sdno.testframework.http.model.HttpRquestResponse;
+import org.openo.sdno.testframework.restclient.HttpRestClient;
+import org.openo.sdno.testframework.testmanager.TestManager;
+import org.openo.sdno.testframework.util.file.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Sep 21, 2016
+ */
+public class MyTestManager extends TestManager {
+
+ private HttpRestClient restClient;
+
+ public MyTestManager() {
+ restClient = new HttpRestClient();
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MyTestManager.class);
+
+ /**
+ * <br>
+ *
+ * @param file
+ * @return
+ * @throws ServiceException
+ * @since NFVO 0.5
+ */
+ @Override
+ public HttpResponse execTestCase(File file) throws ServiceException {
+ String content = FileUtils.readFromJson(file);
+ HttpRquestResponse httpObject = HttpModelUtils.praseHttpRquestResponse(content);
+ return send(httpObject.getRequest(), httpObject.getResponse());
+ }
+
+ private HttpResponse send(HttpRequest request, HttpResponse response) {
+ try {
+ RestfulResponse responseResult = doSend(request);
+ DefaultChecker checker = new MyChecker(response);
+ HttpResponse httpResponse = HttpModelUtils.convertResponse(responseResult);
+ Assert.assertEquals(Boolean.valueOf(checker.check(httpResponse)), Boolean.valueOf(true));
+ return httpResponse;
+ } catch(ServiceException e) {
+ LOGGER.error("call the restful interface failed.", e);
+ }
+ return null;
+ }
+
+ private RestfulResponse doSend(HttpRequest request) throws ServiceException {
+ String url = request.getUri();
+ String method = request.getMethod();
+ String body = request.getData();
+ RestfulParametes restfulParametes = new RestfulParametes();
+ Map requestHeaders = request.getHeaders();
+ if(null != requestHeaders) {
+ java.util.Map.Entry curEntity;
+ for(Iterator iterator = requestHeaders.entrySet().iterator(); iterator.hasNext(); restfulParametes
+ .putHttpContextHeader((String)curEntity.getKey(), (String)curEntity.getValue()))
+ curEntity = (java.util.Map.Entry)iterator.next();
+
+ }
+ Map paramMap = request.getQueries();
+ if(null != paramMap)
+ restfulParametes.setParamMap(paramMap);
+ if(null != body)
+ restfulParametes.setRawData(body);
+ return callRestfulMotheds(url, method, restfulParametes);
+ }
+
+ private RestfulResponse callRestfulMotheds(String url, String method, RestfulParametes restfulParametes)
+ throws ServiceException {
+ String s = method;
+ byte byte0 = -1;
+ switch(s.hashCode()) {
+ case 3446944:
+ if(s.equals("post"))
+ byte0 = 0;
+ break;
+
+ case 102230:
+ if(s.equals("get"))
+ byte0 = 1;
+ break;
+
+ case 111375:
+ if(s.equals("put"))
+ byte0 = 2;
+ break;
+
+ case -1335458389:
+ if(s.equals("delete"))
+ byte0 = 3;
+ break;
+
+ case 3198432:
+ if(s.equals("head"))
+ byte0 = 4;
+ break;
+
+ case 106438728:
+ if(s.equals("patch"))
+ byte0 = 5;
+ break;
+ }
+ switch(byte0) {
+ case 0: // '\0'
+ return restClient.post(url, restfulParametes);
+
+ case 1: // '\001'
+ return restClient.get(url, restfulParametes);
+
+ case 2: // '\002'
+ return restClient.put(url, restfulParametes);
+
+ case 3: // '\003'
+ return restClient.delete(url, restfulParametes);
+
+ case 4: // '\004'
+ return restClient.head(url, restfulParametes);
+
+ case 5: // '\005'
+ return restClient.patch(url, restfulParametes);
+ }
+ LOGGER.error("The method is unsupported.");
+ throw new ServiceException("The method is unsupported.");
+ }
+
+}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java
new file mode 100644
index 00000000..dcb40c8a
--- /dev/null
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/integration-test/java/org/openo/nfvo/vnfmadapter/util/SuccessChecker.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 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.vnfmadapter.util;
+
+import org.openo.sdno.testframework.checker.IChecker;
+import org.openo.sdno.testframework.http.model.HttpResponse;
+
+import net.sf.json.JSONObject;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version NFVO 0.5 Aug 16, 2016
+ */
+public class SuccessChecker implements IChecker {
+
+ String addMsg = "org.openo.nfvo.resmanage.common.add.success";
+
+ @Override
+ public boolean check(HttpResponse response) {
+ String data = response.getData();
+ System.out.println(data);
+ JSONObject dataObj = JSONObject.fromObject(data);
+ if(response.getStatus() == 200 && addMsg.equals(dataObj.getString("msg"))) {
+ return true;
+ }
+ return false;
+ }
+}