blob: a18f41c352393a06cf5e655912b91d65de1d0f61 [file] [log] [blame]
<!--
! Licensed to the Apache Software Foundation (ASF) under one
! or more contributor license agreements. See the NOTICE file
! distributed with this work for additional information
! regarding copyright ownership. The ASF licenses this file
! to you under the Apache License, Version 2.0 (the
! "License"); you may not use this file except in compliance
! with the License. You may obtain a copy of the License at
!
! http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing,
! software distributed under the License is distributed on an
! "AS IS" 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.
!-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="urn:xml.testframework.asterix.apache.org"
targetNamespace="urn:xml.testframework.asterix.apache.org" elementFormDefault="qualified">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- test-suite - top level element -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xs:element name="test-suite">
<xs:annotation>
<xs:documentation>
This is the top level element for documents that use this schema.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="test:test-group" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ResultOffsetPath" type="test:SimplifiedRelativeFilePath" use="required">
<xs:annotation>
<xs:documentation>
offset from root to results
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="QueryOffsetPath" type="test:SimplifiedRelativeFilePath"
use="required">
<xs:annotation>
<xs:documentation>
offset from root to Query expression files
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="QueryFileExtension" type="xs:string"
use="required">
<xs:annotation>
<xs:documentation>
extension of query expression files
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:unique name="unique-test-group">
<xs:selector xpath=".//test:test-group"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<!-- SimplifiedRelativeFilePath type -->
<xs:simpleType name="SimplifiedRelativeFilePath">
<xs:restriction base="xs:anyURI">
<xs:pattern value="([a-zA-Z0-9\-_\.]+\/?)+"/>
</xs:restriction>
</xs:simpleType>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- test-group -->
<!-- -->
<!-- Group of test cases and test groups. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xs:element name="test-group">
<xs:annotation>
<xs:documentation>
Group of test cases and test groups.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="test-case" type="test:test-case" minOccurs="0" maxOccurs="unbounded">
<xs:unique name="unique-expected-error">
<xs:selector xpath=".//test:expected-error"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
<xs:element ref="test:test-group" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- test-case -->
<!-- -->
<!-- A test case to be run. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xs:complexType name="test-case">
<xs:sequence>
<xs:element name="description" type="test:description" minOccurs="0" />
<xs:element name="compilation-unit" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="test:description" minOccurs="0"/>
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
Parameter to send to the HTTP API.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="value" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="output-dir" minOccurs="0">
<xs:annotation>
<xs:documentation>
Zero or one file containing expected results for this query.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="compare" type="test:comparison-enum" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Zero or more expected errors for this query -->
<xs:element name="expected-error" type="xs:string" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
Zero or more expected errors for this query.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<!-- This name is always equal to the name of the test case -->
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<!-- Zero or more files containing expected results for this query -->
</xs:sequence>
<!-- The filename for this query can be constructed from: -->
<!-- the QueryOffsetPath -->
<!-- the FilePath -->
<!-- the name -->
<!-- the QueryFileExtension -->
<xs:attribute name="FilePath" type="test:SimplifiedRelativeFilePath" use="required"/>
<xs:attribute name="category" type="test:category-enum"/>
</xs:complexType>
<!-- category-enum type -->
<!-- Identify which category of test this is. Currently only "slow". -->
<xs:simpleType name="category-enum">
<xs:annotation>
<xs:documentation>
Identify the category of test, for limiting when it is run.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="slow"/>
</xs:restriction>
</xs:simpleType>
<!-- comparison-enum type -->
<!-- Identify the type of comparison used to determine whether an -->
<!-- expected result and an actual result match. -->
<xs:simpleType name="comparison-enum">
<xs:annotation>
<xs:documentation>
Identify the type of comparison used to determine whether an
expected result and an actual result match.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="XML"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="Inspect"/>
<xs:enumeration value="Ignore"/>
<xs:enumeration value="Clean-JSON"/>
<xs:enumeration value="Lossless-JSON"/>
<xs:enumeration value="CSV"/>
<xs:enumeration value="CSV_Header"/>
<xs:enumeration value="AST"/>
<xs:enumeration value="PLAN"/>
</xs:restriction>
</xs:simpleType>
<!-- description type -->
<xs:complexType name="description">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="last-mod" type="xs:date"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- ErrorCode type -->
<!-- * is used to mean that any error code is acceptable -->
<xs:simpleType name="ErrorCode">
<xs:annotation>
<xs:documentation>
* is used to mean that any error code is acceptable
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="\*|([A-Z]{4}[0-9]{4})"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>