Chris Hillery | d6f7828 | 2015-04-30 17:07:05 -0700 | [diff] [blame] | 1 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" |
Ian Maxon | f18bba2 | 2015-08-21 12:35:14 -0700 | [diff] [blame^] | 2 | xmlns:test="urn:xml.testframework.asterix.apache.org" |
| 3 | targetNamespace="urn:xml.testframework.asterix.apache.org" elementFormDefault="qualified"> |
Chris Hillery | d6f7828 | 2015-04-30 17:07:05 -0700 | [diff] [blame] | 4 | |
| 5 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 6 | <!-- test-suite - top level element --> |
| 7 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 8 | |
| 9 | <xs:element name="test-suite"> |
| 10 | <xs:annotation> |
| 11 | <xs:documentation> |
| 12 | This is the top level element for documents that use this schema. |
| 13 | </xs:documentation> |
| 14 | </xs:annotation> |
| 15 | |
| 16 | <xs:complexType> |
| 17 | <xs:sequence> |
| 18 | <xs:element ref="test:test-group" maxOccurs="unbounded"/> |
| 19 | </xs:sequence> |
| 20 | |
| 21 | <xs:attribute name="CatalogDesignDate" type="xs:date" use="required"/> |
| 22 | |
| 23 | <xs:attribute name="ResultOffsetPath" type="test:SimplifiedRelativeFilePath" use="required"> |
| 24 | <xs:annotation> |
| 25 | <xs:documentation> |
| 26 | offset from root to results |
| 27 | </xs:documentation> |
| 28 | </xs:annotation> |
| 29 | </xs:attribute> |
| 30 | |
| 31 | <xs:attribute name="QueryOffsetPath" type="test:SimplifiedRelativeFilePath" |
| 32 | use="required"> |
| 33 | <xs:annotation> |
| 34 | <xs:documentation> |
| 35 | offset from root to Query expression files |
| 36 | </xs:documentation> |
| 37 | </xs:annotation> |
| 38 | </xs:attribute> |
| 39 | |
| 40 | </xs:complexType> |
| 41 | |
| 42 | <xs:unique name="unique-test-group"> |
| 43 | <xs:selector xpath=".//test:test-group"/> |
| 44 | <xs:field xpath="@name"/> |
| 45 | </xs:unique> |
| 46 | |
| 47 | </xs:element> |
| 48 | |
| 49 | |
| 50 | <!-- SimplifiedRelativeFilePath type --> |
| 51 | |
| 52 | <xs:simpleType name="SimplifiedRelativeFilePath"> |
| 53 | <xs:restriction base="xs:anyURI"> |
| 54 | <xs:pattern value="([a-zA-Z0-9\-\.]+/)+"/> |
| 55 | </xs:restriction> |
| 56 | </xs:simpleType> |
| 57 | |
| 58 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 59 | <!-- test-group --> |
| 60 | <!-- --> |
| 61 | <!-- Group of test cases and test groups. --> |
| 62 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 63 | |
| 64 | <xs:element name="test-group"> |
| 65 | <xs:annotation> |
| 66 | <xs:documentation> |
| 67 | Group of test cases and test groups. |
| 68 | </xs:documentation> |
| 69 | </xs:annotation> |
| 70 | |
| 71 | <xs:complexType> |
| 72 | <xs:sequence> |
| 73 | <xs:element name="test-case" type="test:test-case" minOccurs="0" maxOccurs="unbounded"> |
| 74 | <xs:unique name="unique-expected-error"> |
| 75 | <xs:selector xpath=".//test:expected-error"/> |
| 76 | <xs:field xpath="."/> |
| 77 | </xs:unique> |
| 78 | </xs:element> |
| 79 | |
| 80 | <xs:element ref="test:test-group" minOccurs="0" maxOccurs="unbounded"/> |
| 81 | </xs:sequence> |
| 82 | <xs:attribute name="name" type="xs:string" use="required"/> |
| 83 | </xs:complexType> |
| 84 | </xs:element> |
| 85 | |
| 86 | |
| 87 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 88 | <!-- test-case --> |
| 89 | <!-- --> |
| 90 | <!-- A test case to be run. --> |
| 91 | <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 92 | |
| 93 | <xs:complexType name="test-case"> |
| 94 | <xs:sequence> |
| 95 | <xs:element name="description" type="test:description"/> |
| 96 | |
| 97 | <xs:element name="compilation-unit" minOccurs="1" maxOccurs="unbounded"> |
| 98 | <xs:complexType> |
| 99 | <xs:sequence> |
| 100 | <xs:element name="description" type="test:description" minOccurs="0"/> |
| 101 | <xs:element name="output-dir" minOccurs="0"> |
| 102 | <xs:annotation> |
| 103 | <xs:documentation> |
| 104 | Zero or one file containing expected results for this query. |
| 105 | </xs:documentation> |
| 106 | </xs:annotation> |
| 107 | <xs:complexType> |
| 108 | <xs:simpleContent> |
| 109 | <xs:extension base="xs:string"> |
| 110 | <xs:attribute name="compare" type="test:comparison-enum" use="required"/> |
| 111 | </xs:extension> |
| 112 | </xs:simpleContent> |
| 113 | </xs:complexType> |
| 114 | </xs:element> |
| 115 | |
| 116 | |
| 117 | <!-- Zero or more expected errors for this query --> |
| 118 | |
| 119 | <xs:element name="expected-error" minOccurs="0" maxOccurs="unbounded"> |
| 120 | <xs:annotation> |
| 121 | <xs:documentation> |
| 122 | Zero or more expected errors for this query. |
| 123 | </xs:documentation> |
| 124 | </xs:annotation> |
| 125 | |
| 126 | <xs:complexType> |
| 127 | <xs:simpleContent> |
| 128 | <xs:extension base="test:ErrorCode"> |
| 129 | </xs:extension> |
| 130 | </xs:simpleContent> |
| 131 | </xs:complexType> |
| 132 | </xs:element> |
| 133 | |
| 134 | </xs:sequence> |
| 135 | |
| 136 | <!-- This name is always equal to the name of the test case --> |
| 137 | <xs:attribute name="name" type="xs:string" use="required"/> |
| 138 | |
| 139 | </xs:complexType> |
| 140 | </xs:element> |
| 141 | |
| 142 | <!-- Zero or more files containing expected results for this query --> |
| 143 | |
| 144 | </xs:sequence> |
| 145 | |
| 146 | <!-- The filename for this query can be constructed from: --> |
| 147 | <!-- the QueryOffsetPath --> |
| 148 | <!-- the FilePath --> |
| 149 | <!-- the name --> |
| 150 | <!-- the QueryFileExtension --> |
| 151 | |
| 152 | <xs:attribute name="FilePath" type="test:SimplifiedRelativeFilePath" use="required"/> |
| 153 | <xs:attribute name="date" type="xs:date" use="required"/> |
| 154 | <xs:attribute name="category" type="test:category-enum"/> |
| 155 | </xs:complexType> |
| 156 | |
| 157 | <!-- category-enum type --> |
| 158 | <!-- Identify which category of test this is. Currently only "slow". --> |
| 159 | |
| 160 | <xs:simpleType name="category-enum"> |
| 161 | <xs:annotation> |
| 162 | <xs:documentation> |
| 163 | Identify the category of test, for limiting when it is run. |
| 164 | </xs:documentation> |
| 165 | </xs:annotation> |
| 166 | |
| 167 | <xs:restriction base="xs:string"> |
| 168 | <xs:enumeration value="slow"/> |
| 169 | </xs:restriction> |
| 170 | </xs:simpleType> |
| 171 | |
| 172 | <!-- comparison-enum type --> |
| 173 | <!-- Identify the type of comparison used to determine whether an --> |
| 174 | <!-- expected result and an actual result match. --> |
| 175 | |
| 176 | <xs:simpleType name="comparison-enum"> |
| 177 | <xs:annotation> |
| 178 | <xs:documentation> |
| 179 | Identify the type of comparison used to determine whether an |
| 180 | expected result and an actual result match. |
| 181 | </xs:documentation> |
| 182 | </xs:annotation> |
| 183 | |
| 184 | <xs:restriction base="xs:string"> |
| 185 | <xs:enumeration value="XML"/> |
| 186 | <xs:enumeration value="Text"/> |
| 187 | <xs:enumeration value="Inspect"/> |
| 188 | <xs:enumeration value="Ignore"/> |
| 189 | <xs:enumeration value="JSON"/> |
| 190 | <xs:enumeration value="CSV"/> |
| 191 | <xs:enumeration value="CSV_Header"/> |
| 192 | </xs:restriction> |
| 193 | </xs:simpleType> |
| 194 | |
| 195 | <!-- description type --> |
| 196 | |
| 197 | <xs:complexType name="description"> |
| 198 | <xs:simpleContent> |
| 199 | <xs:extension base="xs:string"> |
| 200 | <xs:attribute name="last-mod" type="xs:date"/> |
| 201 | </xs:extension> |
| 202 | </xs:simpleContent> |
| 203 | </xs:complexType> |
| 204 | |
| 205 | |
| 206 | <!-- ErrorCode type --> |
| 207 | <!-- * is used to mean that any error code is acceptable --> |
| 208 | |
| 209 | <xs:simpleType name="ErrorCode"> |
| 210 | <xs:annotation> |
| 211 | <xs:documentation> |
| 212 | * is used to mean that any error code is acceptable |
| 213 | </xs:documentation> |
| 214 | </xs:annotation> |
| 215 | |
| 216 | <xs:restriction base="xs:string"> |
| 217 | <xs:pattern value="\*|([A-Z]{4}[0-9]{4})"/> |
| 218 | </xs:restriction> |
| 219 | </xs:simpleType> |
| 220 | |
| 221 | </xs:schema> |