You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sl...@apache.org on 2020/08/27 13:48:06 UTC
[incubator-daffodil] branch master updated (1763fb2 -> 6471d1e)
This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git.
from 1763fb2 Fix multiple discriminator behavior and free up marks when resolved
new 0adb436 Addressed DAFFODIL-2322 dfdl:textBidi property errors
new 6471d1e Addressed DAFFODIL-2210
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/daffodil/dsom/RestrictionUnion.scala | 3 +-
.../apache/daffodil/xsd/DFDL_part2_attributes.xsd | 2 +
.../daffodil/section00/general/testTextBidi.tdml | 55 ++++++++++++++
.../section05/simple_types/SimpleTypes.tdml | 52 +++++++++++++-
...erAnnotationSchema.scala => TestTextBidi.scala} | 84 +++++++++++-----------
.../section05/simple_types/TestSimpleTypes2.scala | 3 +
6 files changed, 156 insertions(+), 43 deletions(-)
create mode 100644 daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testTextBidi.tdml
copy daffodil-test/src/test/scala/org/apache/daffodil/section00/general/{TestImportOtherAnnotationSchema.scala => TestTextBidi.scala} (67%)
[incubator-daffodil] 01/02: Addressed DAFFODIL-2322 dfdl:textBidi
property errors
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
commit 0adb436a4c1957d44b96daaba1d2aac9bc53a935
Author: Steinberger <rs...@tresys.com>
AuthorDate: Tue Aug 25 11:26:56 2020 -0400
Addressed DAFFODIL-2322 dfdl:textBidi property errors
According to the specification, only textBidi="no" is valid.
Following the pattern for ignoreCase, the following changes were made.
Modified: DFDL_part2_attributes.xsd to correct the property error.
Inserted <xsd:attribute form="qualified" name="textBidi" type="dfdl:YesNoEnum" />
Created: testTextBidi.tdml, TestTextBidi.scala to test
correct parsing for "no", and correct SDE for "yes"
DAFFODIL-2322
---
.../apache/daffodil/xsd/DFDL_part2_attributes.xsd | 2 +
.../daffodil/section00/general/testTextBidi.tdml | 55 ++++++++++++++++++++++
.../daffodil/section00/general/TestTextBidi.scala | 43 +++++++++++++++++
3 files changed, 100 insertions(+)
diff --git a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/DFDL_part2_attributes.xsd b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/DFDL_part2_attributes.xsd
index c0cb50b..781f75c 100644
--- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/DFDL_part2_attributes.xsd
+++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/DFDL_part2_attributes.xsd
@@ -789,6 +789,8 @@
type="dfdl:YesNoEnum" />
<xsd:attribute form="qualified" name="textBidiNumeralShapes"
type="dfdl:TextBidiNumeralShapesEnum" />
+ <xsd:attribute form="qualified" name="textBidi"
+ type="dfdl:YesNoEnum" />
</xsd:attributeGroup>
<!-- 13.4 Properties Specific to Strings with Text representation -->
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testTextBidi.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testTextBidi.tdml
new file mode 100644
index 0000000..7e8bf7b
--- /dev/null
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section00/general/testTextBidi.tdml
@@ -0,0 +1,55 @@
+<?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 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:fn="http://www.w3.org/2005/xpath-functions"
+ xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+ suiteName="unparser tests involving bitOrder and outputValueCalc interactions"
+ defaultRoundTrip="onePass">
+
+ <!--
+ The DFDL v1.0 Specification states that:
+ Bidirectional text properties other than textBidi=”no” removed and reserved for future use.
+ -->
+
+ <tdml:defineSchema name="SchemaTextBidi" elementFormDefault="unqualified">
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat" lengthKind="delimited"/>
+ <xs:element name="root-no" type="xs:string" dfdl:textBidi="no" />
+ <xs:element name="root-yes" type="xs:string" dfdl:textBidi="yes" />
+ </tdml:defineSchema>
+
+ <tdml:parserTestCase name="textBidiNo" model="SchemaTextBidi" root="root-no">
+ <tdml:document>test</tdml:document>
+ <tdml:infoset>
+ <tdml:dfdlInfoset>
+ <ex:root-no>test</ex:root-no>
+ </tdml:dfdlInfoset>
+ </tdml:infoset>
+ </tdml:parserTestCase>
+
+ <tdml:parserTestCase name="textBidiYes" model="SchemaTextBidi" root="root-yes">
+ <tdml:document>test</tdml:document>
+ <tdml:errors>
+ <tdml:error>textBidi='yes' is not supported</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+</tdml:testSuite>
diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section00/general/TestTextBidi.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section00/general/TestTextBidi.scala
new file mode 100644
index 0000000..b7a5f06
--- /dev/null
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/section00/general/TestTextBidi.scala
@@ -0,0 +1,43 @@
+/*
+ * 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.apache.daffodil.tdml.Runner
+import org.junit.{ AfterClass, Test }
+
+object TestTextBidi {
+ val testDir = "/org/apache/daffodil/section00/general/"
+ val runner = Runner(testDir, "testTextBidi.tdml")
+
+ @AfterClass def shutDown: Unit = {
+ runner.reset
+ }
+}
+
+/*
+ * This test addresses reported issue DAFFODIL-2322
+ * dfdl:textBidi property errors when used in attribute form
+ */
+class TestTextBidi {
+
+ import TestTextBidi._
+
+ @Test def test_textBidiNo(): Unit = { runner.runOneTest("textBidiNo") }
+ @Test def test_textBidiYes(): Unit = { runner.runOneTest("textBidiYes") }
+
+}
[incubator-daffodil] 02/02: Addressed DAFFODIL-2210
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
commit 6471d1e95a9f4a23855b45acbfaf3b510d3b7358
Author: Steinberger <rs...@tresys.com>
AuthorDate: Tue Aug 25 11:55:26 2020 -0400
Addressed DAFFODIL-2210
Leading or trailing spaces in the restriction base type name
throws an unhandled exception ex: <xs:restriction base="xs:string ">
Modified: RestrictionUnion.scala to throw SDE rather than assert
Modified: SimpleTypes.tdml adding restrictionBaseEmbedded tests
Modified: TestSimpleTypes2.scala for runners
DAFFODIL-2210
---
.../apache/daffodil/dsom/RestrictionUnion.scala | 3 +-
.../section05/simple_types/SimpleTypes.tdml | 52 +++++++++++++++++++++-
.../section05/simple_types/TestSimpleTypes2.scala | 3 ++
3 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
index 35ce2a2..68317f7 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/RestrictionUnion.scala
@@ -76,7 +76,8 @@ final class Restriction(xmlArg: Node, val simpleTypeDef: SimpleTypeDefBase)
val baseQNameString = baseQNameNodeSeq.text
val tryBaseQName = QName.resolveRef(baseQNameString, xml.scope,
tunable.unqualifiedPathStepPolicy)
- Assert.invariant(tryBaseQName.isSuccess)
+ schemaDefinitionUnless(tryBaseQName.isSuccess,
+ "Failed to resolve base property reference for xs:restriction: " + tryBaseQName.failed.get.getMessage)
tryBaseQName.get
}
diff --git a/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
index a9e6a35..19d4ae6 100644
--- a/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
+++ b/daffodil-test/src/test/resources/org/apache/daffodil/section05/simple_types/SimpleTypes.tdml
@@ -4354,6 +4354,24 @@
</tdml:errors>
</tdml:unparserTestCase>
+ <tdml:defineSchema name="SimpleTypes-restriction-base" elementFormDefault="unqualified">
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+ <dfdl:format ref="ex:GeneralFormat"/>
+
+ <xs:element name="embeddedLeadingSpace">
+ <xs:simpleType>
+ <xs:restriction base=" xs:string" />
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:element name="embeddedTrailingSpace">
+ <xs:simpleType>
+ <xs:restriction base="xs:string " />
+ </xs:simpleType>
+ </xs:element>
+
+ </tdml:defineSchema>
+
<tdml:defineSchema name="SimpleTypes-padding">
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<dfdl:format ref="ex:GeneralFormat" representation="text"
@@ -4468,7 +4486,39 @@
<xs:element name="string12" dfdl:textStringPadCharacter="%" dfdl:lengthKind="delimited" type="xs:string" />
</tdml:defineSchema>
-
+
+ <!--
+ Test name: restrictionBaseEmbeddedTrailingSpace
+ Schema: SimpleTypes-restriction-base
+ Purpose: This document demonstrates the SDE due to trailing space in restriction base
+ -->
+
+ <tdml:parserTestCase name="restrictionBaseEmbeddedTrailingSpace" root="embeddedTrailingSpace"
+ model="SimpleTypes-restriction-base"
+ description="Test SDE due to trailing space in base">
+ <tdml:document>test</tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>Failed to resolve base property reference for xs:restriction:</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
+ <!--
+ Test name: restrictionBaseEmbeddedLeadingSpace
+ Schema: SimpleTypes-restriction-base
+ Purpose: This document demonstrates the SDE due to leading space in restriction base
+ -->
+
+ <tdml:parserTestCase name="restrictionBaseEmbeddedLeadingSpace" root="embeddedLeadingSpace"
+ model="SimpleTypes-restriction-base"
+ description="Test SDE due to leading space in base">
+ <tdml:document>test</tdml:document>
+ <tdml:errors>
+ <tdml:error>Schema Definition Error</tdml:error>
+ <tdml:error>Failed to resolve base property reference for xs:restriction:</tdml:error>
+ </tdml:errors>
+ </tdml:parserTestCase>
+
<!--
Test name: literalChar_padding
Schema: SimpleTypes-padding
diff --git a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes2.scala b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes2.scala
index 5802787..16715b0 100644
--- a/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes2.scala
+++ b/daffodil-test/src/test/scala/org/apache/daffodil/section05/simple_types/TestSimpleTypes2.scala
@@ -99,4 +99,7 @@ class TestSimpleTypes2 {
@Test def test_hexBinary_Delimited_04(): Unit = { runner.runOneTest("hexBinary_Delimited_04") }
+ @Test def test_restrictionBaseEmbeddedLeadlingSpace(): Unit = { runner.runOneTest("restrictionBaseEmbeddedLeadingSpace") }
+ @Test def test_restrictionBaseEmbeddedTrailingSpace(): Unit = { runner.runOneTest("restrictionBaseEmbeddedTrailingSpace") }
+
}