Replace all tab characters in java files with two spaces to remove linter warning
[aai/schema-service.git] / aai-schema-gen / src / test / java / org / onap / aai / schemagen / genxsd / DeleteOperationTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
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
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 package org.onap.aai.schemagen.genxsd;
21
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;
27
28 import java.util.Arrays;
29 import java.util.Collection;
30
31 import static org.hamcrest.CoreMatchers.is;
32 import static org.junit.Assert.assertThat;
33
34 @RunWith(Parameterized.class)
35 public class DeleteOperationTest {
36   private String useOpId;
37   private String xmlRootElementName;
38   private String tag;
39   private String path;
40   private String pathParams;
41   private String result;
42
43   @Parameters
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","","","",""}
56     };
57     return Arrays.asList(inputs);
58   }
59
60   public DeleteOperationTest(String useOpId, String xmlRootElementName, String tag, String path, String pathParams, String result) {
61     super();
62     this.useOpId = useOpId;
63     this.xmlRootElementName = xmlRootElementName;
64     this.tag = tag;
65     this.path = path;
66     this.pathParams=pathParams;
67     this.result = result;
68   }
69   @BeforeClass
70   public static void setUpBeforeClass() throws Exception {
71
72   }
73
74   @Test
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));
79   }
80
81 }