summaryrefslogtreecommitdiffstats
path: root/aai-schema-gen/src/test
diff options
context:
space:
mode:
authorLaMont, William(wl2432) <wl2432@att.com>2020-04-14 14:00:00 -0400
committerLaMont, William(wl2432) <wl2432@att.com>2020-04-15 15:36:42 -0400
commit86e7411b128bd7db440eceff7265533844e577bb (patch)
tree82d33b012b11c44e6edcfce8df0b45724ff6ec3e /aai-schema-gen/src/test
parent8e131584d755d07bb12a99fa0d5981d84ed5592a (diff)
schema-service processing for v19
Issue-ID: AAI-2864 Change-Id: I41a430ec9c9fd69be75bd9d01693249895e0928b Signed-off-by: LaMont, William(wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-schema-gen/src/test')
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java6
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java16
-rw-r--r--aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java14
4 files changed, 28 insertions, 14 deletions
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
index d08c3e0..9ad16d6 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/NodesYAMLfromOXMTest.java
@@ -253,13 +253,13 @@ public class NodesYAMLfromOXMTest {
sb.append(" description: |\n");
sb.append("\n");
sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved.\n\n");
+ sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" You may obtain a copy of the License at\n");
sb.append("\n");
sb.append(" (https://creativecommons.org/licenses/by/4.0/)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n");
- sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
+ sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."+ OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
+ sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
index e686fbc..e36d520 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/PatchOperationTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.onap.aai.setup.SchemaVersion;
import java.util.Arrays;
import java.util.Collection;
@@ -39,11 +40,12 @@ public class PatchOperationTest {
private String path;
private String pathParams;
private String result;
+ private static SchemaVersion v = new SchemaVersion("v16");
@Parameters
public static Collection<String []> testConditions() {
String inputs [][] = {
- {"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__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\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__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
+ {"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__"," patch:\n tags:\n - Network\n summary: update an existing generic-vnf\n description: |\n Update an existing generic-vnf\n #\n Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n The PUT operation will entirely replace an existing object.\n The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n #\n Other differences between PUT and PATCH are:\n #\n - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n operationId: UpdateNetworkGenericVnfsGenericVnf\n consumes:\n - application/json\n produces:\n - application/json\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__ - name: body\n in: body\n description: generic-vnf object that needs to be updated.[See Examples](apidocs/relations/v16/NetworkGenericVnfsGenericVnf.json)\n required: true\n schema:\n $ref: \"#/definitions/generic-vnf\"\n"},
// if ( StringUtils.isEmpty(tag) )
{"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__",""},
// Test: if ( !path.endsWith("/relationship") && !path.endsWith("}") )
@@ -73,7 +75,7 @@ public class PatchOperationTest {
@Test
public void testToString() {
- PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams);
+ PatchOperation patch = new PatchOperation(useOpId, xmlRootElementName, tag, path, pathParams, v);
String modResult = patch.toString();
assertThat(modResult, is(this.result));
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
index 3c072f3..2ebaee1 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/XSDElementTest.java
@@ -43,6 +43,7 @@ import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.collection.IsIn.in;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.core.Every.everyItem;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
public class XSDElementTest {
@@ -603,13 +604,23 @@ public class XSDElementTest {
target.add(" Customer:\n type: description: customer identifiers to provide linkage back to BSS information.\n");
target.add(" ServiceSubscriptions:\n type: description: Collection of objects that group service instances.\n");
target.add(" ServiceSubscription:\n type: description: Object that group service instances.\n");
+ StringBuilder sb = new StringBuilder(" Customer:\n type: description: |\n customer identifiers to provide linkage back to BSS information.\n");
+ sb.append(" *This property can be used as a filter to find the start node for a dsl query\n");
+ String yamlDesc = sb.toString();
List<String> types = new ArrayList<String>();
+ String container;
+ String customerDesc = null;
for ( int i = 0; i < javaTypeNodes.getLength(); ++ i ) {
XSDElement javaTypeElement = new XSDElement((Element) javaTypeNodes.item(i));
- if(javaTypeElement.getTypePropertyYAML() != null)
- types.add(javaTypeElement.getTypePropertyYAML());
+ if(javaTypeElement.getTypePropertyYAML(false) != null)
+ types.add(javaTypeElement.getTypePropertyYAML(false));
+ container = javaTypeElement.getContainerProperty();
+ if ( "customers".equals(container)) {
+ customerDesc = javaTypeElement.getTypePropertyYAML(true);
+ }
}
assertThat(new ArrayList<>(types),both(everyItem(is(in(target.toArray())))).and(containsInAnyOrder(target.toArray())));
+ assertEquals(customerDesc, yamlDesc );
}
@Test
@@ -640,4 +651,5 @@ public class XSDElementTest {
}
}
+
}
diff --git a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
index b54408d..2ccf051 100644
--- a/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
+++ b/aai-schema-gen/src/test/java/org/onap/aai/schemagen/genxsd/YAMLfromOXMTest.java
@@ -315,14 +315,12 @@ public class YAMLfromOXMTest {
sb.append("\n");
sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)" + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Copyright &copy; 2017-18 AT&amp;T Intellectual Property. All rights reserved." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License.\n");
- sb.append("\n");
+ sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the &quot;License&quot;); you may not use this documentation except in compliance with the License." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" You may obtain a copy of the License at\n");
sb.append("\n");
- sb.append(" (https://creativecommons.org/licenses/by/4.0/)\n");
- sb.append("\n");
+ sb.append(" (https://creativecommons.org/licenses/by/4.0/)"+ OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." + OxmFileProcessor.DOUBLE_LINE_SEPARATOR);
- sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
+ sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by opening the models link below and finding the node-type. Edge definitions can be found with the node definitions." + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" version: \"v11\"" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" title: Active and Available Inventory REST API" + OxmFileProcessor.LINE_SEPARATOR);
sb.append(" license:" + OxmFileProcessor.LINE_SEPARATOR);
@@ -445,7 +443,8 @@ public class YAMLfromOXMTest {
sb.append(" example: __SERVICE-TYPE__\n");
sb.append(" - name: body\n");
sb.append(" in: body\n");
- sb.append(" description: service-subscription object that needs to be updated.\n");
+ sb.append(" description: service-subscription object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-service-subscription\"\n");
@@ -594,7 +593,8 @@ public class YAMLfromOXMTest {
sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
sb.append(" - name: body\n");
sb.append(" in: body\n");
- sb.append(" description: customer object that needs to be updated.\n");
+ sb.append(" description: customer object that needs to be updated.");
+ sb.append("[See Examples](apidocs/relations/v11/BusinessCustomersCustomer.json)\n");
sb.append(" required: true\n");
sb.append(" schema:\n");
sb.append(" $ref: \"#/definitions/zzzz-patch-customer\"\n");