2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.schemagen.genxsd;
23 import static org.hamcrest.CoreMatchers.is;
24 import static org.junit.Assert.assertThat;
26 import java.util.Arrays;
27 import java.util.Collection;
29 import org.junit.BeforeClass;
30 import org.junit.Test;
31 import org.junit.runner.RunWith;
32 import org.junit.runners.Parameterized;
33 import org.junit.runners.Parameterized.Parameters;
35 @RunWith(Parameterized.class)
36 public class DeleteOperationTest {
37 private String useOpId;
38 private String xmlRootElementName;
41 private String pathParams;
42 private String result;
45 public static Collection<String[]> testConditions() {
46 String inputs[][] = {{"NetworkGenericVnfsGenericVnf", "generic-vnf", "Network",
47 "/network/generic-vnfs/generic-vnf/{vnf-id}",
48 " - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__\n",
49 " delete:\n tags:\n - Network\n summary: delete an existing generic-vnf\n description: delete an existing generic-vnf\n operationId: deleteNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n - application/xml\n produces:\n - application/json\n - application/xml\n responses:\n \"default\":\n null parameters:\n - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__\n - name: resource-version\n in: query\n description: resource-version for concurrency\n required: true\n type: string\n"},
50 // if ( StringUtils.isEmpty(tag) )
51 {"GenericVnf", "generic-vnf", "", "/generic-vnf/{vnf-id}",
52 " - name: vnf-id\n in: path\n description: Unique id of VNF. This is unique across the graph.\n required: true\n type: string\n example: __VNF-ID__\n",
54 // Test: if ( !path.endsWith("/relationship") && !path.endsWith("}") )
55 {"CloudInfrastructurePserversPserverPInterfaces", "p-interfaces", "CloudInfrastructure",
56 "/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces",
57 " - name: hostname\n in: path\n description: Value from executing hostname on the compute node.\n required: true\n type: string\n example: __HOSTNAME__",
59 // {"","ctag-pool","","","",""},
60 // {"","pserver","","","",""},
61 // {"","oam-network","","","",""},
62 // {"","dvs-switch","","","",""},
63 // {"","availability-zone","","","",""}
65 return Arrays.asList(inputs);
68 public DeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path,
69 String pathParams, String result) {
71 this.useOpId = useOpId;
72 this.xmlRootElementName = xmlRootElementName;
75 this.pathParams = pathParams;
80 public static void setUpBeforeClass() throws Exception {
85 public void testToString() {
86 DeleteOperation delete =
87 new DeleteOperation(useOpId, xmlRootElementName, tag, path, pathParams);
88 String modResult = delete.toString();
89 assertThat(modResult, is(this.result));