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=========================================================
20 package org.onap.aai.schemagen.genxsd;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.junit.runners.Parameterized;
26 import org.junit.runners.Parameterized.Parameters;
28 import java.util.Arrays;
29 import java.util.Collection;
31 import static org.hamcrest.CoreMatchers.is;
32 import static org.junit.Assert.assertThat;
34 @RunWith(Parameterized.class)
35 public class DeleteOperationTest {
36 private String useOpId;
37 private String xmlRootElementName;
40 private String pathParams;
41 private String result;
44 public static Collection<String []> testConditions() {
45 String inputs [][] = {
46 {"NetworkGenericVnfsGenericVnf","generic-vnf","Network","/network/generic-vnfs/generic-vnf/{vnf-id}"," - 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"," 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"},
47 // if ( StringUtils.isEmpty(tag) )
48 {"GenericVnf","generic-vnf","","/generic-vnf/{vnf-id}"," - 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 // Test: if ( !path.endsWith("/relationship") && !path.endsWith("}") )
50 {"CloudInfrastructurePserversPserverPInterfaces","p-interfaces","CloudInfrastructure","/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces"," - name: hostname\n in: path\n description: Value from executing hostname on the compute node.\n required: true\n type: string\n example: __HOSTNAME__",""},
51 // {"","ctag-pool","","","",""},
52 // {"","pserver","","","",""},
53 // {"","oam-network","","","",""},
54 // {"","dvs-switch","","","",""},
55 // {"","availability-zone","","","",""}
57 return Arrays.asList(inputs);
60 public DeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
62 this.useOpId = useOpId;
63 this.xmlRootElementName = xmlRootElementName;
66 this.pathParams=pathParams;
70 public static void setUpBeforeClass() throws Exception {
75 public void testToString() {
76 DeleteOperation delete = new DeleteOperation(useOpId, xmlRootElementName, tag, path, pathParams);
77 String modResult = delete.toString();
78 assertThat(modResult, is(this.result));