Steve Lawrence created DAFFODIL-2734:
----------------------------------------

             Summary: TDML runner - throws exception if missing root attribute 
with negative test case
                 Key: DAFFODIL-2734
                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2734
             Project: Daffodil
          Issue Type: Bug
          Components: TDML Runner
            Reporter: Steve Lawrence


The "root" attribute of a parser/unparserTestCase is normally optional and is 
not required for positive test cases because the TDML runner just infers it 
from the expected infoset. But if a test case is negative, then there is no 
expected infoset and the root attribute is mandatory. However, if you 
accidentally leave off the root attribute, you get an unhelpful abort exception:

{code}
org.apache.daffodil.exceptions.Abort: Cannot specify only a namespace without a 
name. Namespace argument was: Some(http://example.com)
org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:137)
org.apache.daffodil.exceptions.Assert$.usageError(Assert.scala:125)
org.apache.daffodil.compiler.RootSpec$.makeRootSpec(RootSpec.scala:45)
org.apache.daffodil.compiler.ProcessorFactory.<init>(Compiler.scala:93)
        at org.apache.daffodil.exceptions.Assert$.abort(Assert.scala:137)
        at org.apache.daffodil.exceptions.Assert$.usageError(Assert.scala:125)
        at 
org.apache.daffodil.compiler.RootSpec$.makeRootSpec(RootSpec.scala:45)
        at 
org.apache.daffodil.compiler.ProcessorFactory.<init>(Compiler.scala:93)
        at 
org.apache.daffodil.compiler.Compiler.org$apache$daffodil$compiler$Compiler$$compileSourceInternal(Compiler.scala:416)
        at 
org.apache.daffodil.compiler.Compiler$.org$apache$daffodil$compiler$Compiler$$compileSourceSynchronizer(Compiler.scala:461)
        at 
org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:404)
        at 
org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory.compileProcessor(DaffodilTDMLDFDLProcessor.scala:147)
        at 
org.apache.daffodil.tdml.processor.TDMLDFDLProcessorFactory.getProcessor(DaffodilTDMLDFDLProcessor.scala:164)
        at 
org.apache.daffodil.tdml.TDMLCompileResultCache.getCompileResult(TDMLRunner.scala:2692)
        at 
org.apache.daffodil.tdml.DFDLTestSuite.getCompileResult(TDMLRunner.scala:532)
        at org.apache.daffodil.tdml.TestCase.run(TDMLRunner.scala:840)
{code}

Instead we should get an error about a missing root attribute.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to