blob: 4b9f8840be948821599becdb2c9feca11272b976 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2012-2015 Tresys Technology, LLC. All rights reserved.
Developed by: Tresys Technology, LLC http://www.tresys.com Permission is
hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal with the Software
without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: 1. Redistributions of source code must
retain the above copyright notice, this list of conditions and the following
disclaimers. 2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimers in the documentation
and/or other materials provided with the distribution. 3. Neither the names
of Tresys Technology, nor the names of its contributors may be used to endorse
or promote products derived from this Software without specific prior written
permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH
THE SOFTWARE. -->
<tdml:testSuite suiteName="Tunables" description="Section 00 - Tunables tests"
xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ex="http://example.com" xmlns:daf="urn:ogf:dfdl:2013:imp:opensource.ncsa.illinois.edu:2012:ext"
defaultConfig="tunables.xml">
<tdml:defineConfig name="cfg_noNamespace">
<daf:tunables xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<daf:unqualifiedPathStepPolicy>noNamespace</daf:unqualifiedPathStepPolicy>
</daf:tunables>
</tdml:defineConfig>
<tdml:defineConfig name="cfg_defaultNamespace">
<daf:tunables xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<daf:unqualifiedPathStepPolicy>defaultNamespace</daf:unqualifiedPathStepPolicy>
</daf:tunables>
</tdml:defineConfig>
<tdml:defineConfig name="cfg_defaultNamespace">
<daf:tunables xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<daf:unqualifiedPathStepPolicy>preferDefaultNamespace</daf:unqualifiedPathStepPolicy>
</daf:tunables>
</tdml:defineConfig>
<tdml:defineSchema name="unqualifiedPathStep" elementFormDefault="unqualified">
<xs:include schemaLocation="edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd" />
<dfdl:format ref="ex:daffodilTest1" />
<xs:element name="b" type="xs:string" dfdl:length="1"
dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" />
<!-- 'a' is global, so this is in the ex namespce -->
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<!-- references a global, so 'b' is in the ex namespace -->
<xs:element ref="ex:b" />
<!-- elementFormDefault="unqualified" and 'c' is local, so it is in
NoNamespace -->
<xs:element name="c" type="xs:string" dfdl:length="1"
dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- this should always work, regardless of unqualifiedPathStepPolicy -->
<xs:element name="test_01">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:a" />
<xs:element name="s" type="xs:string"
dfdl:inputValueCalc="{ ../ex:a/ex:b }" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- this should only work with defaultNamespace and preferDefaultNamespace -->
<xs:element name="test_02">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:a" />
<xs:element name="s" type="xs:string"
dfdl:inputValueCalc="{ ../ex:a/b }" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- this should always fail, regardless of unqualifiedPathStepPolicy -->
<xs:element name="test_03">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:a" />
<xs:element name="s" type="xs:string"
dfdl:inputValueCalc="{ ../ex:a/ex:c }" />
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- this should only work with noNamespace and preferDefaultNamespace -->
<xs:element name="test_04">
<xs:complexType>
<xs:sequence>
<xs:element ref="ex:a" />
<xs:element name="s" type="xs:string"
dfdl:inputValueCalc="{ ../ex:a/c }" />
</xs:sequence>
</xs:complexType>
</xs:element>
</tdml:defineSchema>
<!-- Test name: unqualifiedPathStepPolicy_defaultNamespace_test_01 Schema:
unqualifiedPathStepPolicy Purpose: Verifiy that Tunables now work when specified
via TDML -->
<tdml:parserTestCase
name="unqualifiedPathStepPolicy_defaultNamespace_test_01" root="test_01"
model="unqualifiedPathStep" description="Tunables - Unqualified Path Step Policy"
config="cfg_defaultNamespace">
<tdml:document>
<tdml:documentPart type="text">12</tdml:documentPart>
</tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset>
<test_01 xmlns="http://example.com">
<a>
<b>1</b>
<c xmlns="">2</c>
</a>
<s xmlns="">1</s>
</test_01>
</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
<!-- Test name: unqualifiedPathStepPolicy_noNamespace_test_02 Schema:
unqualifiedPathStepPolicy Purpose: Verifiy that Tunables now work when specified
via TDML. This also overrides the default tunable (defaultNamespace). -->
<tdml:parserTestCase
name="unqualifiedPathStepPolicy_noNamespace_test_02" root="test_02"
model="unqualifiedPathStep" description="Tunables - Unqualified Path Step Policy"
config="cfg_noNamespace">
<tdml:document>
<tdml:documentPart type="text">12</tdml:documentPart>
</tdml:document>
<tdml:errors>
<tdml:error>Schema Definition Error</tdml:error>
</tdml:errors>
</tdml:parserTestCase>
<!-- Test name: unqualifiedPathStepPolicy_defaultNamespace_test_02
Schema: unqualifiedPathStepPolicy
Purpose: Verify that Tunables now work when specified via TDML.
-->
<tdml:parserTestCase
name="unqualifiedPathStepPolicy_defaultNamespace_test_02" root="test_02"
model="unqualifiedPathStep" description="Tunables - Unqualified Path Step Policy"
config="cfg_defaultNamespace">
<tdml:document>
<tdml:documentPart type="text">12</tdml:documentPart>
</tdml:document>
<tdml:infoset>
<tdml:dfdlInfoset>
<test_02 xmlns="http://example.com">
<ex:a>
<ex:b>1</ex:b>
<c>2</c>
</ex:a>
<s>1</s>
</test_02>
</tdml:dfdlInfoset>
</tdml:infoset>
</tdml:parserTestCase>
</tdml:testSuite>