stevedlawrence commented on a change in pull request #458:
URL: https://github.com/apache/incubator-daffodil/pull/458#discussion_r526067938
##########
File path:
daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
##########
@@ -528,13 +532,39 @@ abstract class TestCase(testCaseXML: NodeSeq, val parent:
DFDLTestSuite)
} else rootAttrib
}
- lazy val rootNamespaceString = {
+ def getRootNamespaceString(schemaArg : Option[Node]) = {
if (optExpectedOrInputInfoset.isDefined)
infosetRootNamespaceString
else if (embeddedSchema.isDefined)
XMLUtils.EXAMPLE_NAMESPACE.toString
- else
- null
+ else if (this.rootNSAttrib != "")
+ rootNSAttrib
+ else {
+ // For some TDML Processors, we have to provide
+ // the root namespace. They don't provide a way to search
+ // for an element when just the name is unambiguous.
+ // So since nothing was provided, we just grab the
+ // target namespace URI (if any) from the primary
+ // schema file. If that turns out to be wrong, then
+ // the test case has to have an explicit rootNS attribute.
+ val schemaNode = schemaArg.getOrElse {
+ val schemaSource = getSuppliedSchema(None)
+ val source = schemaSource.newInputSource()
+ val node = try{
+ scala.xml.XML.load(source)
+ } catch {
+ // any exception while loading then we just use a dummy node.
+ case e:SAXParseException => <dummy/>
+ }
+ node
+ }
+ val tns = (schemaNode \ "@targetNamespace").text
+ val nsURIString = {
+ if (tns != "") tns
+ else null
+ }
+ nsURIString
+ }
Review comment:
It's not clear to me why all this logic is needed for he TDML Runner,
when the TDML format originally came from. Shouldn't this not be necesary?
Or could we instead change root to a QName so that the namespace is implied
from that? Perhaps that breaks alot of our tests?
##########
File path:
daffodil-tdml-lib/src/main/scala/org/apache/daffodil/tdml/TDMLRunner.scala
##########
@@ -308,6 +308,9 @@ class DFDLTestSuite private[tdml] (
case (name, _) =>
System.err.println("TDML Runner: More than one test case for name
'%s'.".format(name))
}
+ val listOfDups = duplicateTestCases.map{ case(name, _) => name}
+ throw new TDMLExceptionImpl(
+ "More than one test for names: " + listOfDups.mkString(","), None)
}
Review comment:
Should we remove the block right above this that does
System.err.println? I think that's now just duplicate information provided by
this TDMLException.
##########
File path: build.sbt
##########
@@ -104,7 +104,7 @@ lazy val testStdLayout =
Project("daffodil-test-stdLayout", file("test-stdLay
lazy val commonSettings = Seq(
organization := "org.apache.daffodil",
- version := "3.0.0",
+ version := "3.1.0-SNAPSHOT",
Review comment:
No need to update to 3.1.0. PR #455 handles that and will be the first
thing merged once 3.0 is released.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]