mbeckerle closed pull request #46: Added test to illustrate issue DAFFODIL-1907. URL: https://github.com/apache/incubator-daffodil/pull/46
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/otherAnnotationLanguage.xsd b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/otherAnnotationLanguage.xsd new file mode 100644 index 000000000..4a7061c41 --- /dev/null +++ b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/otherAnnotationLanguage.xsd @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<schema xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="urn:otherAnnotationLanguage" + xmlns:tns="urn:otherAnnotationLanguage" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:fn="http://www.w3.org/2005/xpath-functions"> + + <element name="otherAnnotation"> + <complexType> + <attribute ref="tns:otherAnnotationAttribute"/> + </complexType> + </element> + + <!-- + Some other annotation elements that are not DFDL annotations may also + have attributes. These attributes should be legal in DFDL, as they're not describing data, they're + just describing annotations on the schema that a DFDL processor should be ignoring. + --> + <attribute name="otherAnnotationAttribute" type="string"/> + +</schema> diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/schemaWithOtherAnnotations.dfdl.xsd b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/schemaWithOtherAnnotations.dfdl.xsd new file mode 100644 index 000000000..64ba179d1 --- /dev/null +++ b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/schemaWithOtherAnnotations.dfdl.xsd @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<schema xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:oth="urn:otherAnnotationLanguage" + xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:fn="http://www.w3.org/2005/xpath-functions"> + + <xs:include schemaLocation="org/apache/daffodil/DFDLGeneralFormat.dfdl.xsd" /> + + <xs:import namespace="urn:otherAnnotationLanguage" schemaLocation="otherAnnotationLanguage.xsd" /> + + <xs:annotation> + <xs:appinfo source="http://www.ogf.org/dfdl/"> + <dfdl:format ref="GeneralFormat" /> + </xs:appinfo> + </xs:annotation> + + <xs:element name="r1" type="xs:string" dfdl:lengthKind="delimited"> + <xs:annotation> + <xs:appinfo source="urn:otherAnnotationLanguage"> + <oth:otherAnnotation oth:otherAnnotationAttribute="other"/> + </xs:appinfo> + </xs:annotation> + </xs:element> + +</schema> diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testImportOtherAnnotationSchema.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testImportOtherAnnotationSchema.tdml new file mode 100644 index 000000000..abbd26cd5 --- /dev/null +++ b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testImportOtherAnnotationSchema.tdml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<tdml:testSuite suiteName="ImportOtherAnnotationSchema" + description="Tests for importing other annotation languages to determine if DFDL interacts with them." + xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:ex="http://example.com" + xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext" + xmlns:oth="urn:otherAnnotationLanguage"> + + + <tdml:parserTestCase name="importOtherAnnotationSchema1" root="r1" model="schemaWithOtherAnnotations.dfdl.xsd"> + + <tdml:document>foo</tdml:document> + <tdml:infoset> + <tdml:dfdlInfoset> + <ex:r1>foo</ex:r1> + </tdml:dfdlInfoset> + </tdml:infoset> + +</tdml:parserTestCase> + +</tdml:testSuite> diff --git a/daffodil-test/src/test/scala-debug/org/apache/daffodil/section00/general/TestImportOtherAnnotationSchema.scala b/daffodil-test/src/test/scala-debug/org/apache/daffodil/section00/general/TestImportOtherAnnotationSchema.scala new file mode 100644 index 000000000..ddf381110 --- /dev/null +++ b/daffodil-test/src/test/scala-debug/org/apache/daffodil/section00/general/TestImportOtherAnnotationSchema.scala @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package org.apache.daffodil.section00.general + +import org.junit.Test +import org.apache.daffodil.tdml.Runner +import org.junit.AfterClass + +object TestImportOtherAnnotationSchema { + val testDir = "/org/apache/daffodil/section00/general/" + val runner = Runner(testDir, "testImportOtherAnnotationSchema.tdml") + + @AfterClass def shutDown { + runner.reset + } +} + +class TestImportOtherAnnotationSchema { + + import TestImportOtherAnnotationSchema._ + + //DFDL-1907 + @Test def test_importOtherAnnotationSchema1() { runner.runOneTest("importOtherAnnotationSchema1") } + +} ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
