You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2021/07/26 21:38:49 UTC

[GitHub] [daffodil] mphyo21 opened a new pull request #618: dfdl prefix properties on dfdl annotation elements should generate us…

mphyo21 opened a new pull request #618:
URL: https://github.com/apache/daffodil/pull/618


   …eful diagnostic
   
   -Added TestDefError.scala file and disabled validateTDML setting to allow the parser to go through the whole file and pickup the TDML error.
   -Added generalSchemaDefinitionError.tdml test to catch the TDML "SAXParseException" error


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [daffodil] stevedlawrence commented on a change in pull request #618: dfdl prefix properties on dfdl annotation elements should generate us…

Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #618:
URL: https://github.com/apache/daffodil/pull/618#discussion_r677384906



##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchedmaDefinitionError.tdml
##########
@@ -0,0 +1,54 @@
+<?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:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+  xmlns:ex="http://example.com"
+  xmlns:tns="http://example.com">
+
+  <tdml:defineSchema name="s1">
+    <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format ref="ex:GeneralFormat" dfdl:lengthKind="delimited"/>
+    <xs:element name="root" type="xs:string"/>
+  </tdml:defineSchema>
+
+<!--
+    Test Name: schema_definition_err
+       Schema: s1
+         Root: root
+      Purpose:
+      Daffodil should issue a specific diagnostic whenever it finds dfdl: prefixed attributes in the annotation elements dfdl:format, dfdl:element, dfdl:simpleType, dfdl:sequence, dfdl:choice, etc.
+      It should point out specifically that the author probably wanted to remove the prefix dfdl:
+-->
+
+  <tdml:parserTestCase name="schema_definition_err" root="root"
+    model="s1"
+    description="">
+    <tdml:document />
+ <tdml:errors>
+<tdml:error>SAXParseException</tdml:error>
+ <tdml:error> Attribute 'dfdl:lengthKind' is not allowed to appear in element 'dfdl:format'.</tdml:error>
+  </tdml:errors>
+</tdml:parserTestCase>

Review comment:
       The indentation is off in this file, can you fix this so child element are properly indented?

##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchedmaDefinitionError.tdml
##########
@@ -0,0 +1,54 @@
+<?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:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+  xmlns:ex="http://example.com"
+  xmlns:tns="http://example.com">
+
+  <tdml:defineSchema name="s1">
+    <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format ref="ex:GeneralFormat" dfdl:lengthKind="delimited"/>
+    <xs:element name="root" type="xs:string"/>
+  </tdml:defineSchema>
+
+<!--
+    Test Name: schema_definition_err
+       Schema: s1
+         Root: root
+      Purpose:
+      Daffodil should issue a specific diagnostic whenever it finds dfdl: prefixed attributes in the annotation elements dfdl:format, dfdl:element, dfdl:simpleType, dfdl:sequence, dfdl:choice, etc.
+      It should point out specifically that the author probably wanted to remove the prefix dfdl:
+-->
+
+  <tdml:parserTestCase name="schema_definition_err" root="root"
+    model="s1"
+    description="">
+    <tdml:document />
+ <tdml:errors>
+<tdml:error>SAXParseException</tdml:error>
+ <tdml:error> Attribute 'dfdl:lengthKind' is not allowed to appear in element 'dfdl:format'.</tdml:error>

Review comment:
       We usually try to make expected error message somewhat generic so that if we ever change the error message we don't need to update the tests. Especial since this error message comes from SAX, which we don't have any control over. It's also worth looking for the word "Schema Definition Error" since that's the kind of error that we should expect to see.
   
   So I would suggest this wants to be something like
   ```xml
   <tdml:error>Schema Definition Error</tdml:error>
   <tdml:error>dfdl:lengthKind</tdml:error>
   <tdml:error>dfdl:format</tdml:error>
   ```
   Maybe that's too generic, but the idea is that we just look for certain keywords/phrases that must exist in the error, rather than looking for the entire error message. I think it's also worth loo

##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchedmaDefinitionError.tdml
##########
@@ -0,0 +1,54 @@
+<?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:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+  xmlns:ex="http://example.com"
+  xmlns:tns="http://example.com">
+
+  <tdml:defineSchema name="s1">
+    <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format ref="ex:GeneralFormat" dfdl:lengthKind="delimited"/>
+    <xs:element name="root" type="xs:string"/>
+  </tdml:defineSchema>
+
+<!--
+    Test Name: schema_definition_err
+       Schema: s1
+         Root: root
+      Purpose:
+      Daffodil should issue a specific diagnostic whenever it finds dfdl: prefixed attributes in the annotation elements dfdl:format, dfdl:element, dfdl:simpleType, dfdl:sequence, dfdl:choice, etc.

Review comment:
       Please wrap this comment so it isn't as long. I'm not sure if we have standard width, but somewhere around 80-100 characters seems generally what we do. 

##########
File path: daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchedmaDefinitionError.tdml
##########
@@ -0,0 +1,54 @@
+<?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:fn="http://www.w3.org/2005/xpath-functions"
+  xmlns:daf="urn:ogf:dfdl:2013:imp:daffodil.apache.org:2018:ext"
+  xmlns:dfdlx="http://www.ogf.org/dfdl/dfdl-1.0/extensions"
+  xmlns:ex="http://example.com"
+  xmlns:tns="http://example.com">
+
+  <tdml:defineSchema name="s1">
+    <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+    <dfdl:format ref="ex:GeneralFormat" dfdl:lengthKind="delimited"/>
+    <xs:element name="root" type="xs:string"/>
+  </tdml:defineSchema>
+
+<!--
+    Test Name: schema_definition_err
+       Schema: s1
+         Root: root
+      Purpose:
+      Daffodil should issue a specific diagnostic whenever it finds dfdl: prefixed attributes in the annotation elements dfdl:format, dfdl:element, dfdl:simpleType, dfdl:sequence, dfdl:choice, etc.
+      It should point out specifically that the author probably wanted to remove the prefix dfdl:
+-->
+
+  <tdml:parserTestCase name="schema_definition_err" root="root"

Review comment:
       This name is a bit too generic, there's lot's of things that could cause a schema definition error. I would suggest something like "dfdl_format_prefixed_attributes_sde" or something, so just by looking at the name you might be able to infer that this test is about prefixed attributes in a dfdl format element.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [daffodil] tuxji commented on a change in pull request #618: dfdl prefix properties on dfdl annotation elements should generate us…

Posted by GitBox <gi...@apache.org>.
tuxji commented on a change in pull request #618:
URL: https://github.com/apache/daffodil/pull/618#discussion_r677681641



##########
File path: .sbtopts
##########
@@ -12,5 +12,8 @@
 # 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.
-
--mem 4096
+#-mem 4096
+-J-Xms4096m
+-J-Xmx4096m
+-J-Xss4M
+-J-XX:ReservedCodeCacheSize=512m

Review comment:
       You don't need to include this changed file since the same change was already merged in another pull request today.

##########
File path: daffodil-test/src/test/scala/org/apache/daffodil/section00/general/TestDefError.scala
##########
@@ -0,0 +1,39 @@
+/*
+ * 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 TestDefError {
+
+  val testDir = "/org/apache/daffodil/section00/general/"
+  val runner = Runner(testDir, "generalSchedmaDefinitionError.tdml",validateTDMLFile = false)
+
+  @AfterClass def tearDown(): Unit = {
+    runner.reset
+  }
+
+}
+
+class TestDefError {
+
+  import TestDefError._
+  @Test def test_schema_definition_err(): Unit = { runner.runOneTest("schema_definition_err") }

Review comment:
       When you change the test name in the tdml file, you'll need to change it here as well.

##########
File path: daffodil-test/src/test/scala/org/apache/daffodil/section00/general/TestDefError.scala
##########
@@ -0,0 +1,39 @@
+/*
+ * 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 TestDefError {
+
+  val testDir = "/org/apache/daffodil/section00/general/"
+  val runner = Runner(testDir, "generalSchedmaDefinitionError.tdml",validateTDMLFile = false)

Review comment:
       In addition to changing the test name as Steve suggested, I suggest also changing the scala and tdml names.  I'm fine with a shorter name than "dfdl_format_prefixed_attributes_sde" or a camel case name, just make the name more descriptive/specific.  Please also pay attention to Scala's [style guide](https://docs.scala-lang.org/style/), e.g., each comma in the above line should have a space character after it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [daffodil] mbeckerle merged pull request #618: dfdl prefix properties on dfdl annotation elements should generate us…

Posted by GitBox <gi...@apache.org>.
mbeckerle merged pull request #618:
URL: https://github.com/apache/daffodil/pull/618


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org