2 * Copyright (c) 2016, Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openo.nfvo.vnfmadapter.mocoserver;
19 import org.openo.sdno.testframework.http.model.HttpRequest;
20 import org.openo.sdno.testframework.http.model.HttpResponse;
21 import org.openo.sdno.testframework.http.model.HttpRquestResponse;
22 import org.openo.sdno.testframework.moco.MocoHttpServer;
23 import org.openo.sdno.testframework.moco.responsehandler.MocoResponseHandler;
31 * @version NFVO 0.5 Aug 2, 2016
33 public class VnfmAdapterSuccessServer extends MocoHttpServer {
35 private static final String GET_ALL_CLOUD_FILE =
36 "src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json";
38 private static final String ADD_AUTH_INFO_FILE =
39 "src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json";
41 private static final String GRANT_VNF_RES_FILE =
42 "src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json";
44 private static final String GET_CSAR_INFO_FILE =
45 "src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json";
47 private static final String GET_VNFM_INFO_FILE =
48 "src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json";
50 private static final String UPLOAD_VNF_INFO_FILE =
51 "src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json";
53 private static final String GET_VNFD_VER_FILE =
54 "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json";
56 private static final String GET_VNFD_PLAN_FILE =
57 "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json";
59 private static final String REMOVE_VNF_FILE =
60 "src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json";
62 private static final String GET_VNF_FILE =
63 "src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json";
65 private static final String GET_AUTH_INFO_FILE =
66 "src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json";
68 public VnfmAdapterSuccessServer() {
72 public VnfmAdapterSuccessServer(int port) {
77 public void addRequestResponsePairs() {
78 this.addRequestResponsePair(GET_ALL_CLOUD_FILE);
79 this.addRequestResponsePair(ADD_AUTH_INFO_FILE);
80 this.addRequestResponsePair(GRANT_VNF_RES_FILE);
81 this.addRequestResponsePair(GET_CSAR_INFO_FILE);
82 this.addRequestResponsePair(GET_VNFM_INFO_FILE);
83 this.addRequestResponsePair(UPLOAD_VNF_INFO_FILE);
84 this.addRequestResponsePair(GET_VNFD_VER_FILE);
85 this.addRequestResponsePair(GET_VNFD_PLAN_FILE);
86 this.addRequestResponsePair(REMOVE_VNF_FILE);
87 this.addRequestResponsePair(GET_VNF_FILE);
88 this.addRequestResponsePair(GET_AUTH_INFO_FILE);
91 private class CreateVimResponseHandler extends MocoResponseHandler {
94 public void processRequestandResponse(HttpRquestResponse httpObject) {
95 System.out.println("***********************");
96 System.out.println(httpObject);
97 System.out.println("***********************");
98 HttpRequest httpRequest = httpObject.getRequest();
99 HttpResponse httpResponse = httpObject.getResponse();