8554f7aeab27b003ea3be423f3f4c8401d9e540f
[vfc/nfvo/driver/vnfm/svnfm.git] /
1 /*
2  * Copyright (c) 2016, Huawei Technologies Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openo.nfvo.vnfmadapter.mocoserver;
18
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;
24
25 /**
26  * <br/>
27  * <p>
28  * </p>
29  * 
30  * @author
31  * @version NFVO 0.5 Aug 2, 2016
32  */
33 public class VnfmAdapterSuccessServer extends MocoHttpServer {
34
35     private static final String GET_ALL_CLOUD_FILE =
36             "src/integration-test/resources/vnfmadapter/mocoserver/getallcloudinfo.json";
37
38     private static final String ADD_AUTH_INFO_FILE =
39             "src/integration-test/resources/vnfmadapter/mocoserver/addauthinfo.json";
40
41     private static final String GRANT_VNF_RES_FILE =
42             "src/integration-test/resources/vnfmadapter/mocoserver/grantvnfresource.json";
43
44     private static final String GET_CSAR_INFO_FILE =
45             "src/integration-test/resources/vnfmadapter/mocoserver/getcsarinfo.json";
46
47     private static final String GET_VNFM_INFO_FILE =
48             "src/integration-test/resources/vnfmadapter/mocoserver/getvnfminfo.json";
49
50     private static final String UPLOAD_VNF_INFO_FILE =
51             "src/integration-test/resources/vnfmadapter/mocoserver/uploadvnfpackage.json";
52
53     private static final String GET_VNFD_VER_FILE =
54             "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdversion.json";
55
56     private static final String GET_VNFD_PLAN_FILE =
57             "src/integration-test/resources/vnfmadapter/mocoserver/getvnfdplaninfo.json";
58
59     private static final String REMOVE_VNF_FILE =
60             "src/integration-test/resources/vnfmadapter/mocoserver/removevnf.json";
61
62     private static final String GET_VNF_FILE =
63             "src/integration-test/resources/vnfmadapter/mocoserver/getvnf.json";
64
65     private static final String GET_AUTH_INFO_FILE =
66             "src/integration-test/resources/vnfmadapter/mocoserver/getauthinfo.json";
67
68     public VnfmAdapterSuccessServer() {
69         super();
70     }
71
72     public VnfmAdapterSuccessServer(int port) {
73         super(port);
74     }
75
76     @Override
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);
89     }
90
91     private class CreateVimResponseHandler extends MocoResponseHandler {
92
93         @Override
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();
100         }
101     }
102
103 }