Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / onap / so / bpmn / common / MockAAIGenericVnfSearch.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.bpmn.common;
22
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
24 import static com.github.tomakehurst.wiremock.client.WireMock.get;
25 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
26 import com.github.tomakehurst.wiremock.WireMockServer;
27
28 public class MockAAIGenericVnfSearch {
29
30     private static final String EOL = "\n";
31
32     public MockAAIGenericVnfSearch(WireMockServer wireMockServer) {
33         String body;
34
35         // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
36
37         wireMockServer.stubFor(
38                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
39                         .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
40                                 .withBodyFile("aaiFault.xml")));
41
42         wireMockServer.stubFor(
43                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
44                         .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
45                                 .withBody("Generic VNF Not Found")));
46         wireMockServer.stubFor(get(urlMatching(
47                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
48                         .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
49                                 .withBody("Generic VNF Not Found")));
50
51         body = "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL
52                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
53                 + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
54                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
55                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
56                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
57                 + "  <resource-version>1508691</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
58                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
59                 + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
60                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
61                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
62                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
63                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
64                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
65                 + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
66                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
67                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
68         wireMockServer.stubFor(
69                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
70                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
71         wireMockServer.stubFor(get(urlMatching(
72                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
73                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
74
75         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
76                 + "  <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL
77                 + "  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
78                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
79                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
80                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
81                 + "  <resource-version>1508691</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
82                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
83                 + "      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
84                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
85                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
86                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
87                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
88                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
89                 + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
90                 + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>"
91                 + EOL + "      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
92                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
93                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
94                 + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
95                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
96                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
97                 + "      <resource-version>1508692</resource-version>" + EOL + "    </vf-module>" + EOL
98                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
99                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
100         wireMockServer.stubFor(
101                 get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
102                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
103         wireMockServer.stubFor(get(urlMatching(
104                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
105                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
106
107         // The following stubs are for DeleteAAIVfModule
108
109         wireMockServer.stubFor(get(urlMatching(
110                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
111                         .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
112                                 .withBodyFile("aaiFault.xml")));
113
114         wireMockServer.stubFor(get(urlMatching(
115                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
116                         .willReturn(aResponse().withStatus(404).withHeader("Content-Type", "text/xml")
117                                 .withBody("Generic VNF Not Found")));
118
119         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
120                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
121                 + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
122                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
123                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
124                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
125                 + "  <resource-version>0000021</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
126                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
127                 + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
128                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
129                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
130                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
131                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
132                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
133                 + "      <resource-version>0000073</resource-version>" + EOL + "    </vf-module>" + EOL
134                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
135                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
136         wireMockServer.stubFor(get(urlMatching(
137                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
138                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
139
140         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
141                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL
142                 + "  <vnf-name>STMTN5MMSC20</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
143                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
144                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
145                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
146                 + "  <resource-version>0000020</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
147                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL
148                 + "      <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL
149                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL
150                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
151                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
152                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
153                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
154                 + "      <resource-version>0000074</resource-version>" + EOL + "    </vf-module>" + EOL
155                 + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>"
156                 + EOL + "      <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL
157                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL
158                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
159                 + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
160                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
161                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
162                 + "      <resource-version>0000075</resource-version>" + EOL + "    </vf-module>" + EOL
163                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
164                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
165         wireMockServer.stubFor(get(urlMatching(
166                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
167                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
168
169         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
170                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL
171                 + "  <vnf-name>STMTN5MMSC19</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
172                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
173                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
174                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
175                 + "  <resource-version>0000019</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
176                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL
177                 + "      <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL
178                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL
179                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
180                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
181                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
182                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
183                 + "      <resource-version>0000076</resource-version>" + EOL + "    </vf-module>" + EOL
184                 + "    <vf-module>" + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>"
185                 + EOL + "      <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL
186                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL
187                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
188                 + "      <is-base-vf-module>false</is-base-vf-module>" + EOL
189                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
190                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
191                 + "      <resource-version>0000077</resource-version>" + EOL + "    </vf-module>" + EOL
192                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
193                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
194         wireMockServer.stubFor(get(urlMatching(
195                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
196                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
197
198         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
199                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL
200                 + "  <vnf-name>STMTN5MMSC18</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
201                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
202                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
203                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
204                 + "  <resource-version>0000018</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
205                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL
206                 + "      <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL
207                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL
208                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
209                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
210                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
211                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
212                 + "      <resource-version>0000078</resource-version>" + EOL + "    </vf-module>" + EOL
213                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
214                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
215         wireMockServer.stubFor(get(urlMatching(
216                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
217                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
218
219         body = "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL
220                 + "  <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL
221                 + "  <vnf-name>STMTN5MMSC21</vnf-name>" + EOL + "  <vnf-type>mmsc-capacity</vnf-type>" + EOL
222                 + "  <service-id>SDN-MOBILITY</service-id>" + EOL + "  <equipment-role>vMMSC</equipment-role>" + EOL
223                 + "  <orchestration-status>pending-create</orchestration-status>" + EOL + "  <in-maint>false</in-maint>"
224                 + EOL + "  <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL
225                 + "  <resource-version>0000021</resource-version>" + EOL + "  <vf-modules>" + EOL + "    <vf-module>"
226                 + EOL + "      <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL
227                 + "      <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL
228                 + "      <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL
229                 + "      <persona-model-version>1.0</persona-model-version>" + EOL
230                 + "      <is-base-vf-module>true</is-base-vf-module>" + EOL
231                 + "      <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL
232                 + "      <orchestration-status>pending-create</orchestration-status>" + EOL
233                 + "      <resource-version>0000073</resource-version>" + EOL + "    </vf-module>" + EOL
234                 + "  </vf-modules>" + EOL + "  <relationship-list/>" + EOL + "  <l-interfaces/>" + EOL
235                 + "  <lag-interfaces/>" + EOL + "</generic-vnf>" + EOL;
236         wireMockServer.stubFor(get(urlMatching(
237                 "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
238                         .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml").withBody(body)));
239
240     }
241 }