You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ji...@apache.org on 2023/02/15 19:25:56 UTC
[daffodil] branch main updated: Format test and sbt files
This is an automated email from the ASF dual-hosted git repository.
jinterrante pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git
The following commit(s) were added to refs/heads/main by this push:
new 7344c5d8a Format test and sbt files
7344c5d8a is described below
commit 7344c5d8a861f606a562a745098a4b322900829f
Author: Mike McGann <mm...@owlcyberdefense.com>
AuthorDate: Wed Feb 15 08:44:34 2023 -0500
Format test and sbt files
This change applies scalafmt to test and sbt files, adds additional
checks to the CI workflow, and updates DEVELOP.md.
DAFFODIL-2133
---
.github/workflows/main.yml | 2 +-
DEVELOP.md | 9 +-
build.sbt | 435 ++---
daffodil-cli/build.sbt | 48 +-
.../org/apache/daffodil/cliTest/TestCLIUdfs.scala | 368 +++--
.../org/apache/daffodil/cli/cliTest/TestBlob.scala | 49 +-
.../daffodil/cli/cliTest/TestCLIDebugger.scala | 303 ++--
.../daffodil/cli/cliTest/TestCLIGenerateC.scala | 79 +-
.../daffodil/cli/cliTest/TestCLIParsing.scala | 479 ++++--
.../daffodil/cli/cliTest/TestCLIPerformance.scala | 127 +-
.../daffodil/cli/cliTest/TestCLISaveParser.scala | 201 ++-
.../daffodil/cli/cliTest/TestCLITunables.scala | 169 +-
.../daffodil/cli/cliTest/TestCLIUnparsing.scala | 335 ++--
.../apache/daffodil/cli/cliTest/TestCLItdml.scala | 93 +-
.../daffodil/cli/cliTest/TestEXIEncodeDecode.scala | 59 +-
.../cli/cliTest/TestValidatorPatterns.scala | 3 +-
.../org/apache/daffodil/cli/cliTest/Util.scala | 75 +-
.../cli/cliTest/schematron/TestEmbedded.scala | 105 +-
.../cli/cliTest/schematron/TestSvrlOutput.scala | 200 ++-
.../cli/cliTest/schematron/TestValidating.scala | 20 +-
.../apache/daffodil/layers/BuggyTransformer.scala | 17 +-
.../org/apache/daffodil/core/api/TestAPI.scala | 17 +-
.../org/apache/daffodil/core/api/TestAPI1.scala | 143 +-
.../daffodil/core/api/TestDsomCompiler3.scala | 20 +-
.../apache/daffodil/core/api/TestForHeapDump.scala | 20 +-
.../core/api/TestParseIndividualMessages.scala | 43 +-
.../core/dpath/TestDFDLExpressionEvaluation.scala | 58 +-
.../core/dpath/TestDFDLExpressionTree.scala | 222 ++-
.../org/apache/daffodil/core/dpath/TestDPath.scala | 22 +-
.../daffodil/core/dsom/TestAppinfoSyntax.scala | 53 +-
.../daffodil/core/dsom/TestBinaryInput_01.scala | 28 +-
.../daffodil/core/dsom/TestDsomCompiler.scala | 206 ++-
.../core/dsom/TestDsomCompilerUnparse1.scala | 36 +-
.../daffodil/core/dsom/TestExternalVariables.scala | 87 +-
.../daffodil/core/dsom/TestInputValueCalc.scala | 15 +-
.../dsom/TestInteriorAlignmentElimination.scala | 11 +-
.../daffodil/core/dsom/TestIsScannable.scala | 19 +-
.../core/dsom/TestMiddleEndAttributes.scala | 24 +-
.../core/dsom/TestMiddleEndAttributes2.scala | 8 +-
.../core/dsom/TestMiddleEndAttributes3.scala | 13 +-
.../TestPolymorphicUpwardRelativeExpressions.scala | 13 +-
.../daffodil/core/dsom/TestPropertyScoping.scala | 7 +-
.../org/apache/daffodil/core/dsom/TestRefMap.scala | 160 +-
.../daffodil/core/dsom/TestSimpleTypeUnions.scala | 114 +-
.../daffodil/core/dsom/walker/BasicWalker.scala | 15 +-
.../daffodil/core/dsom/walker/TestDSOMWalker.scala | 192 ++-
.../core/externalvars/TestExternalVariables.scala | 11 +-
.../daffodil/core/general/TestDFDLReaders.scala | 2 +-
.../daffodil/core/general/TestPrimitives.scala | 51 +-
.../daffodil/core/general/TestPrimitives2.scala | 19 +-
.../core/general/TestRuntimeProperties.scala | 34 +-
.../daffodil/core/general/TestTunables.scala | 11 +-
.../apache/daffodil/core/grammar/TestGrammar.scala | 13 +-
.../core/grammar/primitives/TestPrimitives.scala | 18 +-
.../apache/daffodil/core/infoset/TestInfoset.scala | 82 +-
.../daffodil/core/infoset/TestInfoset2.scala | 11 +-
.../daffodil/core/infoset/TestInfosetCursor.scala | 102 +-
.../daffodil/core/infoset/TestInfosetCursor1.scala | 38 +-
.../core/infoset/TestInfosetCursorFromReader.scala | 101 +-
.../infoset/TestInfosetCursorFromReader2.scala | 23 +-
.../daffodil/core/infoset/TestInfosetFree.scala | 49 +-
.../apache/daffodil/core/layers/TestLayers.scala | 129 +-
.../TestOutputValueCalcAndAlignment.scala | 31 +-
.../TestOutputValueCalcForwardReference.scala | 69 +-
.../daffodil/core/processor/TestSAXParseAPI.scala | 222 ++-
.../core/processor/TestSAXParseUnparseAPI.scala | 56 +-
.../core/processor/TestSAXUnparseAPI.scala | 18 +-
.../daffodil/core/processor/TestSAXUtils.scala | 138 +-
.../runtime1/TestDelimiterFinalBacktracking.scala | 8 +-
.../TestStreamingUnparserCompilerAttributes.scala | 14 +-
.../daffodil/core/runtime1/TestUnparseHidden.scala | 43 +-
.../annotation/props/TestPropertyRuntime.scala | 22 +-
.../org/apache/daffodil/core/util/TestUtils.scala | 170 +-
.../core/xml/TestXMLLoaderWithLocation.scala | 28 +-
.../apache/daffodil/io/FormatInfoForUnitTest.scala | 27 +-
.../org/apache/daffodil/io/SocketPairTestRig.scala | 25 +-
.../io/TestAISPayloadArmoringEncoder.scala | 12 +-
.../daffodil/io/TestDaffodilDataInputSource.scala | 56 +-
.../apache/daffodil/io/TestDataOutputStream.scala | 127 +-
.../apache/daffodil/io/TestDataOutputStream2.scala | 60 +-
.../apache/daffodil/io/TestDataOutputStream3.scala | 134 +-
.../apache/daffodil/io/TestDataOutputStream4.scala | 22 +-
.../scala/org/apache/daffodil/io/TestDecoder.scala | 11 +-
.../io/TestDirectOrBufferedDataOutputStream.scala | 33 +-
.../scala/org/apache/daffodil/io/TestDump.scala | 174 +-
.../org/apache/daffodil/io/TestDumpDisplay.scala | 17 +-
.../apache/daffodil/io/TestFastAsciiConvert.scala | 11 +-
.../org/apache/daffodil/io/TestISO8859_1.scala | 14 +-
.../io/TestInputSourceDataInputStream.scala | 130 +-
.../io/TestInputSourceDataInputStream2.scala | 5 +-
.../io/TestInputSourceDataInputStream3.scala | 29 +-
.../io/TestInputSourceDataInputStream3Bit.scala | 31 +-
.../io/TestInputSourceDataInputStream4.scala | 6 +-
.../io/TestInputSourceDataInputStream5.scala | 8 +-
.../io/TestInputSourceDataInputStream6.scala | 56 +-
.../io/TestInputSourceDataInputStream7.scala | 42 +-
.../io/TestInputSourceDataInputStream8.scala | 6 +-
.../io/TestNonByteSizedCharsetDecoders1Bit.scala | 16 +-
.../io/TestNonByteSizedCharsetDecoders3Bit.scala | 19 +-
.../io/TestNonByteSizedCharsetDecoders8Bit.scala | 25 +-
.../io/TestNonByteSizedCharsetEncoders1Bit.scala | 6 +-
.../io/TestNonByteSizedCharsetEncoders3Bit.scala | 6 +-
.../io/TestNonByteSizedCharsetEncoders8Bit.scala | 22 +-
.../org/apache/daffodil/layers/TestBase64.scala | 11 +-
.../apache/daffodil/layers/TestJavaIOStreams.scala | 40 +-
.../layers/TestLimitingJavaIOStreams.scala | 39 +-
.../org/apache/daffodil/lib/HowToUseJUnit.scala | 11 +-
.../daffodil/lib/TestBitOrderByteOrder.scala | 7 +-
.../org/apache/daffodil/lib/TestImplicits.scala | 6 +-
.../daffodil/lib/api/StringSchemaSource.scala | 2 +-
.../lib/api/TestDaffodilTunablesAndConfig.scala | 3 +-
.../daffodil/lib/exceptions/TestExceptions.scala | 4 +-
.../lib/functionality/icu/TestBigInteger.scala | 26 +-
.../daffodil/lib/macros/TestAssertMacros.scala | 4 +-
.../org/apache/daffodil/lib/oolag/TestOOLAG.scala | 20 +-
.../annotation/props/TestGeneratedProperties.scala | 23 +-
.../lib/testEquality/TestEqualityOperators.scala | 5 +-
.../daffodil/lib/util/IteratorFromCursor.scala | 4 +-
.../org/apache/daffodil/lib/util/TestBits.scala | 31 +-
.../org/apache/daffodil/lib/util/TestBits2.scala | 46 +-
.../apache/daffodil/lib/util/TestCoroutines.scala | 25 +-
.../daffodil/lib/util/TestDecimalUtils.scala | 1711 +++++++++++++++-----
.../org/apache/daffodil/lib/util/TestListMap.scala | 10 +-
.../daffodil/lib/util/TestListSerialization.scala | 21 +-
.../org/apache/daffodil/lib/util/TestMaybe.scala | 1 -
.../daffodil/lib/util/TestMaybeInlineForeach.scala | 23 +-
.../daffodil/lib/util/TestMaybeTakPerf.scala | 27 +-
.../org/apache/daffodil/lib/util/TestMisc.scala | 2 +-
.../org/apache/daffodil/lib/util/TestNamed.scala | 1 +
.../apache/daffodil/lib/util/TestNumberStuff.scala | 8 +-
.../org/apache/daffodil/lib/util/TestNumbers.scala | 19 +-
.../apache/daffodil/lib/util/TestPUARemapper.scala | 7 +-
.../apache/daffodil/lib/util/TestSchemaUtils.scala | 13 +-
.../lib/util/TestSerializationAndLazy.scala | 7 +-
.../org/apache/daffodil/lib/util/TestUtil.scala | 5 +-
.../lib/util/TestXMLCatalogAndValidate.scala | 196 ++-
.../lib/validation/TestXercesValidator.scala | 2 +-
.../lib/validation/ValidatorSPISupport.scala | 6 +-
.../daffodil/lib/xml/test/unit/TestQName.scala | 24 +-
.../test/unit/TestUTF8AndUTF16Conversions.scala | 23 +-
.../lib/xml/test/unit/TestUnicodeXMLI18N.scala | 21 +-
.../lib/xml/test/unit/TestXMLLiterals.scala | 2 +-
.../daffodil/lib/xml/test/unit/TestXMLLoader.scala | 56 +-
.../lib/xml/test/unit/TestXMLPrettyPrinter.scala | 43 +-
.../daffodil/lib/xml/test/unit/TestXMLUtils.scala | 89 +-
.../src/test/scala/passera/test/TestULong.scala | 24 +-
.../test/scala/passera/test/UnsignedCheck.scala | 117 +-
.../src/test/scala/passera/test/UnsignedPerf.scala | 8 +-
.../daffodil/propGen/TestPropertyGenerator.scala | 15 +-
.../layers/runtime1/TestByteSwapStream.scala | 12 +-
.../TestLengthLimitedLineFoldingStreams.scala | 23 +-
.../layers/runtime1/TestLineFoldingStreams.scala | 28 +-
.../daffodil/runtime1/dpath/TestNodeInfo.scala | 1 -
.../daffodil/runtime1/dpath/TestRounding.scala | 18 +-
.../runtime1/dsom/TestEntityReplacer.scala | 106 +-
.../runtime1/parser/TestCharsetBehavior.scala | 124 +-
.../runtime1/parser/TestCharsetDecoder2.scala | 8 +-
.../daffodil/runtime1/processors/TestDataLoc.scala | 30 +-
.../input/TestDFDLRegularExpressions.scala | 492 ++++--
.../runtime1/processors/input/TestICU.scala | 24 +-
.../runtime1/processors/input/TestRegex.scala | 753 +++++++--
.../runtime2/TestRuntime2ExamplesGenerator.scala | 6 +-
.../example/DebuggerRunnerForSAPITest.scala | 12 +-
.../daffodil/example/TestCustomDebuggerAPI.scala | 6 +-
.../example/TestInfosetInputterOutputter.scala | 45 +-
.../org/apache/daffodil/example/TestScalaAPI.scala | 175 +-
.../daffodil/example/ValidatorApiExample.scala | 4 +-
.../example/ValidatorExamplesSupport.scala | 6 +-
.../daffodil/example/ValidatorSpiExample.scala | 5 +-
.../daffodil/sapi/SAXErrorHandlerForSAPITest.scala | 39 +-
.../validation/schematron/EmbeddedTesting.scala | 19 +-
.../schematron/TestBasicValidation.scala | 25 +-
.../schematron/TestEmbeddedSchematron.scala | 4 +-
.../validation/schematron/TestSpiLoading.scala | 6 +-
.../validation/schematron/TestUriResolver.scala | 1 +
.../schematron/TestValidatorFactory.scala | 12 +-
.../charset/TestLSBFirstAndUSASCII7BitPacked.scala | 85 +-
.../apache/daffodil/tdml/TestMoreEncodings.scala | 11 +-
.../apache/daffodil/tdml/UnitTestTDMLRunner.scala | 125 +-
.../daffodil/processor/tdml/TestDaffodilC.scala | 36 +-
.../daffodil/processor/tdml/TestExtVars1.scala | 11 +-
.../processor/tdml/TestTDMLCrossTest.scala | 11 +-
.../processor/tdml/TestTDMLRoundTrips.scala | 41 +-
.../daffodil/processor/tdml/TestTDMLRunner.scala | 276 ++--
.../daffodil/processor/tdml/TestTDMLRunner2.scala | 92 +-
.../tdml/TestTDMLRunnerCommentSyntax.scala | 10 +-
.../processor/tdml/TestTDMLRunnerConfig.scala | 52 +-
.../processor/tdml/TestTDMLRunnerTutorial.scala | 8 +-
.../processor/tdml/TestTDMLRunnerWarnings.scala | 20 +-
.../processor/tdml/TestTDMLUnparseCases.scala | 9 +-
.../test/scala/org/apache/daffodil/IBMTests.scala | 122 +-
.../test/scala/org/apache/daffodil/IBMTests3.scala | 67 +-
.../scala/org/apache/daffodil/TestNilled.scala | 1 +
.../org/apache/daffodil/TestSepSuppression.scala | 1 +
.../org/apache/daffodil/TestSepSuppression2.scala | 1 +
.../org/apache/daffodil/TestUnseparated.scala | 1 +
.../scala/org/apache/daffodil/TresysTests.scala | 59 +-
.../scala/org/apache/daffodil/TresysTests3.scala | 28 +-
.../daffodil/charsets/ISO_8859_1_Reverse.scala | 21 +-
.../charsets/TestBitsCharsetDefinition.scala | 7 +-
.../apache/daffodil/charsets/TestISO_8859_13.scala | 30 +-
.../extensions/TestChoiceBranchKeyRanges.scala | 33 +-
.../org/apache/daffodil/extensions/TestEnums.scala | 5 +-
.../extensions/TestInputTypeValueCalc.scala | 91 +-
.../apache/daffodil/extensions/TestLookAhead.scala | 21 +-
.../daffodil/functionality/TestFunctionality.scala | 17 +-
.../apache/daffodil/infoset/TestStringAsXml.scala | 229 ++-
.../daffodil/runtime1/layers/AISTransformer.scala | 72 +-
.../daffodil/runtime1/layers/CheckDigit.scala | 29 +-
.../runtime1/layers/CheckDigitLayerCompiler.scala | 52 +-
.../daffodil/runtime1/layers/IPv4Checksum.scala | 31 +-
.../layers/IPv4ChecksumLayerCompiler.scala | 30 +-
.../apache/daffodil/runtime1/layers/TestAIS.scala | 3 +-
.../daffodil/runtime1/layers/TestAISStreams.scala | 32 +-
.../daffodil/runtime1/layers/TestCheckDigit.scala | 3 +-
.../apache/daffodil/runtime1/layers/TestIPv4.scala | 4 +-
.../daffodil/runtime1/layers/TestLayers.scala | 8 +-
.../apache/daffodil/runtime2/TestCollisions.scala | 1 +
.../daffodil/runtime2/TestEgressXdccBw.scala | 1 +
.../org/apache/daffodil/runtime2/TestExNums.scala | 25 +-
.../daffodil/runtime2/TestIngressXdccBw.scala | 1 +
.../runtime2/TestIsrmGreenToOrange60000.scala | 9 +-
.../runtime2/TestIsrmOrangeToGreen60002.scala | 5 +-
.../runtime2/TestMpuGreenToOrange60004.scala | 5 +-
.../runtime2/TestMpuOrangeToGreen60006.scala | 9 +-
.../org/apache/daffodil/runtime2/TestNested.scala | 1 +
.../org/apache/daffodil/runtime2/TestOrion.scala | 1 +
.../org/apache/daffodil/runtime2/TestPadTest.scala | 1 +
.../apache/daffodil/runtime2/TestVariableLen.scala | 17 +-
.../TestDFDLFormatPrefixedAttributesSDE.scala | 4 +-
.../section00/general/TestDisallowDocType.scala | 22 +-
.../general/TestElementFormDefaultGeneral.scala | 63 +-
.../general/TestExpressionPropertyWarnings.scala | 5 +-
.../section00/general/TestFileBuffering.scala | 101 +-
.../daffodil/section00/general/TestGeneral.scala | 95 +-
.../general/TestImportOtherAnnotationSchema.scala | 13 +-
.../section00/general/TestInfosetWalker.scala | 1 +
.../section00/general/TestParseUnparsePolicy.scala | 16 +-
.../daffodil/section00/general/TestResolver.scala | 7 +-
.../general/TestSchemaWithoutDFDLNamespace.scala | 5 +-
.../daffodil/section00/general/TestTextBidi.scala | 1 +
.../section00/general/TestUnparserGeneral.scala | 63 +-
.../section00/general/TestUnparserGeneral2.scala | 3 +-
.../section00/general/TestUnparserSAX.scala | 5 +-
.../processing_errors/ProcessingErrors.scala | 36 +-
.../ProcessingErrorsUnparse.scala | 39 +-
.../schema_definition_errors/TestSDE.scala | 15 +-
.../validation_errors/TestValidationErr.scala | 157 +-
.../dfdl_xsdl_subset/TestDFDLSubset.scala | 5 +-
.../daffodil/section05/facets/TestFacets.scala | 241 ++-
.../daffodil/section05/facets/TestNulChars.scala | 1 +
.../section05/facets/TestPatternRanges.scala | 1 +
.../section05/simple_types/TestBlobs.scala | 3 +-
.../section05/simple_types/TestBoolean2.scala | 27 +-
.../section05/simple_types/TestEncodings.scala | 5 +-
.../simple_types/TestRuntimeCalendarLanguage.scala | 21 +-
.../section05/simple_types/TestSimpleTypes.scala | 655 ++++++--
.../section05/simple_types/TestSimpleTypes2.scala | 102 +-
.../simple_types/TestSimpleTypesUnparse.scala | 29 +-
.../section05/simple_types/TestUnions.scala | 5 +-
.../daffodil/section06/entities/TestEntities.scala | 63 +-
.../section06/namespaces/TestNamespaces.scala | 117 +-
.../section07/annotations/TestAnnotations.scala | 21 +-
.../section07/assertions/TestAssertions.scala | 74 +-
.../section07/defineFormat/defineFormatTests.scala | 11 +-
.../discriminators/TestDiscriminators.scala | 59 +-
.../discriminators/TestNestedChoices.scala | 1 +
.../section07/escapeScheme/TestEscapeScheme.scala | 11 +-
.../escapeScheme/TestEscapeSchemeUnparse.scala | 113 +-
.../external_variables/TestExternalVariables.scala | 3 +-
.../property_syntax/TestPropertySyntax.scala | 34 +-
.../variables/TestSetVarWithValueLength.scala | 2 +-
.../section07/variables/TestVariables.scala | 71 +-
.../property_scoping/TestPropertyScoping.scala | 59 +-
.../representation_properties/TestRepProps.scala | 13 +-
.../representation_properties/TestRepProps2.scala | 19 +-
.../TestContentFramingProperties.scala | 65 +-
.../section12/aligned_data/TestAlignedData.scala | 231 ++-
.../TestDelimiterProperties.scala | 11 +-
.../TestDelimiterPropertiesUnparse.scala | 67 +-
.../lengthKind/TestLengthKindDelimited.scala | 39 +-
.../lengthKind/TestLengthKindEndOfParent2.scala | 13 +-
.../lengthKind/TestLengthKindExplicit.scala | 79 +-
.../lengthKind/TestLengthKindImplicit.scala | 3 +-
.../lengthKind/TestLengthKindPattern.scala | 81 +-
.../lengthKind/TestLengthKindPrefixed.scala | 232 ++-
.../length_properties/TestLengthProperties.scala | 87 +-
.../daffodil/section13/boolean/TestBoolean.scala | 7 +-
.../daffodil/section13/nillable/TestNillable.scala | 7 +-
.../section13/nillable/TestNillable2.scala | 3 +-
.../section13/nillable/TestNillableUnparse.scala | 39 +-
.../daffodil/section13/packed/TestPacked.scala | 25 +-
.../text_number_props/TestTextNumberProps.scala | 515 ++++--
.../TestTextNumberPropsUnparse.scala | 85 +-
.../text_number_props/TestTextStandardBase.scala | 148 +-
.../section13/validation_errors/PadCharacter.scala | 9 +-
.../apache/daffodil/section13/zoned/TestPV.scala | 5 +-
.../daffodil/section13/zoned/TestZoned.scala | 65 +-
.../occursCountKind/TestOCKImplicit.scala | 5 +-
.../sequence_groups/TestHiddenSequences.scala | 52 +-
.../TestSequenceGroupInitiatedContent.scala | 27 +-
.../TestSequenceGroupNestedArray.scala | 3 +-
.../sequence_groups/TestSequenceGroupUnparse.scala | 11 +-
.../sequence_groups/TestSequenceGroups.scala | 64 +-
.../sequence_groups/TestSequenceGroups3.scala | 23 +-
.../TestUnorderedSequences.scala | 43 +-
.../section15/choice_groups/TestChoice.scala | 89 +-
.../section15/choice_groups/TestChoice2.scala | 15 +-
.../TestChoiceGroupInitiatedContent.scala | 83 +-
.../section15/choice_groups/TestChoiceNest.scala | 3 +-
.../choice_groups/TestHiddenChoices.scala | 40 +-
.../section15/choice_groups/TestSharedGroups.scala | 3 +-
.../choice_groups/TestUnparseChoice.scala | 5 +-
.../choice_groups/TestUnparseChoice2.scala | 25 +-
.../TestArrayOptionalElem.scala | 63 +-
.../TestUnparseArrayOptionalElem.scala | 159 +-
.../TestComputedLengthFields.scala | 22 +-
.../calc_value_properties/TestInputValueCalc.scala | 229 ++-
.../TestOutputValueCalc.scala | 63 +-
.../dfdl_expressions/TestBitFunctions.scala | 134 +-
.../dfdl_expressions/TestDFDLExpressions.scala | 1252 ++++++++++----
.../dfdl_expressions/TestDFDLExpressions2.scala | 37 +-
.../dfdl_expressions/TestDFDLExpressions3.scala | 7 +-
.../runtime_properties/TestDynamicSeparator.scala | 3 +-
.../TestRegularExpressions.scala | 15 +-
.../section31/escape_characters/TestEscapes.scala | 4 +-
.../apache/daffodil/udf/TestUdfsInSchemas.scala | 81 +-
.../daffodil/unparser/TestEnvelopePayload.scala | 5 +-
.../daffodil/unparser/TestOVCAndLength.scala | 13 +-
.../daffodil/unparser/TestParseUnparseMode.scala | 10 +-
.../daffodil/unparser/TestUnparseNegInfoset.scala | 43 +-
.../org/apache/daffodil/usertests/RC-Test.scala | 3 +-
.../org/apache/daffodil/usertests/TestCSV.scala | 3 +-
.../usertests/TestSSPNeverDiagnostic.scala | 2 +-
.../apache/daffodil/usertests/TestSepTests.scala | 11 +-
.../usertests/TestUserSubmittedTests.scala | 8 +-
.../StringFunctions/StringFunctionsProvider.scala | 17 +-
.../StringFunctions/StringFunctionsProvider.scala | 17 +-
.../StringFunctions/StringFunctionsProvider.scala | 20 +-
.../StringFunctions/StringFunctionsProvider.scala | 20 +-
.../StringFunctions/StringFunctionsProvider.scala | 21 +-
.../StringFunctions/StringFunctionsProvider.scala | 20 +-
.../IntegerFunctionsProvider.scala | 33 +-
.../StringFunctions/StringFunctionsProvider.scala | 23 +-
.../SupportedTypesFunctionsProvider.scala | 78 +-
project/Dependencies.scala | 4 +-
project/ForkCaptureLogger.scala | 3 +-
project/OsgiCheck.scala | 125 +-
project/Rat.scala | 179 +-
test-stdLayout/src/test/scala/org1/TestOrg1.scala | 7 +-
test-stdLayout/src/test/scala/org2/TestOrg2.scala | 7 +-
.../src/test/scala/org2/TestPayloadAndTypes.scala | 3 +-
.../apache/daffodil/tutorials/TestTutorials.scala | 27 +-
353 files changed, 14686 insertions(+), 6807 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index bfc223bba..e004bedf8 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -166,7 +166,7 @@ jobs:
- name: Run scalafmt Check
if: runner.os == 'Linux'
- run: $SBT scalafmtCheck
+ run: $SBT scalafmtCheckAll scalafmtSbtCheck
- name: Run Unit Tests
run: $SBT test
diff --git a/DEVELOP.md b/DEVELOP.md
index 42efcd445..579927a48 100644
--- a/DEVELOP.md
+++ b/DEVELOP.md
@@ -138,11 +138,10 @@ run `git push` from your reading copy.
### Code Style
-Daffodil mandates standard Scala formatting and its code generally
-keeps close to that formatting consistently. No one has run an
-automatic Scala formatter on the codebase yet (there has not been much
-need since the code is already formatted pretty well) but
-[DAFFODIL-2133][] is waiting for someone willing to do that work.
+Daffodil code is formatted using [Scalafmt](https://scalameta.org/scalafmt/).
+Run `sbt scalafmtCheckAll` to see if changes to the source code require
+formatting and then run `sbt scalafmtAll` to apply the changes. For
+SBT files use `sbt scalafmtSbtCheck` and `sbt scalafmtSbt`.
Daffodil mandates that at least 80% of new code and modified code
should be covered by unit tests or TDML tests. Daffodil naming
diff --git a/build.sbt b/build.sbt
index 7cae367ce..da8aed18a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import sbtcc._
-
import scala.collection.immutable.ListSet
+import sbtcc._
+
// Silence an errant sbt linter warning about unused sbt settings. For some
// reason, the sbt linter thinks the below settings are set but not used, which
// leads to a bunch of noisy warnings. But they clearly are used. Seems to be a
@@ -34,149 +34,199 @@ lazy val genProps = taskKey[Seq[File]]("Generate properties scala source")
lazy val genSchemas = taskKey[Seq[File]]("Generated DFDL schemas")
lazy val genRuntime2Examples = taskKey[Seq[File]]("Generate runtime2 example files")
-lazy val daffodil = project.in(file(".")).configs(IntegrationTest)
- .enablePlugins(JavaUnidocPlugin, ScalaUnidocPlugin)
- .aggregate(
- cli,
- core,
- io,
- japi,
- lib,
- macroLib,
- propgen,
- runtime1,
- runtime1Layers,
- runtime1Unparser,
- runtime2,
- sapi,
- schematron,
- slf4jLogger,
- tdmlLib,
- tdmlProc,
- test,
- testIBM1,
- testStdLayout,
- tutorials,
- udf,
- )
- .settings(commonSettings, nopublish, ratSettings, unidocSettings, genRuntime2ExamplesSettings)
-
-lazy val macroLib = Project("daffodil-macro-lib", file("daffodil-macro-lib")).configs(IntegrationTest)
- .settings(commonSettings, nopublish)
- .settings(libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value)
- .disablePlugins(OsgiCheckPlugin)
-
-lazy val propgen = Project("daffodil-propgen", file("daffodil-propgen")).configs(IntegrationTest)
- .settings(commonSettings, nopublish)
-
-lazy val slf4jLogger = Project("daffodil-slf4j-logger", file("daffodil-slf4j-logger")).configs(IntegrationTest)
- .settings(commonSettings)
- .settings(libraryDependencies ++= Dependencies.slf4jAPI)
-
-lazy val lib = Project("daffodil-lib", file("daffodil-lib")).configs(IntegrationTest)
- .dependsOn(macroLib % "compile-internal, test-internal", slf4jLogger % "test")
- .settings(commonSettings, libManagedSettings, usesMacros)
-
-lazy val io = Project("daffodil-io", file("daffodil-io")).configs(IntegrationTest)
- .dependsOn(lib, macroLib % "compile-internal, test-internal", slf4jLogger % "test")
- .settings(commonSettings, usesMacros)
-
-lazy val runtime1 = Project("daffodil-runtime1", file("daffodil-runtime1")).configs(IntegrationTest)
- .dependsOn(io, lib % "test->test", udf, macroLib % "compile-internal, test-internal", slf4jLogger % "test")
- .settings(commonSettings, usesMacros)
-
-lazy val runtime1Unparser = Project("daffodil-runtime1-unparser", file("daffodil-runtime1-unparser")).configs(IntegrationTest)
- .dependsOn(runtime1, lib % "test->test", runtime1 % "test->test", runtime1Layers, slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val runtime1Layers = Project("daffodil-runtime1-layers", file("daffodil-runtime1-layers")).configs(IntegrationTest)
- .dependsOn(runtime1, lib % "test->test", slf4jLogger % "test")
- .settings(commonSettings)
-
-val runtime2CFiles = Library("libruntime2.a")
-lazy val runtime2 = Project("daffodil-runtime2", file("daffodil-runtime2")).configs(IntegrationTest)
- .enablePlugins(CcPlugin)
- .dependsOn(core, core % "test->test", slf4jLogger % "test")
- .settings(commonSettings)
- .settings(
- Compile / cCompiler := sys.env.getOrElse("CC", "cc"),
- Compile / ccArchiveCommand := sys.env.getOrElse("AR", "ar"),
- Compile / ccTargets := ListSet(runtime2CFiles),
- Compile / cSources := Map(
- runtime2CFiles -> ((Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c"
- * GlobFilter("lib*") * GlobFilter("*.c")).get()
- ),
- Compile / cIncludeDirectories := Map(
- runtime2CFiles -> Seq(
- (Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c" / "libcli",
- (Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c" / "libruntime",
- )
- ),
- Compile / cFlags := (Compile / cFlags).value.withDefaultValue(Seq("-Wall", "-Wextra", "-Wpedantic", "-std=gnu11"))
- )
-
-lazy val core = Project("daffodil-core", file("daffodil-core")).configs(IntegrationTest)
- .dependsOn(runtime1Unparser, udf, lib % "test->test", runtime1 % "test->test", io % "test->test", slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val japi = Project("daffodil-japi", file("daffodil-japi")).configs(IntegrationTest)
- .dependsOn(core, slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val sapi = Project("daffodil-sapi", file("daffodil-sapi")).configs(IntegrationTest)
- .dependsOn(core, slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val tdmlLib = Project("daffodil-tdml-lib", file("daffodil-tdml-lib")).configs(IntegrationTest)
- .dependsOn(macroLib % "compile-internal", lib, io, io % "test->test", slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val tdmlProc = Project("daffodil-tdml-processor", file("daffodil-tdml-processor")).configs(IntegrationTest)
- .dependsOn(tdmlLib, runtime2, core, slf4jLogger)
- .settings(commonSettings)
-
-lazy val cli = Project("daffodil-cli", file("daffodil-cli")).configs(IntegrationTest)
- .dependsOn(tdmlProc, runtime2, sapi, japi, schematron % Runtime, udf % "it->test", slf4jLogger) // causes runtime2/sapi/japi to be pulled into the helper zip/tar
- .settings(commonSettings, nopublish)
- .settings(libraryDependencies ++= Dependencies.cli)
- .settings(libraryDependencies ++= Dependencies.exi)
-
-lazy val udf = Project("daffodil-udf", file("daffodil-udf")).configs(IntegrationTest)
- .dependsOn(slf4jLogger % "test")
- .settings(commonSettings)
-
-lazy val schematron = Project("daffodil-schematron", file("daffodil-schematron"))
- .dependsOn(lib, sapi % Test, slf4jLogger % "test")
- .settings(commonSettings)
- .settings(libraryDependencies ++= Dependencies.schematron)
- .configs(IntegrationTest)
-
-lazy val test = Project("daffodil-test", file("daffodil-test")).configs(IntegrationTest)
- .dependsOn(tdmlProc % "test", runtime2 % "test->test", udf % "test->test")
- .settings(commonSettings, nopublish)
- //
- // Uncomment the following line to run these tests
- // against IBM DFDL using the Cross Tester
- //
- //.settings(IBMDFDLCrossTesterPlugin.settings)
-
-lazy val testIBM1 = Project("daffodil-test-ibm1", file("daffodil-test-ibm1")).configs(IntegrationTest)
- .dependsOn(tdmlProc % "test")
- .settings(commonSettings, nopublish)
- //
- // Uncomment the following line to run these tests
- // against IBM DFDL using the Cross Tester
- //
- //.settings(IBMDFDLCrossTesterPlugin.settings)
-
-lazy val tutorials = Project("daffodil-tutorials", file("tutorials")).configs(IntegrationTest)
- .dependsOn(tdmlProc % "test")
- .settings(commonSettings, nopublish)
-
-lazy val testStdLayout = Project("daffodil-test-stdLayout", file("test-stdLayout")).configs(IntegrationTest)
- .dependsOn(tdmlProc % "test")
- .settings(commonSettings, nopublish)
+lazy val daffodil = project
+ .in(file("."))
+ .configs(IntegrationTest)
+ .enablePlugins(JavaUnidocPlugin, ScalaUnidocPlugin)
+ .aggregate(
+ cli,
+ core,
+ io,
+ japi,
+ lib,
+ macroLib,
+ propgen,
+ runtime1,
+ runtime1Layers,
+ runtime1Unparser,
+ runtime2,
+ sapi,
+ schematron,
+ slf4jLogger,
+ tdmlLib,
+ tdmlProc,
+ test,
+ testIBM1,
+ testStdLayout,
+ tutorials,
+ udf,
+ )
+ .settings(commonSettings, nopublish, ratSettings, unidocSettings, genRuntime2ExamplesSettings)
+
+lazy val macroLib = Project("daffodil-macro-lib", file("daffodil-macro-lib"))
+ .configs(IntegrationTest)
+ .settings(commonSettings, nopublish)
+ .settings(libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value)
+ .disablePlugins(OsgiCheckPlugin)
+
+lazy val propgen = Project("daffodil-propgen", file("daffodil-propgen"))
+ .configs(IntegrationTest)
+ .settings(commonSettings, nopublish)
+
+lazy val slf4jLogger = Project("daffodil-slf4j-logger", file("daffodil-slf4j-logger"))
+ .configs(IntegrationTest)
+ .settings(commonSettings)
+ .settings(libraryDependencies ++= Dependencies.slf4jAPI)
+
+lazy val lib = Project("daffodil-lib", file("daffodil-lib"))
+ .configs(IntegrationTest)
+ .dependsOn(macroLib % "compile-internal, test-internal", slf4jLogger % "test")
+ .settings(commonSettings, libManagedSettings, usesMacros)
+
+lazy val io = Project("daffodil-io", file("daffodil-io"))
+ .configs(IntegrationTest)
+ .dependsOn(lib, macroLib % "compile-internal, test-internal", slf4jLogger % "test")
+ .settings(commonSettings, usesMacros)
+
+lazy val runtime1 = Project("daffodil-runtime1", file("daffodil-runtime1"))
+ .configs(IntegrationTest)
+ .dependsOn(
+ io,
+ lib % "test->test",
+ udf,
+ macroLib % "compile-internal, test-internal",
+ slf4jLogger % "test",
+ )
+ .settings(commonSettings, usesMacros)
+
+lazy val runtime1Unparser =
+ Project("daffodil-runtime1-unparser", file("daffodil-runtime1-unparser"))
+ .configs(IntegrationTest)
+ .dependsOn(
+ runtime1,
+ lib % "test->test",
+ runtime1 % "test->test",
+ runtime1Layers,
+ slf4jLogger % "test",
+ )
+ .settings(commonSettings)
+
+lazy val runtime1Layers = Project("daffodil-runtime1-layers", file("daffodil-runtime1-layers"))
+ .configs(IntegrationTest)
+ .dependsOn(runtime1, lib % "test->test", slf4jLogger % "test")
+ .settings(commonSettings)
+
+val runtime2CFiles = Library("libruntime2.a")
+lazy val runtime2 = Project("daffodil-runtime2", file("daffodil-runtime2"))
+ .configs(IntegrationTest)
+ .enablePlugins(CcPlugin)
+ .dependsOn(core, core % "test->test", slf4jLogger % "test")
+ .settings(commonSettings)
+ .settings(
+ Compile / cCompiler := sys.env.getOrElse("CC", "cc"),
+ Compile / ccArchiveCommand := sys.env.getOrElse("AR", "ar"),
+ Compile / ccTargets := ListSet(runtime2CFiles),
+ Compile / cSources := Map(
+ runtime2CFiles -> ((Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c"
+ * GlobFilter("lib*") * GlobFilter("*.c")).get(),
+ ),
+ Compile / cIncludeDirectories := Map(
+ runtime2CFiles -> Seq(
+ (Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c" / "libcli",
+ (Compile / resourceDirectory).value / "org" / "apache" / "daffodil" / "runtime2" / "c" / "libruntime",
+ ),
+ ),
+ Compile / cFlags := (Compile / cFlags).value
+ .withDefaultValue(Seq("-Wall", "-Wextra", "-Wpedantic", "-std=gnu11")),
+ )
+
+lazy val core = Project("daffodil-core", file("daffodil-core"))
+ .configs(IntegrationTest)
+ .dependsOn(
+ runtime1Unparser,
+ udf,
+ lib % "test->test",
+ runtime1 % "test->test",
+ io % "test->test",
+ slf4jLogger % "test",
+ )
+ .settings(commonSettings)
+
+lazy val japi = Project("daffodil-japi", file("daffodil-japi"))
+ .configs(IntegrationTest)
+ .dependsOn(core, slf4jLogger % "test")
+ .settings(commonSettings)
+
+lazy val sapi = Project("daffodil-sapi", file("daffodil-sapi"))
+ .configs(IntegrationTest)
+ .dependsOn(core, slf4jLogger % "test")
+ .settings(commonSettings)
+
+lazy val tdmlLib = Project("daffodil-tdml-lib", file("daffodil-tdml-lib"))
+ .configs(IntegrationTest)
+ .dependsOn(macroLib % "compile-internal", lib, io, io % "test->test", slf4jLogger % "test")
+ .settings(commonSettings)
+
+lazy val tdmlProc = Project("daffodil-tdml-processor", file("daffodil-tdml-processor"))
+ .configs(IntegrationTest)
+ .dependsOn(tdmlLib, runtime2, core, slf4jLogger)
+ .settings(commonSettings)
+
+lazy val cli = Project("daffodil-cli", file("daffodil-cli"))
+ .configs(IntegrationTest)
+ .dependsOn(
+ tdmlProc,
+ runtime2,
+ sapi,
+ japi,
+ schematron % Runtime,
+ udf % "it->test",
+ slf4jLogger,
+ ) // causes runtime2/sapi/japi to be pulled into the helper zip/tar
+ .settings(commonSettings, nopublish)
+ .settings(libraryDependencies ++= Dependencies.cli)
+ .settings(libraryDependencies ++= Dependencies.exi)
+
+lazy val udf = Project("daffodil-udf", file("daffodil-udf"))
+ .configs(IntegrationTest)
+ .dependsOn(slf4jLogger % "test")
+ .settings(commonSettings)
+
+lazy val schematron = Project("daffodil-schematron", file("daffodil-schematron"))
+ .dependsOn(lib, sapi % Test, slf4jLogger % "test")
+ .settings(commonSettings)
+ .settings(libraryDependencies ++= Dependencies.schematron)
+ .configs(IntegrationTest)
+
+lazy val test = Project("daffodil-test", file("daffodil-test"))
+ .configs(IntegrationTest)
+ .dependsOn(tdmlProc % "test", runtime2 % "test->test", udf % "test->test")
+ .settings(commonSettings, nopublish)
+//
+// Uncomment the following line to run these tests
+// against IBM DFDL using the Cross Tester
+//
+//.settings(IBMDFDLCrossTesterPlugin.settings)
+lazy val testIBM1 = Project("daffodil-test-ibm1", file("daffodil-test-ibm1"))
+ .configs(IntegrationTest)
+ .dependsOn(tdmlProc % "test")
+ .settings(commonSettings, nopublish)
+//
+// Uncomment the following line to run these tests
+// against IBM DFDL using the Cross Tester
+//
+//.settings(IBMDFDLCrossTesterPlugin.settings)
+
+lazy val tutorials = Project("daffodil-tutorials", file("tutorials"))
+ .configs(IntegrationTest)
+ .dependsOn(tdmlProc % "test")
+ .settings(commonSettings, nopublish)
+
+lazy val testStdLayout = Project("daffodil-test-stdLayout", file("test-stdLayout"))
+ .configs(IntegrationTest)
+ .dependsOn(tdmlProc % "test")
+ .settings(commonSettings, nopublish)
lazy val commonSettings = Seq(
organization := "org.apache.daffodil",
@@ -197,8 +247,8 @@ lazy val commonSettings = Seq(
scmInfo := Some(
ScmInfo(
browseUrl = url("https://github.com/apache/daffodil"),
- connection = "scm:git:https://github.com/apache/daffodil"
- )
+ connection = "scm:git:https://github.com/apache/daffodil",
+ ),
),
licenses := Seq(License.Apache2),
homepage := Some(url("https://daffodil.apache.org")),
@@ -224,13 +274,14 @@ def buildScalacOptions(scalaVersion: String) = {
"-Ywarn-inaccessible",
// "-Ywarn-nullary-unit", // we cannot use this. It interferes with the Uniform Access Principle.
// See https://stackoverflow.com/questions/7600910/difference-between-function-with-parentheses-and-without.
- "-Ywarn-unused-import"
+ "-Ywarn-unused-import",
)
val scalaVersionSpecificOptions = CrossVersion.partialVersion(scalaVersion) match {
- case Some((2, 12)) => Seq(
- "-Ywarn-unused:imports"
- )
+ case Some((2, 12)) =>
+ Seq(
+ "-Ywarn-unused:imports",
+ )
case _ => Seq.empty
}
@@ -240,7 +291,7 @@ def buildScalacOptions(scalaVersion: String) = {
else
Seq.empty
- commonOptions ++ scalaVersionSpecificOptions ++ javaVersionSpecificOptions
+ commonOptions ++ scalaVersionSpecificOptions ++ javaVersionSpecificOptions
}
// Workaround issue that some options are valid for javac, not javadoc.
@@ -248,7 +299,7 @@ def buildScalacOptions(scalaVersion: String) = {
def buildJavacOptions() = {
val commonOptions = Seq(
"-Werror",
- "-Xlint:deprecation"
+ "-Xlint:deprecation",
)
val javaVersionSpecificOptions =
@@ -264,7 +315,7 @@ lazy val nopublish = Seq(
publish := {},
publishLocal := {},
publishM2 := {},
- publish / skip := true
+ publish / skip := true,
)
// "usesMacros" is a list of settings that should be applied only to
@@ -288,7 +339,8 @@ lazy val usesMacros = Seq(
// Note that for packageBin, we only copy directories and class files--this
// ignores files such a META-INFA/LICENSE and NOTICE that are duplicated and
// would otherwise cause a conflict.
- Compile / packageBin / mappings ++= (macroLib / Compile / packageBin / mappings).value.filter { case (f, _) => f.isDirectory || f.getPath.endsWith(".class") },
+ Compile / packageBin / mappings ++= (macroLib / Compile / packageBin / mappings).value
+ .filter { case (f, _) => f.isDirectory || f.getPath.endsWith(".class") },
Compile / packageSrc / mappings ++= (macroLib / Compile / packageSrc / mappings).value,
// The .classpath files that the sbt eclipse plugin creates need minor
@@ -305,7 +357,10 @@ lazy val usesMacros = Seq(
// "classpath" nodes, and appends a new "classpathentry" node as a child
// referencing the macroLib project. This causes Eclipse to treat macroLib
// just like any other dependency to allow compilation to work.
- transformNode("classpath", DefaultTransforms.Append(EclipseClasspathEntry.Project(macroLib.base.toString))),
+ transformNode(
+ "classpath",
+ DefaultTransforms.Append(EclipseClasspathEntry.Project(macroLib.base.toString)),
+ ),
),
)
@@ -315,7 +370,7 @@ lazy val libManagedSettings = Seq(
},
Compile / genProps := {
val cp = (propgen / Runtime / dependencyClasspath).value
- val inSrc = (propgen / Runtime/ sources).value
+ val inSrc = (propgen / Runtime / sources).value
val inRSrc = (propgen / Compile / resources).value
val stream = (propgen / streams).value
val outdir = (Compile / sourceManaged).value
@@ -325,8 +380,8 @@ lazy val libManagedSettings = Seq(
val cachedFun = FileFunction.cached(stream.cacheDirectory / "propgen") { _ =>
val forkCaptureLogger = ForkCaptureLogger()
val forkOpts = ForkOptions()
- .withOutputStrategy(Some(LoggedOutput(forkCaptureLogger)))
- .withBootJars(cp.files.toVector)
+ .withOutputStrategy(Some(LoggedOutput(forkCaptureLogger)))
+ .withBootJars(cp.files.toVector)
val ret = Fork.java(forkOpts, args)
forkCaptureLogger.stderr.foreach { stream.log.error(_) }
if (ret != 0) {
@@ -344,28 +399,29 @@ lazy val libManagedSettings = Seq(
val inRSrc = (propgen / Compile / resources).value
val stream = (propgen / streams).value
val outdir = (Compile / resourceManaged).value
- val filesToWatch = inRSrc.filter{_.isFile}.toSet
- val cachedFun = FileFunction.cached(stream.cacheDirectory / "schemasgen") { (schemas: Set[File]) =>
- val files = schemas.map { schema =>
- val out = outdir / "org" / "apache" / "daffodil" / "xsd" / schema.getName
- IO.copyFile(schema, out)
- out
+ val filesToWatch = inRSrc.filter { _.isFile }.toSet
+ val cachedFun =
+ FileFunction.cached(stream.cacheDirectory / "schemasgen") { (schemas: Set[File]) =>
+ val files = schemas.map { schema =>
+ val out = outdir / "org" / "apache" / "daffodil" / "xsd" / schema.getName
+ IO.copyFile(schema, out)
+ out
+ }
+ stream.log.info(s"generated ${files.size} XML schemas to $outdir")
+ files
}
- stream.log.info(s"generated ${files.size} XML schemas to $outdir")
- files
- }
cachedFun(filesToWatch).toSeq
},
Compile / sourceGenerators += (Compile / genProps).taskValue,
- Compile / resourceGenerators += (Compile / genSchemas).taskValue
+ Compile / resourceGenerators += (Compile / genSchemas).taskValue,
)
lazy val ratSettings = Seq(
ratLicenses := Seq(
- ("BSD2 ", Rat.BSD2_LICENSE_NAME, Rat.LICENSE_TEXT_PASSERA)
+ ("BSD2 ", Rat.BSD2_LICENSE_NAME, Rat.LICENSE_TEXT_PASSERA),
),
ratLicenseFamilies := Seq(
- Rat.BSD2_LICENSE_NAME
+ Rat.BSD2_LICENSE_NAME,
),
ratExcludes := Rat.excludes,
ratFailBinaries := true,
@@ -374,21 +430,25 @@ lazy val ratSettings = Seq(
lazy val unidocSettings = Seq(
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(sapi, udf),
ScalaUnidoc / unidoc / scalacOptions := Seq(
- "-doc-title", "Apache Daffodil " + version.value + " Scala API",
- "-doc-root-content", (sapi / baseDirectory).value + "/root-doc.txt"
+ "-doc-title",
+ "Apache Daffodil " + version.value + " Scala API",
+ "-doc-root-content",
+ (sapi / baseDirectory).value + "/root-doc.txt",
),
-
JavaUnidoc / unidoc / unidocProjectFilter := inProjects(japi, udf),
- JavaUnidoc / unidoc / javacOptions:= Seq(
- "-windowtitle", "Apache Daffodil " + version.value + " Java API",
- "-doctitle", "<h1>Apache Daffodil " + version.value + " Java API</h1>",
+ JavaUnidoc / unidoc / javacOptions := Seq(
+ "-windowtitle",
+ "Apache Daffodil " + version.value + " Java API",
+ "-doctitle",
+ "<h1>Apache Daffodil " + version.value + " Java API</h1>",
"-notimestamp",
"-quiet",
),
- JavaUnidoc / unidoc / unidocAllSources := (JavaUnidoc / unidoc / unidocAllSources).value.map { sources =>
- sources.filterNot { source =>
- source.toString.contains("$") || source.toString.contains("packageprivate")
- }
+ JavaUnidoc / unidoc / unidocAllSources := (JavaUnidoc / unidoc / unidocAllSources).value.map {
+ sources =>
+ sources.filterNot { source =>
+ source.toString.contains("$") || source.toString.contains("packageprivate")
+ }
},
)
@@ -402,8 +462,8 @@ lazy val genRuntime2ExamplesSettings = Seq(
val cachedFun = FileFunction.cached(stream.cacheDirectory / "genRuntime2Examples") { _ =>
val forkCaptureLogger = ForkCaptureLogger()
val forkOpts = ForkOptions()
- .withOutputStrategy(Some(LoggedOutput(forkCaptureLogger)))
- .withBootJars(cp.files.toVector)
+ .withOutputStrategy(Some(LoggedOutput(forkCaptureLogger)))
+ .withBootJars(cp.files.toVector)
val mainClass = "org.apache.daffodil.runtime2.Runtime2ExamplesGenerator"
val outdir = (runtime2 / Test / sourceDirectory).value / "c" / "examples"
val args = Seq(mainClass, outdir.toString)
@@ -412,9 +472,12 @@ lazy val genRuntime2ExamplesSettings = Seq(
if (ret != 0) {
sys.error("failed to generate example files")
}
- val files = forkCaptureLogger.stdout.filterNot(_.startsWith("WARNING")).map { f =>
- new File(f)
- }.toSet
+ val files = forkCaptureLogger.stdout
+ .filterNot(_.startsWith("WARNING"))
+ .map { f =>
+ new File(f)
+ }
+ .toSet
stream.log.info(s"generated ${files.size} runtime2 examples to $outdir")
files
}
@@ -424,5 +487,5 @@ lazy val genRuntime2ExamplesSettings = Seq(
val res = (Compile / compile).value
(Compile / genRuntime2Examples).value
res
- }
+ },
)
diff --git a/daffodil-cli/build.sbt b/daffodil-cli/build.sbt
index 559af2ff4..cf9eb8361 100644
--- a/daffodil-cli/build.sbt
+++ b/daffodil-cli/build.sbt
@@ -29,8 +29,12 @@ IntegrationTest / parallelExecution := false
// need 'sbt stage' to build the CLI for cli integration tests
(IntegrationTest / test) := (IntegrationTest / test).dependsOn(Compile / stage).value
-(IntegrationTest / testOnly) := (IntegrationTest / testOnly).dependsOn(Compile / stage).evaluated
-(IntegrationTest / testQuick) := (IntegrationTest / testQuick).dependsOn(Compile / stage).evaluated
+(IntegrationTest / testOnly) := (IntegrationTest / testOnly)
+ .dependsOn(Compile / stage)
+ .evaluated
+(IntegrationTest / testQuick) := (IntegrationTest / testQuick)
+ .dependsOn(Compile / stage)
+ .evaluated
// Add the classes in src/test/ to the IntegrationTest classpath
// so we can share CLI utliities in Util.scala
@@ -95,7 +99,8 @@ Rpm / version := {
}
rpmRelease := {
- val parts = version.value.split("-", 2) // parts(0) is the version, parse(1) is snapshot if it exists
+ val parts =
+ version.value.split("-", 2) // parts(0) is the version, parse(1) is snapshot if it exists
if (parts.length > 1) "0." + parts(1).toLowerCase else "1"
}
@@ -151,7 +156,8 @@ wixProductUpgradeId := "4C966AFF-585E-4E17-8CC2-059FD70FEC77"
lightOptions ++= Seq(
"-sval", // validation does not currently work under Wine, this disables that
"-sice:ICE61",
- "-loc", ((Windows / sourceDirectory).value / "Product_en-us.wxl").toString
+ "-loc",
+ ((Windows / sourceDirectory).value / "Product_en-us.wxl").toString,
)
// Build an RTF version of the license file for display in the license
@@ -195,13 +201,16 @@ wixFiles ++= Seq(
// before they can invoke Daffodil anyway.
wixFeatures := {
val features = wixFeatures.value
- features.filter { _.id != "AddConfigLinks"}
+ features.filter { _.id != "AddConfigLinks" }
}
// Make sure that we don't use an MSI installer that is older than
// version 2.0. It also fixes the comment attribute that hangs
// out on the Package keyword.
-wixPackageInfo := wixPackageInfo.value.copy(installerVersion = "200", comments = "!(loc.Comments)")
+wixPackageInfo := wixPackageInfo.value.copy(
+ installerVersion = "200",
+ comments = "!(loc.Comments)",
+)
// Fix the XML that is associated with the installable files and directories.
wixProductConfig := {
@@ -210,19 +219,26 @@ wixProductConfig := {
// Replace the default headline banner and Welcome/Exit screen
// bitmaps with the custom ones we developed for Daffodil.
- val banner = <WixVariable Id="WixUIBannerBmp" Value={ ((Windows / sourceDirectory).value / "banner.bmp").toString } />
- val dialog = <WixVariable Id="WixUIDialogBmp" Value={ ((Windows / sourceDirectory).value / "dialog.bmp").toString } />
+ val banner = <WixVariable Id="WixUIBannerBmp" Value={
+ ((Windows / sourceDirectory).value / "banner.bmp").toString
+ } />
+ val dialog = <WixVariable Id="WixUIDialogBmp" Value={
+ ((Windows / sourceDirectory).value / "dialog.bmp").toString
+ } />
// Reference the Daffodil-specific User Interface (dialog box) sequence.
val ui = <UI><UIRef Id="WixUI_Daffodil" /></UI>
// Make sure we abort if we are not installing on Windows 95 or later.
- val osCondition = <Condition Message="!(loc.OS2Old)"><![CDATA[Installed OR (VersionNT >= 400)]]></Condition>
+ val osCondition =
+ <Condition Message="!(loc.OS2Old)"><![CDATA[Installed OR (VersionNT >= 400)]]></Condition>
// Define icons (ID should not be longer than 18 chars and must end with ".exe")
val icon = Seq(
- <Icon Id="Daffodil.ico" SourceFile={ ((Windows / sourceDirectory).value / "apache-daffodil.ico").toString } />,
- <Property Id="ARPPRODUCTICON" Value="Daffodil.ico" />
+ <Icon Id="Daffodil.ico" SourceFile={
+ ((Windows / sourceDirectory).value / "apache-daffodil.ico").toString
+ } />,
+ <Property Id="ARPPRODUCTICON" Value="Daffodil.ico" />,
)
// String together the additional XML around the generated directory and file lists.
@@ -255,12 +271,18 @@ wixProductConfig := {
// Fixup for registry key.
case e: scala.xml.Elem if e.label == "RegistryValue" => {
val attribs = e.attributes.remove("Key")
- e % scala.xml.Attribute("", "Key", """Software\Apache\Installed Products\Daffodil""", attribs)
+ e % scala.xml.Attribute(
+ "",
+ "Key",
+ """Software\Apache\Installed Products\Daffodil""",
+ attribs,
+ )
}
// The WixUI_FeatureTree reference has to be removed so that
// our custom Daffodil UI can operate properly.
- case e: scala.xml.Elem if e.label == "UIRef" && (e \ "@Id").text == "WixUI_FeatureTree" => {
+ case e: scala.xml.Elem
+ if e.label == "UIRef" && (e \ "@Id").text == "WixUI_FeatureTree" => {
scala.xml.NodeSeq.Empty
}
case `n` => n
diff --git a/daffodil-cli/src/it/scala/org/apache/daffodil/cliTest/TestCLIUdfs.scala b/daffodil-cli/src/it/scala/org/apache/daffodil/cliTest/TestCLIUdfs.scala
index 81056339d..182f6d999 100644
--- a/daffodil-cli/src/it/scala/org/apache/daffodil/cliTest/TestCLIUdfs.scala
+++ b/daffodil-cli/src/it/scala/org/apache/daffodil/cliTest/TestCLIUdfs.scala
@@ -18,9 +18,11 @@
package org.apache.daffodil.cliTest
import java.nio.file.Path
-import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
+
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestCLIUdfs {
@@ -41,7 +43,9 @@ class TestCLIUdfs {
* no User Defined Function calls, so they don't get loaded
*/
@Test def test_noUdfsLoaded_regular_schema(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
runCLI(args"-v parse -s $schema -r fn_func") { cli =>
cli.send("strng", inputDone = true)
@@ -49,7 +53,7 @@ class TestCLIUdfs {
cli.expect("<data>strng</data>")
cli.expect("<value>Hello,strng</value>")
cli.expect("</fn_func>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
/**
@@ -57,12 +61,14 @@ class TestCLIUdfs {
* User Defined Function call
*/
@Test def test_noUdfsLoaded_udf_schema(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
runCLI(args"-v parse -s $schema -r user_func1") { cli =>
cli.send("strng", inputDone = true)
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -73,15 +79,23 @@ class TestCLIUdfs {
* The schema makes a User Defined Function call
*/
@Test def test_noUdfsLoaded_MissingClassInMetaInfFile(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/resources/org/badmetainf/nonexistentclass/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/resources/org/badmetainf/nonexistentclass/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
cli.send("strng", inputDone = true)
- cli.expectErr("[warn] User Defined Function Provider failed to load: org.apache.daffodil.udf.UserDefinedFunctionProvider:")
- cli.expectErr("Provider org.nonexistentclass.example.StringFunctions.StringFunctionsProvider not found")
+ cli.expectErr(
+ "[warn] User Defined Function Provider failed to load: org.apache.daffodil.udf.UserDefinedFunctionProvider:",
+ )
+ cli.expectErr(
+ "Provider org.nonexistentclass.example.StringFunctions.StringFunctionsProvider not found",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -89,45 +103,59 @@ class TestCLIUdfs {
* file, but a schema makes a User Defined Function call
*/
@Test def test_noUdfsLoaded_MissingMetaInfFile(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
val classpath = udfClasspath()
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
cli.send("strng", inputDone = true)
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
* Tests the case when a User Defined Function Provider returns null for its list of UDFs
*/
@Test def test_UDFPClass_NoUdfClasses(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/java/org/badudfs/functionclasses1/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/java/org/badudfs/functionclasses1/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
cli.send("strng", inputDone = true)
- cli.expectErr("[warn] User Defined Function Provider ignored:" +
- " org.badudfs.functionclasses1.StringFunctions.StringFunctionsProvider." +
- " No User Defined Functions found.")
+ cli.expectErr(
+ "[warn] User Defined Function Provider ignored:" +
+ " org.badudfs.functionclasses1.StringFunctions.StringFunctionsProvider." +
+ " No User Defined Functions found.",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
* Tests the case when a User Defined Function Provider returns an empty list of UDFs
*/
@Test def test_UDFPClass_emptyUdfClasses(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/java/org/badudfs/functionclasses2/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/java/org/badudfs/functionclasses2/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
cli.sendLine("strng", inputDone = true)
- cli.expectErr("[warn] User Defined Function Provider ignored:" +
- " org.badudfs.functionclasses2.StringFunctions.StringFunctionsProvider." +
- " No User Defined Functions found.")
+ cli.expectErr(
+ "[warn] User Defined Function Provider ignored:" +
+ " org.badudfs.functionclasses2.StringFunctions.StringFunctionsProvider." +
+ " No User Defined Functions found.",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -135,18 +163,26 @@ class TestCLIUdfs {
* interface
*/
@Test def test_UDFClass_nonUDF(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/java/org/badudfs/nonUDF/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/java/org/badudfs/nonUDF/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.nonUDF.StringFunctions.FuncA." +
- " Doesn't implement org.apache.daffodil.udf.UserDefinedFunction")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.nonUDF.StringFunctions.Replace." +
- " Doesn't implement org.apache.daffodil.udf.UserDefinedFunction")
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.nonUDF.StringFunctions.FuncA." +
+ " Doesn't implement org.apache.daffodil.udf.UserDefinedFunction",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.nonUDF.StringFunctions.Replace." +
+ " Doesn't implement org.apache.daffodil.udf.UserDefinedFunction",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -154,21 +190,31 @@ class TestCLIUdfs {
* annotstion fields
*/
@Test def test_UDFClass_nonAnn(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/java/org/badudfs/annotations/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/java/org/badudfs/annotations/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.annotations.StringFunctions.FuncB." +
- " Missing org.apache.daffodil.udf.UserDefinedFunctionIdentification annotation")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.annotations.StringFunctions.Compare." +
- " Annotation namespace field is empty or invalid.")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.annotations.StringFunctions.Replace." +
- " Annotation name field is empty or invalid.")
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.annotations.StringFunctions.FuncB." +
+ " Missing org.apache.daffodil.udf.UserDefinedFunctionIdentification annotation",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.annotations.StringFunctions.Compare." +
+ " Annotation namespace field is empty or invalid.",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.annotations.StringFunctions.Replace." +
+ " Annotation name field is empty or invalid.",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -179,30 +225,46 @@ class TestCLIUdfs {
* has unsupported return type
*/
@Test def test_UDFClass_noEvaluate(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/java/org/badudfs/evaluate/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/java/org/badudfs/evaluate/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func1", classpath) { cli =>
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.Replace." +
- " Missing evaluate method: urn:example:com:ext:badudfs:stringfunctions:replace")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.FuncA." +
- " Overloaded evaluate method: urn:example:com:ext:badudfs:stringfunctions:funcA")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.FuncB." +
- " Unsupported return type: void")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.FuncC." +
- " Unsupported parameter type(s): String[],int[]")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.FuncD." +
- " Unsupported parameter type(s): String[]")
- cli.expectErr("[warn] User Defined Function ignored:" +
- " org.badudfs.evaluate.StringFunctions.FuncE." +
- " Unsupported return type: String[]")
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.Replace." +
+ " Missing evaluate method: urn:example:com:ext:badudfs:stringfunctions:replace",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.FuncA." +
+ " Overloaded evaluate method: urn:example:com:ext:badudfs:stringfunctions:funcA",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.FuncB." +
+ " Unsupported return type: void",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.FuncC." +
+ " Unsupported parameter type(s): String[],int[]",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.FuncD." +
+ " Unsupported parameter type(s): String[]",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function ignored:" +
+ " org.badudfs.evaluate.StringFunctions.FuncE." +
+ " Unsupported return type: String[]",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: jsudf:replace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -210,14 +272,22 @@ class TestCLIUdfs {
* throws custom error on evaluate
*/
@Test def test_UDFClass_CustomExceptionOnEvaluate(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions/evaluating/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions/evaluating/StringFunctions/",
+ )
runCLI(args"parse -s $schema -r user_func2", classpath) { cli =>
cli.send("strng", inputDone = true)
- cli.expectErr("[error] User Defined Function 'ssudf:reverse' Error. Cause: org.sbadudfs.udfexceptions.evaluating.StringFunctions.Reverse$CustomException: UDF Error!")
- cli.expectErr("at org.sbadudfs.udfexceptions.evaluating.StringFunctions.Reverse.evaluate(StringFunctionsProvider.scala:56)")
- } (ExitCode.UserDefinedFunctionError)
+ cli.expectErr(
+ "[error] User Defined Function 'ssudf:reverse' Error. Cause: org.sbadudfs.udfexceptions.evaluating.StringFunctions.Reverse$CustomException: UDF Error!",
+ )
+ cli.expectErr(
+ "at org.sbadudfs.udfexceptions.evaluating.StringFunctions.Reverse.evaluate(StringFunctionsProvider.scala",
+ )
+ }(ExitCode.UserDefinedFunctionError)
}
/**
@@ -225,12 +295,18 @@ class TestCLIUdfs {
* throws processing error on evaluate
*/
@Test def test_UDFClass_ProcessingErrorOnEvaluate(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions/evaluating/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions/evaluating/StringFunctions/",
+ )
runCLI(args"parse -s $schema -r user_func3", classpath) { cli =>
- cli.expectErr("[error] Schema Definition Error: User Defined Function 'ssudf:rev-words' Error: UDF PE!")
- } (ExitCode.UnableToCreateProcessor)
+ cli.expectErr(
+ "[error] Schema Definition Error: User Defined Function 'ssudf:rev-words' Error: UDF PE!",
+ )
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -238,14 +314,24 @@ class TestCLIUdfs {
* throws an error while being loaded
*/
@Test def test_UDFClass_exceptionOnLoad(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions2/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/udfexceptions2/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func3", classpath) { cli =>
- cli.expectErr("[error] User Defined Function could not be initialized: {http://example.com/scala/udf}rev-words.")
- cli.expectErr("Cause: org.sbadudfs.udfexceptions2.StringFunctions.ReverseWords$CustomException: UDF Error!")
- cli.expectErr("at org.sbadudfs.udfexceptions2.StringFunctions.ReverseWords.<init>(StringFunctionsProvider.scala:65)")
- } (ExitCode.UserDefinedFunctionError)
+ cli.expectErr(
+ "[error] User Defined Function could not be initialized: {http://example.com/scala/udf}rev-words.",
+ )
+ cli.expectErr(
+ "Cause: org.sbadudfs.udfexceptions2.StringFunctions.ReverseWords$CustomException: UDF Error!",
+ )
+ cli.expectErr(
+ "at org.sbadudfs.udfexceptions2.StringFunctions.ReverseWords.<init>(StringFunctionsProvider.scala",
+ )
+ }(ExitCode.UserDefinedFunctionError)
}
/**
@@ -253,16 +339,22 @@ class TestCLIUdfs {
* throws an error while loading its UDFs
*/
@Test def test_UDFPClass_exceptionOnLoadingUDFs(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/udfpexceptions/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/udfpexceptions/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func3", classpath) { cli =>
cli.expectErr("[warn] User Defined Function Provider ignored:")
cli.expectErr("org.sbadudfs.udfpexceptions.StringFunctions.StringFunctionsProvider")
cli.expectErr("Error loading User Defined Functions:")
- cli.expectErr("org.sbadudfs.udfpexceptions.StringFunctions.StringFunctionsProvider$CustomException")
+ cli.expectErr(
+ "org.sbadudfs.udfpexceptions.StringFunctions.StringFunctionsProvider$CustomException",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: ssudf:rev-words")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -270,14 +362,22 @@ class TestCLIUdfs {
* throws an error while being loaded
*/
@Test def test_UDFPClass_exceptionOnLoad(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/udfpexceptions2/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/udfpexceptions2/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func3", classpath) { cli =>
- cli.expectErr("[warn] User Defined Function Provider failed to load: org.apache.daffodil.udf.UserDefinedFunctionProvider")
- cli.expectErr("Provider org.sbadudfs.udfpexceptions2.StringFunctions.StringFunctionsProvider could not be instantiated")
+ cli.expectErr(
+ "[warn] User Defined Function Provider failed to load: org.apache.daffodil.udf.UserDefinedFunctionProvider",
+ )
+ cli.expectErr(
+ "Provider org.sbadudfs.udfpexceptions2.StringFunctions.StringFunctionsProvider could not be instantiated",
+ )
cli.expectErr("[error] Schema Definition Error: Unsupported function: ssudf:rev-words")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -286,15 +386,21 @@ class TestCLIUdfs {
* class object
*/
@Test def test_UDFPClass_incorrectUDFObject(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/functionclasses/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/functionclasses/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func3", classpath) { cli =>
- cli.expectErr("[warn] User Defined Function class mismatch: {http://example.com/scala/udf}rev-words.")
+ cli.expectErr(
+ "[warn] User Defined Function class mismatch: {http://example.com/scala/udf}rev-words.",
+ )
cli.expectErr("Expected: class org.sbadudfs.functionclasses.StringFunctions.ReverseWords")
cli.expectErr("Actual: class org.sbadudfs.functionclasses.StringFunctions.Reverse")
cli.expectErr("[error] Schema Definition Error: Unsupported function: ssudf:rev-words")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -302,14 +408,24 @@ class TestCLIUdfs {
* incorrectly implements createUserDefinedFunction that results in an exception
*/
@Test def test_UDFPClass_incorrectUDFCreateImplementation(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/functionclasses/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/functionclasses/StringFunctions/",
+ )
runCLI(args"-v parse -s $schema -r user_func2", classpath) { cli =>
- cli.expectErr("[error] User Defined Function could not be initialized: {http://example.com/scala/udf}reverse.")
- cli.expectErr("Cause: scala.MatchError: http://example.com/scala/udf:reverse (of class java.lang.String)")
- cli.expectErr("at org.sbadudfs.functionclasses.StringFunctions.StringFunctionsProvider.createUserDefinedFunction(StringFunctionsProvider.scala:34)")
- } (ExitCode.UserDefinedFunctionError)
+ cli.expectErr(
+ "[error] User Defined Function could not be initialized: {http://example.com/scala/udf}reverse.",
+ )
+ cli.expectErr(
+ "Cause: scala.MatchError: http://example.com/scala/udf:reverse (of class java.lang.String)",
+ )
+ cli.expectErr(
+ "at org.sbadudfs.functionclasses.StringFunctions.StringFunctionsProvider.createUserDefinedFunction(StringFunctionsProvider.scala",
+ )
+ }(ExitCode.UserDefinedFunctionError)
}
/**
@@ -317,16 +433,30 @@ class TestCLIUdfs {
* contains a non serializable member
*/
@Test def test_UDFClass_serializability(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/functionclasses2/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/functionclasses2/StringFunctions/",
+ )
runCLI(args"-vv save-parser -s $schema -r user_func4", classpath) { cli =>
- cli.expectErr("[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState => {http://example.com/scala/udf}get-nonserializable-state")
- cli.expectErr("[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetSerializableState => {http://example.com/scala/udf}get-serializable-state")
- cli.expectErr("[warn] User Defined Function is not serializable: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState.")
- cli.expectErr("Could not serialize member of class: org.sbadudfs.functionclasses2.StringFunctions.SomeNonSerializableClass")
- cli.expectErr("[error] Schema Definition Error: Unsupported function: ssudf:get-nonserializable-state")
- } (ExitCode.UnableToCreateProcessor)
+ cli.expectErr(
+ "[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState => {http://example.com/scala/udf}get-nonserializable-state",
+ )
+ cli.expectErr(
+ "[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetSerializableState => {http://example.com/scala/udf}get-serializable-state",
+ )
+ cli.expectErr(
+ "[warn] User Defined Function is not serializable: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState.",
+ )
+ cli.expectErr(
+ "Could not serialize member of class: org.sbadudfs.functionclasses2.StringFunctions.SomeNonSerializableClass",
+ )
+ cli.expectErr(
+ "[error] Schema Definition Error: Unsupported function: ssudf:get-nonserializable-state",
+ )
+ }(ExitCode.UnableToCreateProcessor)
}
/**
@@ -334,14 +464,22 @@ class TestCLIUdfs {
* contains serializable member
*/
@Test def test_UDFClass_serializability2(): Unit = {
- val schema = path("daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd")
- val classpath = udfClasspath("daffodil-udf/src/test/scala/org/sbadudfs/functionclasses2/StringFunctions/")
+ val schema = path(
+ "daffodil-udf/src/test/resources/org/apache/daffodil/udf/genericUdfSchema.xsd",
+ )
+ val classpath = udfClasspath(
+ "daffodil-udf/src/test/scala/org/sbadudfs/functionclasses2/StringFunctions/",
+ )
withTempFile { parser =>
runCLI(args"-vv save-parser -s $schema -r user_func5 $parser", classpath) { cli =>
- cli.expectErr("[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState => {http://example.com/scala/udf}get-nonserializable-state")
- cli.expectErr("[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetSerializableState => {http://example.com/scala/udf}get-serializable-state")
- } (ExitCode.Success)
+ cli.expectErr(
+ "[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetNonSerializableState => {http://example.com/scala/udf}get-nonserializable-state",
+ )
+ cli.expectErr(
+ "[debug] User Defined Function loaded: org.sbadudfs.functionclasses2.StringFunctions.GetSerializableState => {http://example.com/scala/udf}get-serializable-state",
+ )
+ }(ExitCode.Success)
runCLI(args"-v parse -P $parser", classpath) { cli =>
cli.send("strng", inputDone = true)
@@ -349,7 +487,7 @@ class TestCLIUdfs {
cli.expect("<data>strng</data>")
cli.expect("<value>Serializable State</value>")
cli.expect("</user_func5>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestBlob.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestBlob.scala
index 9efd5b324..61d514e4e 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestBlob.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestBlob.scala
@@ -21,14 +21,15 @@ import java.net.URI
import java.nio.file.Files.exists
import java.nio.file.Path
import java.nio.file.Paths
-import org.apache.commons.io.FileUtils
-import org.junit.Test
-import org.junit.Assume.assumeTrue
-import org.junit.Assert.assertEquals
-
import scala.io.Source
-import org.apache.daffodil.cli.cliTest.Util._
+
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.apache.commons.io.FileUtils
+import org.junit.Assert.assertEquals
+import org.junit.Assume.assumeTrue
+import org.junit.Test
class TestBlob {
@@ -81,7 +82,9 @@ class TestBlob {
*
***/
@Test def test_1MB_blob(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/large_blob.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/large_blob.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/1MB.bin")
assumeTrue("large test input file must be manually generated", exists(input))
@@ -89,11 +92,9 @@ class TestBlob {
withTempFile { infoset =>
withTempFile { unparse =>
withBlobDir {
- runCLI(args"parse -s $schema -o $infoset $input") { cli =>
- } (ExitCode.Success)
+ runCLI(args"parse -s $schema -o $infoset $input") { cli => }(ExitCode.Success)
- runCLI(args"unparse -s $schema -o $unparse $infoset") { cli =>
- } (ExitCode.Success)
+ runCLI(args"unparse -s $schema -o $unparse $infoset") { cli => }(ExitCode.Success)
val blob = findInfosetBlob(infoset)
assertEquals("bc8f9d01382bf12248747cd6faecbc59", md5sum(blob))
@@ -110,7 +111,9 @@ class TestBlob {
*
***/
@Test def test_2GB_blob(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/large_blob.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/large_blob.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/2049MB.bin")
assumeTrue("large test input file must be manually generated", exists(input))
@@ -118,11 +121,13 @@ class TestBlob {
withTempFile { infoset =>
withTempFile { unparse =>
withBlobDir {
- runCLI(args"parse -s $schema -o $infoset $input", timeout = 120) { cli =>
- } (ExitCode.Success)
+ runCLI(args"parse -s $schema -o $infoset $input", timeout = 120) { cli => }(
+ ExitCode.Success,
+ )
- runCLI(args"unparse -s $schema -o $unparse $infoset", timeout = 120) { cli =>
- } (ExitCode.Success)
+ runCLI(args"unparse -s $schema -o $unparse $infoset", timeout = 120) { cli => }(
+ ExitCode.Success,
+ )
val blob = findInfosetBlob(infoset)
assertEquals("c5675d3317725595d128af56a624c49f", md5sum(blob))
@@ -141,7 +146,9 @@ class TestBlob {
*
***/
@Test def test_blob_backtracking(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/blob_backtracking.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/blob_backtracking.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/2049MB.bin")
assumeTrue("large test input file must be manually generated", exists(input))
@@ -149,7 +156,7 @@ class TestBlob {
withBlobDir {
runCLI(args"parse -s $schema $input", timeout = 120) { cli =>
cli.expectErr("Attempted to backtrack too far")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
}
}
@@ -162,7 +169,9 @@ class TestBlob {
*
***/
@Test def test_blob_backtracking_streaming_fail(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/blob_backtracking.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/blob_backtracking.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/2049MB.bin")
assumeTrue("large test input file must be manually generated", exists(input))
@@ -171,7 +180,7 @@ class TestBlob {
runCLI(args"parse -s $schema", timeout = 120) { cli =>
cli.sendFile(input, inputDone = true)
cli.expectErr("Attempted to backtrack too far")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIDebugger.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIDebugger.scala
index 7c1325df1..0357050d3 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIDebugger.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIDebugger.scala
@@ -17,18 +17,21 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-
-import java.nio.file.Files
import java.nio.charset.StandardCharsets.UTF_8
-import net.sf.expectit.matcher.Matchers.regexp
-import org.apache.daffodil.cli.cliTest.Util._
+import java.nio.file.Files
+
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import net.sf.expectit.matcher.Matchers.regexp
+import org.junit.Test
class TestCLIdebugger {
@Test def test_3385_CLI_Debugger_invalidExpressions(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -39,7 +42,9 @@ class TestCLIdebugger {
cli.expect("(debug)")
cli.sendLine("eval (func())")
- cli.expect("error: expression evaluation failed: Schema Definition Error: Unsupported function:")
+ cli.expect(
+ "error: expression evaluation failed: Schema Definition Error: Unsupported function:",
+ )
cli.expect("(debug)")
cli.sendLine("eval (/invalid!)")
@@ -55,11 +60,13 @@ class TestCLIdebugger {
cli.expect("(debug)")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_1591_CLI_Debugger_invalidCommandError(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -67,11 +74,13 @@ class TestCLIdebugger {
cli.sendLine("garbage")
cli.expect("error: undefined command: garbage")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_1335_CLI_Debugger_dataAndWrapLength(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -86,22 +95,26 @@ class TestCLIdebugger {
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_982_CLI_Debugger_simpleDebugger(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
cli.expect("(debug)")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1326_CLI_Debugger_displaysTesting(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -132,11 +145,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("matrix")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1339_CLI_Debugger_removeHidden(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input6.txt")
runCLI(args"-d parse -s $schema -r e $input") { cli =>
@@ -152,11 +167,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<sneaky>5</sneaky>\n")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_3268_CLI_Debugger_removeHidden2(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input6.txt")
runCLI(args"-d parse -s $schema -r e $input") { cli =>
@@ -170,11 +187,13 @@ class TestCLIdebugger {
val result = cli.expect("</ex:e>").getBefore();
assert(!result.contains("sneaky"))
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1331_CLI_Debugger_breakpointTesting4(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input3.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -219,11 +238,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<tns:cell>3</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1463_CLI_Debugger_breakOnValueOfElement(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input3.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -269,11 +290,13 @@ class TestCLIdebugger {
cli.expect("</tns:matrix>")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_1338_CLI_Debugger_pointsOfUncertaintyInfo(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input5.txt")
runCLI(args"-d parse -s $schema -r Item2 $input") { cli =>
@@ -294,11 +317,13 @@ class TestCLIdebugger {
cli.expect("(none)")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_1328_CLI_Debugger_breakpointTesting(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -328,11 +353,13 @@ class TestCLIdebugger {
cli.sendLine("delete breakpoint 1")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1329_CLI_Debugger_breakpointTesting2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -357,11 +384,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<tns:cell>6</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Debugger_SDE_message(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -369,18 +398,22 @@ class TestCLIdebugger {
cli.sendLine("display info infoset")
cli.sendLine("break cell")
- cli.sendLine("condition 1 fn:count(../cell) eq 3") // ../cell is wrong. Needs to be ../tns:cell
+ cli.sendLine(
+ "condition 1 fn:count(../cell) eq 3",
+ ) // ../cell is wrong. Needs to be ../tns:cell
cli.sendLine("continue")
cli.expect("Schema Definition Error")
cli.expect("{}cell")
cli.expect("tns:cell")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1330_CLI_Debugger_breakpointTesting3(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -409,11 +442,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<tns:cell>6</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1333_CLI_Debugger_settingInfosetLines(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input3.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -445,11 +480,13 @@ class TestCLIdebugger {
cli.sendLine("disable breakpoint 1")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1334_CLI_Debugger_infoBitPosition(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -470,11 +507,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1337_CLI_Debugger_childIndex(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input4.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -496,11 +535,13 @@ class TestCLIdebugger {
cli.sendLine("disable breakpoint 1")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1340_CLI_Debugger_infoPath(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -519,11 +560,13 @@ class TestCLIdebugger {
cli.expect("""<tns:matrix xmlns:tns="http://www.example.org/example1/">""")
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1382_CLI_Debugger_dataAndWrapLength2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -541,11 +584,13 @@ class TestCLIdebugger {
cli.sendLine("disable breakpoint 1")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1863_CLI_Debugger_groupIndex01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input9.txt")
runCLI(args"-d parse -r list -s $schema $input") { cli =>
@@ -567,11 +612,13 @@ class TestCLIdebugger {
cli.expect("groupIndex: 4")
cli.sendLine("continue")
cli.expect("<ex:price>89.99</ex:price>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1029_CLI_Debugger_validation1(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input9.txt")
runCLI(args"-d parse -r list -s $schema $input") { cli =>
@@ -584,11 +631,13 @@ class TestCLIdebugger {
cli.sendLine("display break")
cli.expect("error: undefined command: break")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_3258_CLI_Debugger_infodata(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -604,14 +653,20 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect(""" │ │""")
- cli.expect(""" 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0~1~2~3~4~5~6~7~8~9~a~b~c~d~e~f~""")
- cli.expect(""" 00000000: 302c 312c 322c 332c 342c 352c 36 0~,~1~,~2~,~3~,~4~,~5~,~6~ """)
+ cli.expect(
+ """ 87654321 0011 2233 4455 6677 8899 aabb ccdd eeff 0~1~2~3~4~5~6~7~8~9~a~b~c~d~e~f~""",
+ )
+ cli.expect(
+ """ 00000000: 302c 312c 322c 332c 342c 352c 36 0~,~1~,~2~,~3~,~4~,~5~,~6~ """,
+ )
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3264_CLI_Debugger_undefined_command(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -625,11 +680,13 @@ class TestCLIdebugger {
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Debugger_delimiterStack(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input2.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -656,12 +713,16 @@ class TestCLIdebugger {
cli.expect("local: , (separator)")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_utf16_encoding(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/utf16schema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/hextest.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/utf16schema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/hextest.txt",
+ )
runCLI(args"-d parse -s $schema -r e2 $input") { cli =>
cli.expect("(debug)")
@@ -670,11 +731,13 @@ class TestCLIdebugger {
cli.expect("\u240A")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_1337_CLI_Debugger_info_infoset(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -688,11 +751,13 @@ class TestCLIdebugger {
cli.expect("matrix")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_InfoHidden_1(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequencesWithHiddenRefs.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequencesWithHiddenRefs.dfdl.xsd",
+ )
withTempFile { input =>
Files.write(input, "2~3".getBytes(UTF_8))
@@ -718,12 +783,14 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<f xmlns=\"\">2</f>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_CLI_Debugger_InfoHidden_2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequencesWithHiddenRefs.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section14/sequence_groups/SequencesWithHiddenRefs.dfdl.xsd",
+ )
withTempFile { input =>
Files.write(input, "2~3".getBytes(UTF_8))
@@ -749,12 +816,14 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<f xmlns=\"\">3</f>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_CLI_Debugger_InfoHidden_3(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/ChoicesInHiddenContexts.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/ChoicesInHiddenContexts.dfdl.xsd",
+ )
withTempFile { input =>
Files.write(input, "2,3".getBytes(UTF_8))
@@ -787,12 +856,14 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<a>2</a>")
cli.expect("<g></g>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_CLI_Debugger_InfoHidden_4(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/ChoicesInHiddenContexts.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section15/choice_groups/ChoicesInHiddenContexts.dfdl.xsd",
+ )
withTempFile { input =>
Files.write(input, "[6~]9".getBytes(UTF_8))
@@ -853,13 +924,17 @@ class TestCLIdebugger {
cli.sendLine("continue")
cli.expect("<h></h>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_3585_CLI_Debugger_simpleDebugger_unparse(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt",
+ )
runCLI(args"-d unparse -s $schema -r e1 $input") { cli =>
cli.expect("(debug)")
@@ -870,11 +945,13 @@ class TestCLIdebugger {
cli.sendLine("info data")
cli.expect("4865 6c6c 6f Hello")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_3585_CLI_Debugger_prefixLength(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/prefixed_length.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/prefixed_length.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/prefix.txt")
runCLI(args"-d parse -s $schema $input") { cli =>
@@ -892,11 +969,13 @@ class TestCLIdebugger {
cli.expect("<field>abcd</field>")
cli.sendLine("complete")
cli.expect("<field>abcd</field>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Debugger_info_variables(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -904,11 +983,13 @@ class TestCLIdebugger {
cli.sendLine("info variables byteOrder")
cli.expect("byteOrder: bigEndian (default)")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_data_text(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -918,11 +999,13 @@ class TestCLIdebugger {
cli.sendLine("step")
cli.expect("0~,~1~,~2~")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_data_binary(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -932,11 +1015,13 @@ class TestCLIdebugger {
cli.sendLine("step")
cli.expect("302c 312c 32")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_diff_01(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables_01.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/variables/variables_01.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r c $input") { cli =>
@@ -958,11 +1043,13 @@ class TestCLIdebugger {
cli.sendLine("step")
cli.expect("<d>42</d>")
cli.expect("<e>42</e>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_CLI_Debugger_info_diff_02(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"-d parse -s $schema -r matrix $input") { cli =>
@@ -990,11 +1077,13 @@ class TestCLIdebugger {
cli.expect("foundDelimiter: (no value) -> ,")
cli.expect("foundField: (no value) -> 1")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_diff_03(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input6.txt")
runCLI(args"-d parse -s $schema -r e $input") { cli =>
@@ -1016,12 +1105,16 @@ class TestCLIdebugger {
cli.sendLine("step")
cli.expect("hidden: true -> false")
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_diff_04(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml",
+ )
runCLI(args"-d unparse -s $schema -r matrix -o $devNull $input") { cli =>
cli.expect("(debug)")
@@ -1051,12 +1144,16 @@ class TestCLIdebugger {
cli.expect(regexp("Suppressable.* for cell"))
cli.expect(regexp("RegionSplit.* for cell"))
cli.sendLine("quit")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_Debugger_info_diff_05(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input9.txt.xml")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_03.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input9.txt.xml",
+ )
runCLI(args"-d unparse -r list -s $schema -o $devNull $input") { cli =>
cli.expect("(debug)")
@@ -1083,30 +1180,38 @@ class TestCLIdebugger {
cli.sendLine("step")
cli.sendLine("step")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Debugger_parse_unparser_not_available(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input3.txt")
runCLI(args"-d parse -s $schema $input") { cli =>
cli.expect("(debug)")
cli.sendLine("info parser")
- cli.expect("parser: <Element name='matrix'><DelimiterStackParser>...</DelimiterStackParser></Element>")
+ cli.expect(
+ "parser: <Element name='matrix'><DelimiterStackParser>...</DelimiterStackParser></Element>",
+ )
cli.sendLine("info unparser")
cli.expect("unparser: not available")
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Debugger_unparse_parser_not_available(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml",
+ )
runCLI(args"-d unparse -s $schema $input") { cli =>
cli.expect("(debug)")
@@ -1119,7 +1224,7 @@ class TestCLIdebugger {
cli.sendLine("continue")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIGenerateC.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIGenerateC.scala
index 67333b15e..9990751c2 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIGenerateC.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIGenerateC.scala
@@ -18,10 +18,12 @@
package org.apache.daffodil.cliTest
import java.nio.file.Files.exists
-import org.junit.Test
-import org.junit.Assert.assertTrue
-import org.apache.daffodil.cli.cliTest.Util._
+
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Assert.assertTrue
+import org.junit.Test
/**
* Checks that we can run the "daffodil generate c" subcommand with
@@ -30,104 +32,125 @@ import org.apache.daffodil.cli.Main.ExitCode
class TestCLIGenerateC {
@Test def test_CLI_Generate_schema(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
- runCLI(args"generate c -s $schema $tempDir") { cli =>
- } (ExitCode.Success)
+ runCLI(args"generate c -s $schema $tempDir") { cli => }(ExitCode.Success)
assertTrue(exists(tempDir.resolve("c/libruntime/generated_code.c")))
}
}
@Test def test_CLI_Generate_noC_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"generate -s $schema $tempDir") { cli =>
cli.expectErr("Unknown option 's'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_CLI_Generate_otherThanC_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"generate vhld -s $schema $tempDir") { cli =>
cli.expectErr("Unknown option 's'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_CLI_Generate_noSchema_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"generate c $tempDir") { cli =>
cli.expectErr("Required option 'schema' not found")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_CLI_Generate_twoSchema_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"generate c -s $schema -s $schema $tempDir") { cli =>
cli.expectErr("you should provide exactly one argument")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_CLI_Generate_verbose(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"-v generate c -s $schema $tempDir") { cli =>
cli.expectErr("[info] Time (compiling)")
cli.expectErr("[info] Time (generating)")
- } (ExitCode.Success)
+ }(ExitCode.Success)
assertTrue(exists(tempDir.resolve("c/libruntime/generated_code.c")))
}
}
@Test def test_CLI_Generate_root(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
- runCLI(args"generate c -s $schema -r {http://example.com}ex_nums $tempDir") { cli =>
- } (ExitCode.Success)
+ runCLI(args"generate c -s $schema -r {http://example.com}ex_nums $tempDir") { cli => }(
+ ExitCode.Success,
+ )
assertTrue(exists(tempDir.resolve("c/libruntime/generated_code.c")))
}
}
@Test def test_CLI_Generate_root_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
-
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
+
withTempDir { tempDir =>
runCLI(args"generate c -s $schema -r {ex}ex_nums $tempDir") { cli =>
cli.expectErr("Schema Definition Error")
cli.expectErr("No global element found for {ex}ex_nums")
- } (ExitCode.GenerateCodeError)
+ }(ExitCode.GenerateCodeError)
}
}
@Test def test_CLI_Generate_namespaceNoRoot_error(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
runCLI(args"generate c -s $schema -r {http://example.com} $tempDir") { cli =>
- cli.expectErr("Invalid syntax for extended QName")
- } (ExitCode.Usage)
+ cli.expectErr("Invalid syntax for extended QName")
+ }(ExitCode.Usage)
}
}
@Test def test_CLI_Generate_tunable(): Unit = {
- val schema = path("daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd")
+ val schema = path(
+ "daffodil-runtime2/src/test/resources/org/apache/daffodil/runtime2/ex_nums.dfdl.xsd",
+ )
withTempDir { tempDir =>
- runCLI(args"generate c -s $schema -T parseUnparsePolicy=parseOnly $tempDir") { cli =>
- } (ExitCode.Success)
+ runCLI(args"generate c -s $schema -T parseUnparsePolicy=parseOnly $tempDir") { cli => }(
+ ExitCode.Success,
+ )
assertTrue(exists(tempDir.resolve("c/libruntime/generated_code.c")))
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIParsing.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIParsing.scala
index 6f9aee7b3..033bb4a54 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIParsing.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIParsing.scala
@@ -18,127 +18,153 @@
package org.apache.daffodil.cliTest
import java.nio.charset.StandardCharsets.UTF_8
+
+import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
import org.apache.commons.io.FileUtils
import org.junit.Assert._
import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
-import org.apache.daffodil.cli.Main.ExitCode
class TestCLIParsing {
@Test def test_3677_CLI_Parsing_elementFormDefault_qualified(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/elementFormDefaultQualified.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/elementFormDefaultQualified.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r s1") { cli =>
cli.sendLine("strng", inputDone = true)
cli.expect("<tns:e1>strng</tns:e1>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_3678_CLI_Parsing_elementFormDefault_unqualified(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/elementFormDefaultUnqualified.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/elementFormDefaultUnqualified.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r s1") { cli =>
cli.sendLine("strng", inputDone = true)
cli.expect("<e1>strng</e1>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_2358_CLI_Parsing_SimpleParse_stdOut_extVars(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
runCLI(args"parse -s $schema -r row -D{http://example.com}var1=99 -c $config") { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row xmlns:tns=\"http://example.com\">")
cli.expect("<cell>99</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3507_CLI_Parsing_SimpleParse_SaveParser_extVars(): Unit = {
withTempFile { parser =>
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
runCLI(args"-v save-parser -s $schema -r row -c $config $parser") { cli =>
cli.expectErr("[info] Time (saving)")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"parse -P $parser -D{http://example.com}var1=99") { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row xmlns:tns=\"http://example.com\">")
cli.expect("<cell>99</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"parse -P $parser -D{http://example.com}var1=55") { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row xmlns:tns=\"http://example.com\">")
cli.expect("<cell>55</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_2360_CLI_Parsing_SimpleParse_stdOut_extVars2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
runCLI(args"parse -s $schema -r row2 -c $config") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<cell>-9</cell>")
cli.expect("<cell>-2</cell>")
cli.expect("<cell>-8</cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_3506_CLI_Parsing_SimpleParse_extVars2(): Unit = {
withTempFile { parser =>
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
runCLI(args"-v save-parser -s $schema -r row $parser") { cli =>
cli.expectErr("[info] Time (saving)")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"parse --parser $parser") { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row xmlns:tns=\"http://example.com\">")
cli.expect("<cell>-1</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"parse --parser $parser -D{http://example.com}var1=55") { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row xmlns:tns=\"http://example.com\">")
cli.expect("<cell>55</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_CLI_Parsing_SimpleParse_extVars_error(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r row2 -DdoesNotExist=1") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expectErr("definition not found")
cli.expectErr("doesNotExist")
- } (ExitCode.BadExternalVariable)
+ }(ExitCode.BadExternalVariable)
}
@Test def test_3227_CLI_Parsing_SimpleParse_DFDL1197_fix(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/testOptionalInfix.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section12/delimiter_properties/testOptionalInfix.dfdl.xsd",
+ )
runCLI(args"-vv parse -s $schema") { cli =>
cli.sendLine("1/3", inputDone = true)
cli.expectErr("<Sequence><Separator/><RepMinMax name='s1'>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_1593_CLI_Parsing_MultifileSchema_noGlobalElem(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_21.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_21.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.send("does not matter", inputDone = true)
cli.expectErr("No global elements")
cli.expectErr("multi_base_21.dfdl.xsd")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
// See comment in DAFFODIL-952
@@ -150,62 +176,76 @@ class TestCLIParsing {
// verifies the expected output. If this test fails, it likely means we've
// broken our attempts to create consistent prefix mappings.
@Test def test_1585_CLI_Parsing_MultifileSchema_methodImportSameDir(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_14.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_14.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.send("test", inputDone = true)
- cli.expect("""<base14:rabbitHole xmlns:a14="http://a14.com" xmlns:b14="http://b14.com" xmlns:base14="http://baseSchema.com">""")
+ cli.expect(
+ """<base14:rabbitHole xmlns:a14="http://a14.com" xmlns:b14="http://b14.com" xmlns:base14="http://baseSchema.com">""",
+ )
cli.expect("<a14:nestSequence>")
cli.expect("<b14:nest>test</b14:nest>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1586_CLI_Parsing_MultifileSchema_methodIncludeSameDir(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.send("test", inputDone = true)
cli.expect("<rabbitHole>")
cli.expect("<nest>test</nest>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1587_CLI_Parsing_MultifileSchema_methodImportSameDir2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_16.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_16.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.send("test", inputDone = true)
cli.expect("<rabbitHole>")
cli.expect("<nest>test</nest>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1317_IBMCompatibility_ABC_test_ibm_abc_cli(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/ABC_IBM.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/ABC_IBM.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r ABC") { cli =>
cli.sendLine("abcabcabc", inputDone = true)
cli.expect("<Container>")
cli.expect("<c>c</c>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_977_CLI_Parsing_SimpleParse_stdOut(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_978_CLI_Parsing_SimpleParse_outFile(): Unit = {
withTempFile { output =>
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix -o $output") { cli =>
cli.sendLine("0,1,2", inputDone = true)
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
val res = FileUtils.readFileToString(output.toFile, UTF_8)
assertTrue(res.contains("<tns:cell>2</tns:cell>"))
@@ -213,100 +253,120 @@ class TestCLIParsing {
}
@Test def test_979_CLI_Parsing_SimpleParse_inFile(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"parse -s $schema -r matrix $input") { cli =>
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_980_CLI_Parsing_SimpleParse_stOutDash(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"parse -s $schema -r matrix -o - $input") { cli =>
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_981_CLI_Parsing_SimpleParse_stdInDash(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix -") { cli =>
cli.sendLine("0,1,2,3", inputDone = true)
cli.expect("<tns:cell>3</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_983_CLI_Parsing_SimpleParse_verboseMode(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"-v parse -s $schema -r matrix -") { cli =>
cli.sendLine("0,1", inputDone = true)
cli.expectErr("[info]")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
runCLI(args"-vv parse -s $schema -r matrix -") { cli =>
cli.sendLine("0,1", inputDone = true)
cli.expectErr("[debug]")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_984_CLI_Parsing_negativeTest(): Unit = {
runCLI(args"parse") { cli =>
cli.sendLine("0,1,2,3", inputDone = true)
cli.expectErr("There should be exactly one of the following options: schema, parser")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_985_CLI_Parsing_SimpleParse_defaultRoot(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.sendLine("0,1,2,3", inputDone = true)
cli.expect("<tns:cell>3</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_988_CLI_Parsing_SimpleParse_specifiedRoot(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r hcp2") { cli =>
cli.sendLine("12", inputDone = true)
cli.expect("<tns:hcp2")
cli.expect("12")
cli.expect("</tns:hcp2>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_996_CLI_Parsing_negativeTest04(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r unknown") { cli =>
cli.sendLine("12", inputDone = true)
cli.expectErr("No root element found for unknown in any available namespace")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
@Test def test_997_CLI_Parsing_multSchemas(): Unit = {
- val schema1 = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
- val schema2 = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd")
+ val schema1 = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
+ val schema2 = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd",
+ )
runCLI(args"parse -s $schema1 -s $schema2 -r hcp2") { cli =>
cli.sendLine("12", inputDone = true)
cli.expectErr("Bad arguments for option 'schema'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_3661_CLI_Parsing_badSchemaPath(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/doesnotexist.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/doesnotexist.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r root") { cli =>
cli.sendLine("12", inputDone = true)
cli.expectErr("Bad arguments for option 'schema'")
cli.expectErr("Could not find file or resource")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_1002_CLI_Parsing_negativeTest03(): Unit = {
@@ -314,121 +374,145 @@ class TestCLIParsing {
runCLI(args"parse -P parserThatDoesNotExist") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expectErr("parserThatDoesNotExist")
- } (ExitCode.FileNotFound)
+ }(ExitCode.FileNotFound)
}
@Test def test_1003_CLI_Parsing_SimpleParse_emptyNamespace(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input7.txt")
runCLI(args"parse -s $schema -r {}address $input") { cli =>
cli.expect("<address>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1004_CLI_Parsing_SimpleParse_namespaceUsed(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input8.txt")
runCLI(args"parse -s $schema -r {target}matrix $input") { cli =>
cli.expect("""<tns:matrix xmlns:tns="target">""")
cli.expect("<cell>14</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_2615_CLI_Parsing_SimpleParse_namespaceUsedLongOpt(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input8.txt")
runCLI(args"parse -s $schema --root {target}matrix $input") { cli =>
cli.expect("""<tns:matrix xmlns:tns="target">""")
cli.expect("<cell>14</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1005_CLI_Parsing_SimpleParse_rootPath(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r hcp2 -p /") { cli =>
cli.send("12", inputDone = true)
cli.expect("<tns:hcp2 xmlns:tns=\"http://www.example.org/example1/\">")
cli.expect("12")
cli.expect("</tns:hcp2>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1015_CLI_Parsing_SimpleParse_defaultRootMultSchema(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input7.txt")
runCLI(args"parse -s $schema $input") { cli =>
cli.expect("<address>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleSchema_basicTest_validationOn(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix --validate on") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_XXX_CLI_Parsing_SimpleSchema_basicTest_validation_missing_mode(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix --validate") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expectErr("Bad arguments")
cli.expectErr("validate")
cli.expectErr("exactly one argument")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_XXX_CLI_Parsing_SimpleSchema_basicTest_validationLimited(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix --validate limited") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_XXX_CLI_Parsing_SimpleSchema_basicTest_validationOff(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix --validate off") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_XXX_CLI_Parsing_SimpleSchema_basicTest_validationFooBar(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse --validate FooBar -s $schema -r matrix") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expectErr("FooBar")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_1319_CLI_Parsing_invalidElementSDE(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/ABC_IBM_invalid.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/ABC_IBM_invalid.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r ABC") { cli =>
cli.sendLine("ababababbaacccccb", inputDone = true)
cli.expectErr("'fixed' is not a valid")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
@Test def test_1346_CLI_Parsing_SimpleParse_defaultRootMultSchemaMultiple(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input7.txt")
for (x <- 1 to 10) {
runCLI(args"parse -s $schema $input") { cli =>
cli.expect("<address>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@@ -436,149 +520,194 @@ class TestCLIParsing {
runCLI(args"") { cli =>
cli.sendLine("12", inputDone = true)
cli.expectErr("Subcommand required")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_1971_CLI_Parsing_traceMode01(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd",
+ )
runCLI(args"-t parse -s $schema") { cli =>
cli.sendLine("test", inputDone = true)
cli.expect("parser: <Element name='rabbitHole'>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1973_CLI_Parsing_traceMode03(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"-t parse -s $schema") { cli =>
cli.sendLine("0,1,2,3,,,,", inputDone = true)
cli.expectErr("Left over data. Consumed 56 bit(s) with at least")
cli.expectErr("Left over data (Hex) starting at byte 8 is: (")
cli.expectErr("Left over data (UTF-8) starting at byte 8 is: (")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_1941_CLI_Parsing_SimpleParse_leftOverData(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix") { cli =>
cli.sendLine("1,2,3,4,,,", inputDone = true)
cli.expectErr("Left over data. Consumed 56 bit(s) with at least")
cli.expectErr("Left over data (Hex) starting at byte 8 is: (")
cli.expectErr("Left over data (UTF-8) starting at byte 8 is: (")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_CLI_Parsing_BitParse_LSBPartialByte_leftOverData(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r lsbPartialByte") { cli =>
cli.send("stri", inputDone = true)
- cli.expectErr("Left over data. Consumed 10 bit(s) with at least 16 bit(s) remaining."
- + "\nLeft over data starts with partial byte. Left over data (Binary) at byte 2 is: (0b011101xx)"
- + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
- + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)")
- } (ExitCode.LeftOverData)
+ cli.expectErr(
+ "Left over data. Consumed 10 bit(s) with at least 16 bit(s) remaining."
+ + "\nLeft over data starts with partial byte. Left over data (Binary) at byte 2 is: (0b011101xx)"
+ + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
+ + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)",
+ )
+ }(ExitCode.LeftOverData)
}
@Test def test_CLI_Parsing_BitParse_MSBPartialByte_leftOverData(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r msbPartialByte") { cli =>
cli.send("stri", inputDone = true)
- cli.expectErr("Left over data. Consumed 10 bit(s) with at least 16 bit(s) remaining."
- + "\nLeft over data starts with partial byte. Left over data (Binary) at byte 2 is: (0bxx110100)"
- + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
- + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)")
- } (ExitCode.LeftOverData)
+ cli.expectErr(
+ "Left over data. Consumed 10 bit(s) with at least 16 bit(s) remaining."
+ + "\nLeft over data starts with partial byte. Left over data (Binary) at byte 2 is: (0bxx110100)"
+ + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
+ + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)",
+ )
+ }(ExitCode.LeftOverData)
}
@Test def test_CLI_Parsing_BitParse_MSBFullByte_leftOverData(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/bits_parsing.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r msbFullByte") { cli =>
cli.send("stri", inputDone = true)
- cli.expectErr("Left over data. Consumed 16 bit(s) with at least 16 bit(s) remaining."
- + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
- + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)")
- } (ExitCode.LeftOverData)
+ cli.expectErr(
+ "Left over data. Consumed 16 bit(s) with at least 16 bit(s) remaining."
+ + "\nLeft over data (Hex) starting at byte 3 is: (0x7269...)"
+ + "\nLeft over data (UTF-8) starting at byte 3 is: (ri...)",
+ )
+ }(ExitCode.LeftOverData)
}
@Test def test_DFDL_714(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/global_element.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/test_DFDL-714.txt")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/global_element.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/test_DFDL-714.txt",
+ )
runCLI(args"parse -s $schema $input") { cli =>
cli.expect("<tns:elem xmlns:tns=\"http://baseSchema.com\">")
cli.expect("<content")
cli.expect("Hello World")
cli.expect("</tns:elem>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_DFDL_1203_schema_from_jar(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/global_element.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/test_DFDL-714.txt")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/global_element.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/test_DFDL-714.txt",
+ )
runCLI(args"parse -s $schema $input") { cli =>
cli.expect("<tns:elem xmlns:tns=\"http://baseSchema.com\">")
cli.expect("<content")
cli.expect("Hello World")
cli.expect("</tns:elem>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3606_CLI_Parsing_SimpleParse_largeInfoset(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r matrix") { cli =>
- val longInput = "0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1 [...]
+ val longInput =
+ "0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,24,5,64,0,1,2 [...]
cli.sendLine(longInput, inputDone = true)
val result = cli.expect("<tns:row").getBefore()
- if (result.contains("""<tns:matrix xmlns:tns="http://www.example.org/example1/"><tns:matrix xmlns:tns="http://www.example.org/example1/">""")) {
+ if (
+ result.contains(
+ """<tns:matrix xmlns:tns="http://www.example.org/example1/"><tns:matrix xmlns:tns="http://www.example.org/example1/">""",
+ )
+ ) {
throw new Exception("Error - Root has been duplicated")
}
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_CLI_Parsing_built_in_formats(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_04.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_04.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input6.txt")
runCLI(args"parse -s $schema -r e $input") { cli =>
cli.expectErr("Schema Definition Warning")
cli.expectErr("edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd")
cli.expectErr("org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_JavaDefaults(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
-
- withSysProp("javax.xml.parsers.SAXParserFactory" -> "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl") {
- withSysProp("javax.xml.xml.validation.SchemaFactory" -> "com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory") {
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
+
+ withSysProp(
+ "javax.xml.parsers.SAXParserFactory" -> "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
+ ) {
+ withSysProp(
+ "javax.xml.xml.validation.SchemaFactory" -> "com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory",
+ ) {
runCLI(args"parse -s $schema -r matrix") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
}
@Test def test_XXX_CLI_Parsing_Stream_01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd",
+ )
runCLI(args"parse --stream -s $schema") { cli =>
cli.send("123", inputDone = true)
cli.expect("<a>1</a>")
cli.expect("<a>2</a>")
cli.expect("<a>3</a>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_Stream_02(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd",
+ )
runCLI(args"parse --stream -s $schema") { cli =>
cli.send("123ab", inputDone = true)
@@ -587,11 +716,13 @@ class TestCLIParsing {
cli.expect("<a>3</a>")
cli.expectErr("Left over data after consuming 0 bits while streaming.")
cli.expectErr("Stopped after consuming 24 bit(s) with at least 16 bit(s) remaining.")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
@Test def test_XXX_CLI_Parsing_Stream_03(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd",
+ )
runCLI(args"--trace parse --stream -s $schema") { cli =>
cli.send("123", inputDone = true)
@@ -600,60 +731,74 @@ class TestCLIParsing {
cli.expect("<a>2</a>")
cli.expect("bitPosition: 16")
cli.expect("<a>3</a>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_XCatalog_Resolution_Failure(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/xcatalog_import_failure.dfdl.xsd")
- val xcatalog = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/xcatalog_invalid.xml")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/xcatalog_import_failure.dfdl.xsd",
+ )
+ val xcatalog = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/xcatalog_invalid.xml",
+ )
withSysProp("xml.catalog.files" -> xcatalog.toAbsolutePath.toString) {
runCLI(args"parse -s $schema") { cli =>
cli.send("X", inputDone = true)
cli.expectErr("Schema Definition Error")
cli.expectErr("non_existent_file.xml")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
}
@Test def test_XXX_CLI_Parsing_SimpleParse_w3cdom(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I w3cdom -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
cli.expect("""<tns:e1 xmlns:tns="http://example.com">Hello</tns:e1>""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_jdom(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I jdom -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
cli.expect("""<tns:e1 xmlns:tns="http://example.com">Hello</tns:e1>""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_scala_xml(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I scala-xml -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
cli.expect("""<tns:e1 xmlns:tns="http://example.com">Hello</tns:e1>""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_json(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I json -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
cli.expect(""""e1": "Hello"""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_null(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
withTempFile { output =>
// should create no output to the file.
runCLI(args"parse -I null -s $schema -r e1 -o $output") { cli =>
@@ -666,28 +811,34 @@ class TestCLIParsing {
}
@Test def test_XXX_CLI_Parsing_SimpleParse_sax(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I sax -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
cli.expect("""<tns:e1 xmlns:tns="http://example.com">Hello</tns:e1>""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_exi(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I exi -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Parsing_SimpleParse_exisa(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"parse -I exisa -s $schema -r e1") { cli =>
cli.send("Hello", inputDone = true)
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Error_Return_Codes(): Unit = {
@@ -695,41 +846,49 @@ class TestCLIParsing {
runCLI(args"parse -I scala-xml -s $schema -r e1") { cli =>
cli.expectErr("this.does.not.exist")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_2575_DFDLX_Trace_output(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/trace_input.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/trace_input.dfdl.xsd",
+ )
runCLI(args"-v parse -r output -s $schema") { cli =>
cli.send("0", inputDone = true)
cli.expectErr("dfdlx:trace")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_Invalid_Configuration_File(): Unit = {
val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/single.dfdl.xsd")
- val config = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/single_conf_bad.txt")
+ val config = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/single_conf_bad.txt",
+ )
runCLI(args"parse -s $schema -c $config") { cli =>
cli.sendLine("0", inputDone = true)
cli.expectErr("Unable to load configuration")
- } (ExitCode.ConfigError)
+ }(ExitCode.ConfigError)
}
@Test def test_Layer_Execution(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/layers/buggy.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/layers/buggy.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.sendLine("1", inputDone = true)
cli.expect("""<value>1</value>""")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_Layer_Execution_Error(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/layers/buggy.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/layers/buggy.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.sendLine("0", inputDone = true)
cli.expectErr("Unexpected exception in layer transformer 'buggy'")
- } (ExitCode.LayerExecutionError)
+ }(ExitCode.LayerExecutionError)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIPerformance.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIPerformance.scala
index 0447b6b4b..e56cf7b14 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIPerformance.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIPerformance.scala
@@ -17,161 +17,208 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestCLIPerformance {
@Test def test_3393_CLI_Performance_2_Threads_2_Times(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"performance -N 2 -t 2 -s $schema -r matrix $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_2_Threads_2_Times_sax(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"performance -I sax -N 2 -t 2 -s $schema -r matrix $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_2_Threads_2_Times_exi(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"performance -I exi -N 2 -t 2 -s $schema -r matrix $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_2_Threads_2_Times_exisa(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"performance -I exisa -N 2 -t 2 -s $schema -r matrix $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3394_CLI_Performance_3_Threads_20_Times(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt")
runCLI(args"performance -N 20 -t 3 -s $schema -r matrix $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3395_CLI_Performance_5_Threads_50_Times(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input5.txt")
runCLI(args"performance -N 50 -t 5 -s $schema -r Item2 $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3396_CLI_Performance_2_Threads_2_Times_Negative(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input5.txt")
runCLI(args"performance -N 2 -t 2 -s $schema $input") { cli =>
cli.expect("total parse time (sec):")
cli.expect("avg rate (files/sec):")
cli.expectErr("error")
- } (ExitCode.PerformanceTestError)
+ }(ExitCode.PerformanceTestError)
}
@Test def test_3641_CLI_Performance_Unparse_2_Threads_2_Times(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"performance --unparse -N 2 -t 2 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_Unparse_2_Threads_2_Times_sax(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"performance --unparse -I sax -N 2 -t 2 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_Unparse_2_Threads_2_Times_exi(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.exi")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.exi",
+ )
runCLI(args"performance --unparse -I exi -N 2 -t 2 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_Unparse_2_Threads_2_Times_exisa(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.exisa")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.exisa",
+ )
runCLI(args"performance --unparse -I exisa -N 2 -t 2 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Performance_Unparse_2_Threads_2_Times_null(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"performance --unparse -I null -N 2 -t 2 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3643_CLI_Performance_Unparse_3_Threads_20_Times(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"performance --unparse -N 20 -t 3 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3644_CLI_Performance_Unparse_5_Threads_50_Times(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"performance --unparse -N 50 -t 5 -s $schema -r e3 $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3642_CLI_Performance_Unparse_2_Threads_2_Times_Negative(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input16.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input16.txt",
+ )
runCLI(args"performance --unparse -N 2 -t 2 -s $schema $input") { cli =>
cli.expect("total unparse time (sec):")
cli.expect("avg rate (files/sec):")
cli.expectErr("error")
- } (ExitCode.PerformanceTestError)
+ }(ExitCode.PerformanceTestError)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLISaveParser.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLISaveParser.scala
index 619004fb8..737bd4dad 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLISaveParser.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLISaveParser.scala
@@ -17,142 +17,170 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestCLISaveParser {
@Test def test_3017_CLI_Saving_SaveParser_simple(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r matrix $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r matrix $parser") { cli => }(ExitCode.Success)
runCLI(args"parse --parser $parser") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
@Test def test_3018_CLI_Saving_SaveParser_stdout(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
runCLI(args"-v save-parser -s $schema") { cli =>
cli.expectErr("[info] Time")
cli.expect("DAFFODIL") // check for magic number
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3019_CLI_Saving_SaveParser_withConfig(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path ("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r row2 -c $config $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r row2 -c $config $parser") { cli => }(
+ ExitCode.Success,
+ )
runCLI(args"parse --parser $parser -c $config") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<cell>-9</cell>")
cli.expect("<cell>-2</cell>")
cli.expect("<cell>-8</cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
@Test def test_3020_CLI_Saving_SaveParser_namespaceUsed(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input8.txt")
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r {target}matrix $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r {target}matrix $parser") { cli => }(
+ ExitCode.Success,
+ )
runCLI(args"parse --parser $parser $input") { cli =>
cli.expect("<cell>14</cell>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_3021_CLI_Saving_SaveParser_path(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r matrix -p / $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r matrix -p / $parser") { cli => }(ExitCode.Success)
runCLI(args"parse --parser $parser") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
@Test def test_3022_CLI_Saving_SaveParser_MultSchema(): Unit = {
- val schema1 = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd")
- val schema2 = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd")
+ val schema1 = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/defineFormat/defineFormat.dfdl.xsd",
+ )
+ val schema2 = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"save-parser -s $schema1 -s $schema2 $parser") { cli =>
cli.expectErr("Bad arguments for option 'schema'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_3023_CLI_Saving_SaveParser_verboseMode(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"-v save-parser -s $schema -r matrix $parser") { cli =>
cli.expectErr("[info]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"-vv save-parser -s $schema -r matrix $parser") { cli =>
cli.expectErr("[debug]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_3038_CLI_Saving_SaveParser_namespaceNoRoot(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r {http://www.example.org/example1/} $parser") { cli =>
- cli.expectErr("Bad arguments for option 'root'")
- cli.expectErr("{http://www.example.org/example1/}")
- } (ExitCode.Usage)
+ runCLI(args"save-parser -s $schema -r {http://www.example.org/example1/} $parser") {
+ cli =>
+ cli.expectErr("Bad arguments for option 'root'")
+ cli.expectErr("{http://www.example.org/example1/}")
+ }(ExitCode.Usage)
}
}
@Test def test_3039_CLI_Saving_SaveParser_emptyNamespace(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r {}matrix -p / $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r {}matrix -p / $parser") { cli => }(ExitCode.Success)
runCLI(args"parse --parser $parser") { cli =>
cli.sendLine("0,1,2", inputDone = true)
cli.expect("<tns:cell>2</tns:cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
@Test def test_DFDL_1205_CLI_FullValidation_SavedParser_Incompatible(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/charClassEntities.dfdl.xsd",
+ )
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input8.txt")
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r {target}matrix $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r {target}matrix $parser") { cli => }(
+ ExitCode.Success,
+ )
runCLI(args"parse --parser $parser --validate on $input") { cli =>
cli.expectErr("[error]")
- cli.expectErr("The validation mode must be 'limited' or 'off' when using a saved parser.")
- } (ExitCode.Usage)
+ cli.expectErr(
+ "The validation mode must be 'limited' or 'off' when using a saved parser.",
+ )
+ }(ExitCode.Usage)
}
}
@@ -161,108 +189,133 @@ class TestCLISaveParser {
* compiling. They are a runtime-thing only.
*/
@Test def test_3508_CLI_Saving_SaveParser_extVars(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r row2 $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r row2 $parser") { cli => }(ExitCode.Success)
- runCLI(args"parse --parser $parser -D{http://example.com}var1=25 {http://example.com}var3=7") { cli =>
+ runCLI(
+ args"parse --parser $parser -D{http://example.com}var1=25 {http://example.com}var3=7",
+ ) { cli =>
cli.sendLine("0", inputDone = true)
cli.expect("<tns:row2 xmlns:tns=\"http://example.com\">")
cli.expect("<cell>25</cell>")
cli.expect("<cell>7</cell>")
- } (ExitCode.LeftOverData)
+ }(ExitCode.LeftOverData)
}
}
@Test def test_3063_CLI_Saving_SaveParser_validate(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"save-parser --validate on -s $schema -r validation_check $parser") { cli =>
cli.expectErr("Unknown option 'validate'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
- runCLI(args"save-parser -s $schema -r validation_check $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r validation_check $parser") { cli => }(
+ ExitCode.Success,
+ )
runCLI(args"parse --validate limited -P $parser") { cli =>
cli.send("test", inputDone = true)
cli.expectErr("[error] Validation Error")
cli.expectErr("ex:validation_check failed")
cli.expectErr("[0-8]+")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
runCLI(args"parse --validate on -P $parser") { cli =>
cli.send("test", inputDone = true)
cli.expectErr("validation mode must be 'limited' or 'off' when using a saved parser.")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
// DAFFODIL-1141
- /*@Test*/ def test_3036_CLI_Saving_SaveParser_debug(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ /*@Test*/
+ def test_3036_CLI_Saving_SaveParser_debug(): Unit = {
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"-d save-parser -s $schema -r matrix $parser") { cli =>
cli.expectErr("Some error about -d not being valid with save-parser")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
// DAFFODIL-1141
- /*@Test*/ def test_3037_CLI_Saving_SaveParser_trace(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ /*@Test*/
+ def test_3037_CLI_Saving_SaveParser_trace(): Unit = {
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"-t save-parser -s $schema -r matrix $parser") { cli =>
cli.expectErr("Some error about -t not being valid with save-parser")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
}
@Test def test_3572_CLI_Saving_SaveParser_unparse(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input1.txt.xml",
+ )
withTempFile { parser =>
- runCLI(args"-t save-parser -s $schema -r matrix $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"-t save-parser -s $schema -r matrix $parser") { cli => }(ExitCode.Success)
runCLI(args"unparse --parser $parser $input") { cli =>
cli.expect("0,1,2")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_3573_CLI_Saving_SaveParser_unparse2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r e1 $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r e1 $parser") { cli => }(ExitCode.Success)
runCLI(args"unparse --parser $parser $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
@Test def test_3941_CLI_Saving_SaveParser_tunables(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt",
+ )
withTempFile { parser =>
- runCLI(args"save-parser -s $schema -r e1 -T parseUnparsePolicy=parseOnly $parser") { cli =>
- } (ExitCode.Success)
+ runCLI(args"save-parser -s $schema -r e1 -T parseUnparsePolicy=parseOnly $parser") {
+ cli =>
+ }(ExitCode.Success)
runCLI(args"unparse --parser $parser $input") { cli =>
cli.expectErr("[error]")
- cli.expectErr("Runtime Schema Definition Error: This schema was compiled without unparse support.")
- } (ExitCode.UnparseError)
+ cli.expectErr(
+ "Runtime Schema Definition Error: This schema was compiled without unparse support.",
+ )
+ }(ExitCode.UnparseError)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLITunables.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLITunables.scala
index 45a641391..61f1b1e04 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLITunables.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLITunables.scala
@@ -17,152 +17,197 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestCLITunables {
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_noNamespace_test_01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r test_01 -TunqualifiedPathStepPolicy=noNamespace") { cli =>
cli.send("12", inputDone = true)
cli.expect("""<c xmlns="">2</c>""")
cli.expect("""<s xmlns="">1</s>""")
cli.expect("</test_01>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_noNamespace_test_02(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r test_02 -TunqualifiedPathStepPolicy=noNamespace") { cli =>
cli.send("12", inputDone = true)
cli.expectErr("Schema Definition Error")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_noNamespace_test_03(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r test_03 -TunqualifiedPathStepPolicy=noNamespace") { cli =>
cli.send("12", inputDone = true)
cli.expectErr("Schema Definition Error")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_noNamespace_test_04(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -r test_04 -TunqualifiedPathStepPolicy=noNamespace") { cli =>
cli.send("12", inputDone = true)
cli.expect("""<c xmlns="">2</c>""")
cli.expect("""<s xmlns="">2</s>""")
cli.expect("</test_04>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_defaultNamespace_test_01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
-
- runCLI(args"parse -s $schema -r test_01 -TunqualifiedPathStepPolicy=defaultNamespace") { cli =>
- cli.send("12", inputDone = true)
- cli.expect("""<c xmlns="">2</c>""")
- cli.expect("""<s xmlns="">1</s>""")
- cli.expect("</test_01>")
- } (ExitCode.Success)
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
+
+ runCLI(args"parse -s $schema -r test_01 -TunqualifiedPathStepPolicy=defaultNamespace") {
+ cli =>
+ cli.send("12", inputDone = true)
+ cli.expect("""<c xmlns="">2</c>""")
+ cli.expect("""<s xmlns="">1</s>""")
+ cli.expect("</test_01>")
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_defaultNamespace_test_02(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
-
- runCLI(args"parse -s $schema -r test_02 -TunqualifiedPathStepPolicy=defaultNamespace") { cli =>
- cli.send("12", inputDone = true)
- cli.expect("""<c xmlns="">2</c>""")
- cli.expect("""<s xmlns="">1</s>""")
- cli.expect("</test_02>")
- } (ExitCode.Success)
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
+
+ runCLI(args"parse -s $schema -r test_02 -TunqualifiedPathStepPolicy=defaultNamespace") {
+ cli =>
+ cli.send("12", inputDone = true)
+ cli.expect("""<c xmlns="">2</c>""")
+ cli.expect("""<s xmlns="">1</s>""")
+ cli.expect("</test_02>")
+ }(ExitCode.Success)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_defaultNamespace_test_03(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
-
- runCLI(args"parse -s $schema -r test_03 -TunqualifiedPathStepPolicy=defaultNamespace") { cli =>
- cli.send("12", inputDone = true)
- cli.expectErr("Schema Definition Error")
- } (ExitCode.UnableToCreateProcessor)
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
+
+ runCLI(args"parse -s $schema -r test_03 -TunqualifiedPathStepPolicy=defaultNamespace") {
+ cli =>
+ cli.send("12", inputDone = true)
+ cli.expectErr("Schema Definition Error")
+ }(ExitCode.UnableToCreateProcessor)
}
@Test def test_CLI_Parsing_unqualifiedPathStepPolicy_defaultNamespace_test_04(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
-
- runCLI(args"parse -s $schema -r test_04 -TunqualifiedPathStepPolicy=defaultNamespace") { cli =>
- cli.send("12", inputDone = true)
- cli.expectErr("Schema Definition Error")
- } (ExitCode.UnableToCreateProcessor)
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
+
+ runCLI(args"parse -s $schema -r test_04 -TunqualifiedPathStepPolicy=defaultNamespace") {
+ cli =>
+ cli.send("12", inputDone = true)
+ cli.expectErr("Schema Definition Error")
+ }(ExitCode.UnableToCreateProcessor)
}
- @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_01()
+ : Unit = {
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
- runCLI(args"parse -s $schema -r test_01 -TunqualifiedPathStepPolicy=preferDefaultNamespace") { cli =>
+ runCLI(
+ args"parse -s $schema -r test_01 -TunqualifiedPathStepPolicy=preferDefaultNamespace",
+ ) { cli =>
cli.send("12", inputDone = true)
cli.expect("""<c xmlns="">2</c>""")
cli.expect("""<s xmlns="">1</s>""")
cli.expect("</test_01>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
- @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_02(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_02()
+ : Unit = {
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
- runCLI(args"parse -s $schema -r test_02 -TunqualifiedPathStepPolicy=preferDefaultNamespace") { cli =>
+ runCLI(
+ args"parse -s $schema -r test_02 -TunqualifiedPathStepPolicy=preferDefaultNamespace",
+ ) { cli =>
cli.send("12", inputDone = true)
cli.expect("""<c xmlns="">2</c>""")
cli.expect("""<s xmlns="">1</s>""")
cli.expect("</test_02>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
- @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_03(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_03()
+ : Unit = {
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
- runCLI(args"parse -s $schema -r test_03 -TunqualifiedPathStepPolicy=preferDefaultNamespace") { cli =>
+ runCLI(
+ args"parse -s $schema -r test_03 -TunqualifiedPathStepPolicy=preferDefaultNamespace",
+ ) { cli =>
cli.send("12", inputDone = true)
cli.expectErr("Schema Definition Error")
- } (ExitCode.UnableToCreateProcessor)
+ }(ExitCode.UnableToCreateProcessor)
}
- @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_04(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd")
+ @Test def test_CLI_Parsing_unqualifiedPathStepPolicy_preferDefaultNamespace_test_04()
+ : Unit = {
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/unqualified_path_step.dfdl.xsd",
+ )
- runCLI(args"parse -s $schema -r test_04 -TunqualifiedPathStepPolicy=preferDefaultNamespace") { cli =>
+ runCLI(
+ args"parse -s $schema -r test_04 -TunqualifiedPathStepPolicy=preferDefaultNamespace",
+ ) { cli =>
cli.send("12", inputDone = true)
cli.expect("""<c xmlns="">2</c>""")
cli.expect("""<s xmlns="">2</s>""")
cli.expect("</test_04>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
/**
* Suppresses SDW messages.
*/
@Test def test_CLI_Parsing_SuppressSDEWarnings1(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd",
+ )
runCLI(args"parse -s $schema -TsuppressSchemaDefinitionWarnings=all") { cli =>
cli.send("a,b", inputDone = true)
cli.expect("<s1>a</s1>")
cli.expect("<s2>b</s2>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
/**
* Will display SDW warnings. Does not set the tunable that suppresses them.
*/
@Test def test_CLI_Parsing_SuppressSDEWarnings2(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd",
+ )
runCLI(args"parse -s $schema") { cli =>
cli.send("a,b", inputDone = true)
@@ -172,7 +217,7 @@ class TestCLITunables {
cli.expectErr("dfdl:lengthKind")
cli.expectErr("delimited")
cli.expectErr("dfdl:length")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
/**
@@ -181,18 +226,20 @@ class TestCLITunables {
* isn't displayed on a reload of a compiled processor
*/
@Test def test_CLI_Parsing_ReloadingDoesNotRepeatWarnings(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/suppressWarnTest.dfdl.xsd",
+ )
withTempFile { parser =>
runCLI(args"save-parser -s $schema $parser") { cli =>
cli.expectErr("Schema Definition Warning")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"parse -P $parser") { cli =>
cli.send("a,b", inputDone = true)
cli.expect("<s1>a</s1>")
cli.expect("<s2>b</s2>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIUnparsing.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIUnparsing.scala
index 812cc8a6b..d1604a7df 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIUnparsing.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLIUnparsing.scala
@@ -18,98 +18,135 @@
package org.apache.daffodil.cliTest
import java.nio.charset.StandardCharsets.UTF_8
+
+import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
import org.apache.commons.io.FileUtils
import org.junit.Assert._
import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
-import org.apache.daffodil.cli.Main.ExitCode
class TestCLIunparsing {
@Test def test_3525_CLI_Unparsing_SimpleUnparse_inFile(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input12.txt",
+ )
runCLI(args"unparse -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3526_CLI_Unparsing_SimpleUnparse_inFile2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt",
+ )
runCLI(args"unparse -s $schema --root e3 $input") { cli =>
cli.expect("[1,2]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3527_CLI_Unparsing_SimpleUnparse_stdin(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input14.txt",
+ )
runCLI(args"unparse -s $schema --root e3") { cli =>
cli.sendFile(input, inputDone = true)
cli.expect("[1,2]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3528_CLI_Unparsing_SimpleUnparse_stdin2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema --root e1") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3529_CLI_Unparsing_SimpleUnparse_stdin3(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema --root e1 -") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3584_CLI_Unparsing_SimpleUnparse_stdin4(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema --root file") { cli =>
- val input = "<tns:file xmlns:tns='http://www.example.org/example1/'><tns:header><tns:title>1</tns:title><tns:title>2</tns:title><tns:title>3</tns:title></tns:header><tns:record><tns:item>4</tns:item><tns:item>5</tns:item><tns:item>6</tns:item></tns:record></tns:file>"
+ val input =
+ "<tns:file xmlns:tns='http://www.example.org/example1/'><tns:header><tns:title>1</tns:title><tns:title>2</tns:title><tns:title>3</tns:title></tns:header><tns:record><tns:item>4</tns:item><tns:item>5</tns:item><tns:item>6</tns:item></tns:record></tns:file>"
cli.send(input, inputDone = true)
cli.expect("1,2,3")
cli.expect("4,5,6")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3574_CLI_Unparsing_SimpleUnparse_extVars(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input15.txt")
-
- runCLI(args"unparse -s $schema -r row -D{http://example.com}var1=99 -c $config $input") { cli =>
- cli.expect("0")
- } (ExitCode.Success)
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input15.txt",
+ )
+
+ runCLI(args"unparse -s $schema -r row -D{http://example.com}var1=99 -c $config $input") {
+ cli =>
+ cli.expect("0")
+ }(ExitCode.Success)
}
@Test def test_3575_CLI_Unparsing_SimpleUnparse_extVars2(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd")
- val config = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input16.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/external_variables.dfdl.xsd",
+ )
+ val config = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/external_variables/daffodil_config_cli_test.xml",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input16.txt",
+ )
runCLI(args"unparse -s $schema -r row -c $config $input") { cli =>
cli.expect("0")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3582_CLI_Unparsing_SimpleUnparse_outFile(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt",
+ )
withTempFile { output =>
- runCLI(args"unparse -s $schema -r e3 -o $output $input") { cli =>
- } (ExitCode.Success)
+ runCLI(args"unparse -s $schema -r e3 -o $output $input") { cli => }(ExitCode.Success)
val res = FileUtils.readFileToString(output.toFile, UTF_8)
assertTrue(res.contains("[1,2]"))
@@ -117,225 +154,317 @@ class TestCLIunparsing {
}
@Test def test_3581_CLI_Unparsing_SimpleUnparse_stOutDash(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input13.txt",
+ )
runCLI(args"unparse -s $schema -r e3 -o - $input") { cli =>
cli.expect("[1,2]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3580_CLI_Unparsing_SimpleUnparse_verboseMode(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"-v unparse -s $schema --root e1") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expectErr("[info]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
runCLI(args"-vv unparse -s $schema --root e1") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expectErr("[debug]")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3579_CLI_Unparsing_negativeTest(): Unit = {
runCLI(args"unparse") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expectErr("There should be exactly one of the following options: schema, parser")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_3578_CLI_Unparsing_SimpleUnparse_defaultRoot(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema") { cli =>
cli.send("<tns:e1 xmlns:tns='http://example.com'>Hello</tns:e1>", inputDone = true)
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3583_CLI_Unparsing_SimpleUnparse_rootPath(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema -r hcp2 -p /") { cli =>
- cli.send("<tns:hcp2 xmlns:tns='http://www.example.org/example1/'>12</tns:hcp2>", inputDone = true)
+ cli.send(
+ "<tns:hcp2 xmlns:tns='http://www.example.org/example1/'>12</tns:hcp2>",
+ inputDone = true,
+ )
cli.expect("12")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
// DAFFODIL-1346
- /*@Test*/ def test_3576_CLI_Unparsing_validate(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd")
+ /*@Test*/
+ def test_3576_CLI_Unparsing_validate(): Unit = {
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema -r validation_check --validate on") { cli =>
- cli.sendLine("""<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""", inputDone = true)
+ cli.sendLine(
+ """<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""",
+ inputDone = true,
+ )
cli.expect("[warn] Validation Error: validation_check: cvc-pattern-valid")
cli.expect("[warn] Validation Error: validation_check failed")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
runCLI(args"unparse -s $schema -r validation_check --validate") { cli =>
- cli.sendLine("""<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""", inputDone = true)
+ cli.sendLine(
+ """<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""",
+ inputDone = true,
+ )
cli.expect("[warn] Validation Error: validation_check: cvc-pattern-valid")
cli.expect("[warn] Validation Error: validation_check failed")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
runCLI(args"unparse -s $schema -r validation_check --validate limited") { cli =>
- cli.sendLine("""<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""", inputDone = true)
+ cli.sendLine(
+ """<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""",
+ inputDone = true,
+ )
cli.expect("[warn] Validation Error: validation_check failed")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
runCLI(args"unparse -s $schema -r validation_check --validate off") { cli =>
- cli.sendLine("""<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""", inputDone = true)
- } (ExitCode.Success)
+ cli.sendLine(
+ """<ex:validation_check xmlns:ex="http://example.com">test</ex:validation_check>""",
+ inputDone = true,
+ )
+ }(ExitCode.Success)
}
// DAFFODIL-2709
- /*@Test*/ def test_3577_CLI_Unparsing_traceMode(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd")
+ /*@Test*/
+ def test_3577_CLI_Unparsing_traceMode(): Unit = {
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/namespaces/multi_base_15.dfdl.xsd",
+ )
runCLI(args"-t unparse -s $schema") { cli =>
- cli.sendLine("<rabbitHole><nestSequence><nest>test</nest></nestSequence></rabbitHole>", inputDone = true)
+ cli.sendLine(
+ "<rabbitHole><nestSequence><nest>test</nest></nestSequence></rabbitHole>",
+ inputDone = true,
+ )
cli.expect("unparser: <Element name='nest'>")
cli.expect("unparser: <Element name='rabbitHole'>")
cli.expect("test")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_3662_CLI_Unparsing_badSchemaPath(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/doesnotexist.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/doesnotexist.dfdl.xsd",
+ )
runCLI(args"unparse -s $schema -r root") { cli =>
cli.send("<tns:e1>Hello</tns:e1>", inputDone = true)
cli.expectErr("Bad arguments for option 'schema'")
cli.expectErr("Could not find file or resource")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_w3cdom(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse -I w3cdom -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_jdom(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse -I jdom -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_scala_xml(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse -I scala-xml -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_json(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.json")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.json",
+ )
runCLI(args"unparse -I json -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_w3cdom_stream(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse --stream -I w3cdom -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_jdom_stream(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse --stream -I jdom -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_scala_xml_stream(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse --stream -I scala-xml -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_json_stream(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.json")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.json",
+ )
runCLI(args"unparse --stream -I json -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_sax(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse -I sax -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_exi(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.exi")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.exi",
+ )
runCLI(args"unparse -I exi -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_exisa(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.exisa")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.exisa",
+ )
runCLI(args"unparse -I exisa -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_xxxx_CLI_Unparsing_SimpleUnparse_null(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section00/general/generalSchema.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input18.txt",
+ )
runCLI(args"unparse -I null -s $schema --root e1 $input") { cli =>
cli.expect("Hello")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Unparsing_Stream_01(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input19.txt")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input19.txt",
+ )
runCLI(args"unparse --stream -s $schema $input") { cli =>
cli.expect("123")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_XXX_CLI_Unparsing_Stream_sax(): Unit = {
- val schema = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd")
- val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input19.txt")
+ val schema = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/cli_schema_02.dfdl.xsd",
+ )
+ val input = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/input19.txt",
+ )
runCLI(args"unparse -I sax --stream -s $schema $input") { cli =>
cli.expect("123")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
index 630b0bc23..3cf29d24a 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestCLItdml.scala
@@ -17,56 +17,69 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestCLItdml {
@Test def test_995_CLI_Tdml_Listing_negativeTest01(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml")
-
- runCLI(args"test $tdml escape_entry1 escape_entry2-11 escape_entry1-5 escape_entry4_3") { cli =>
- cli.expect("Total: 4, Pass: 2, Fail: 0, Not Found: 2")
- } (ExitCode.Success)
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml",
+ )
+
+ runCLI(args"test $tdml escape_entry1 escape_entry2-11 escape_entry1-5 escape_entry4_3") {
+ cli =>
+ cli.expect("Total: 4, Pass: 2, Fail: 0, Not Found: 2")
+ }(ExitCode.Success)
}
@Test def test_1001_CLI_Tdml_Listing_execRegex01(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml",
+ )
runCLI(args"test --regex $tdml escape_entry4_\d") { cli =>
cli.expect("Total: 9, Pass: 9, Fail: 0, Not Found: 0")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1000_CLI_Tdml_Listing_listRegex02(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml",
+ )
- runCLI(args"test -l --regex $tdml escape_entryb-\d+") { cli =>
- } (ExitCode.Success)
+ runCLI(args"test -l --regex $tdml escape_entryb-\d+") { cli => }(ExitCode.Success)
}
@Test def test_999_CLI_Tdml_Listing_listRegex01(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml",
+ )
runCLI(args"test -l --regex $tdml escape_entry4_\d+") { cli =>
cli.expect("escape_entry4_1")
cli.expect("escape_entry4_10")
cli.expect("escape_entry4_20")
cli.expect("escape_entry4_9")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_994_CLI_Tdml_Listing_execAll(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section31/escape_characters/Escapes.tdml",
+ )
runCLI(args"test $tdml") { cli =>
cli.expect("Total: 88, Pass: 88, Fail: 0, Not Found: 0")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_993_CLI_Tdml_Listing_listAll(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml",
+ )
runCLI(args"test -l $tdml") { cli =>
cli.expect("byte_entities_6_01")
@@ -74,54 +87,70 @@ class TestCLItdml {
cli.expect("emptyStringEntityTermInExpression_01")
cli.expect("text_entities_6_04")
cli.expect("whitespace_10")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_992_CLI_Tdml_Listing_singleTestList(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml",
+ )
runCLI(args"test -l $tdml byte_entities_6_08") { cli =>
cli.expect("byte_entities_6_08")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_990_CLI_Tdml_Listing_singleTest(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/Entities.tdml",
+ )
runCLI(args"test $tdml byte_entities_6_08") { cli =>
cli.expect("[Pass] byte_entities_6_08")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_CLI_catch_TestNotCompatible(): Unit = {
- val tdml = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml")
+ val tdml = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml",
+ )
runCLI(args"test -iii $tdml testNotCompatibleImplementation1") { cli =>
- cli.expect("[Skipped] testNotCompatibleImplementation1 (not compatible with implementation: daffodil)")
- } (ExitCode.Success)
+ cli.expect(
+ "[Skipped] testNotCompatibleImplementation1 (not compatible with implementation: daffodil)",
+ )
+ }(ExitCode.Success)
}
@Test def test_CLI_catch_TestBadArguments(): Unit = {
- val tdml = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml")
+ val tdml = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml",
+ )
runCLI(args"test -I notDaffodilC $tdml") { cli =>
cli.expectErr("[error] Bad arguments for option 'implementation'")
- } (ExitCode.Usage)
+ }(ExitCode.Usage)
}
@Test def test_CLI_Tdml_implementation(): Unit = {
- val tdml = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml")
+ val tdml = path(
+ "daffodil-cli/src/test/resources/org/apache/daffodil/cli/testNonCompatibleImplementation.tdml",
+ )
runCLI(args"test -I daffodilC $tdml testDaffodilCImplementation1") { cli =>
cli.expect("[Pass] testDaffodilCImplementation1")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def test_1016_CLI_Tdml_Listing_listVerbose(): Unit = {
- val tdml = path("daffodil-test/src/test/resources/org/apache/daffodil/section07/assertions/assert.tdml")
+ val tdml = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section07/assertions/assert.tdml",
+ )
runCLI(args"test -l -i --regex $tdml assertPattern.*") { cli =>
- cli.expect("assertPatternAndExp s2 e3 Section 7 - Assert Schema Error for Expression/Pattern - DFDL-7-047R")
- } (ExitCode.Success)
+ cli.expect(
+ "assertPatternAndExp s2 e3 Section 7 - Assert Schema Error for Expression/Pattern - DFDL-7-047R",
+ )
+ }(ExitCode.Success)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestEXIEncodeDecode.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestEXIEncodeDecode.scala
index 7af87052c..5c648f55e 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestEXIEncodeDecode.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestEXIEncodeDecode.scala
@@ -17,19 +17,24 @@
package org.apache.daffodil.cliTest
-import org.junit.Test
-
-import scala.xml.XML
import java.nio.file.Paths
-import org.apache.daffodil.cli.cliTest.Util._
+import scala.xml.XML
+
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.lib.xml.XMLUtils
+import org.junit.Test
+
class TestCLIEncodeDecodeEXI {
@Test def test_CLI_Encode_Decode_EXI_SA(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.dfdl.xsd")
- val infosetPath = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/test_Book2.expected.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.dfdl.xsd",
+ )
+ val infosetPath = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/test_Book2.expected.xml",
+ )
val infosetXML = XML.loadFile(infosetPath.toFile)
withTempDir { tempDir =>
@@ -37,12 +42,10 @@ class TestCLIEncodeDecodeEXI {
val tempXML = Paths.get(tempDir.toString, "temp.xml")
// Encode infoset to schema aware EXI
- runCLI(args"exi -s $schema -o $tempEXI $infosetPath") { cli =>
- } (ExitCode.Success)
+ runCLI(args"exi -s $schema -o $tempEXI $infosetPath") { cli => }(ExitCode.Success)
// Decode EXI to XML and compare against original XML infoset
- runCLI(args"exi -d -s $schema -o $tempXML $tempEXI") { cli =>
- } (ExitCode.Success)
+ runCLI(args"exi -d -s $schema -o $tempXML $tempEXI") { cli => }(ExitCode.Success)
val resultNode = XML.loadFile(tempXML.toFile)
XMLUtils.compareAndReport(infosetXML, resultNode)
@@ -58,10 +61,9 @@ class TestCLIEncodeDecodeEXI {
runCLI(args"exi -o $tempEXI") { cli =>
cli.sendLine(inputXML.toString, inputDone = true)
- } (ExitCode.Success)
+ }(ExitCode.Success)
- runCLI(args"exi -d -o $tempXML $tempEXI") { cli =>
- } (ExitCode.Success)
+ runCLI(args"exi -d -o $tempXML $tempEXI") { cli => }(ExitCode.Success)
val resultNode = XML.loadFile(tempXML.toFile)
XMLUtils.compareAndReport(inputXML, resultNode)
@@ -69,42 +71,51 @@ class TestCLIEncodeDecodeEXI {
}
@Test def test_CLI_EncodeBadFile_EXI(): Unit = {
- val badXML = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv")
+ val badXML = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv",
+ )
runCLI(args"exi $badXML") { cli =>
cli.expectErr("Error parsing input XML")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_DecodeBadFile_EXI(): Unit = {
- val badEXI = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv")
+ val badEXI = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv",
+ )
runCLI(args"exi -d $badEXI") { cli =>
cli.expectErr("No valid EXI document")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_LoadBadSchema_EXI(): Unit = {
- val badSchema = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv")
+ val badSchema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.csv",
+ )
runCLI(args"exi -s $badSchema") { cli =>
cli.expectErr("Error creating EXI grammar for the supplied schema")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
@Test def test_CLI_AttemptDecodeOfSA_EXI(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.dfdl.xsd")
- val infosetPath = path("daffodil-test/src/test/resources/org/apache/daffodil/usertests/test_Book2.expected.xml")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/Book2.dfdl.xsd",
+ )
+ val infosetPath = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/usertests/test_Book2.expected.xml",
+ )
withTempFile { tempEXI =>
// Encode infoset to schema aware EXI
- runCLI(args"exi -s $schema -o $tempEXI $infosetPath") { cli =>
- } (ExitCode.Success)
+ runCLI(args"exi -s $schema -o $tempEXI $infosetPath") { cli => }(ExitCode.Success)
// Attempt to decode EXI using schema unaware decoding
runCLI(args"exi -d $tempEXI") { cli =>
cli.expectErr("Error decoding EXI input")
- } (ExitCode.Failure)
+ }(ExitCode.Failure)
}
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestValidatorPatterns.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestValidatorPatterns.scala
index 764db122e..5738498d2 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestValidatorPatterns.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/TestValidatorPatterns.scala
@@ -18,9 +18,10 @@
package org.apache.daffodil.cliTest
import org.apache.daffodil.cli.ValidatorPatterns
-import org.junit.Test
+
import org.junit.Assert.assertEquals
import org.junit.Assert.fail
+import org.junit.Test
class TestValidatorPatterns {
@Test def testNoArgsPattern(): Unit = {
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
index 4286132c4..9eb857012 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/Util.scala
@@ -30,26 +30,22 @@ import java.nio.file.Path
import java.nio.file.Paths
import java.security.MessageDigest
import java.util.concurrent.TimeUnit
-
import scala.collection.JavaConverters._
import scala.collection.mutable
-import com.fasterxml.jackson.core.io.JsonStringEncoder
+import org.apache.daffodil.cli.Main
+import org.apache.daffodil.cli.Main.ExitCode
+import com.fasterxml.jackson.core.io.JsonStringEncoder
import net.sf.expectit.Expect
import net.sf.expectit.ExpectBuilder
import net.sf.expectit.Result
import net.sf.expectit.filter.Filters.replaceInString
import net.sf.expectit.matcher.Matcher
import net.sf.expectit.matcher.Matchers.contains
-
import org.apache.commons.io.FileUtils
-
import org.junit.Assert.assertEquals
-import org.apache.daffodil.cli.Main
-import org.apache.daffodil.cli.Main.ExitCode
-
object Util {
private val isWindows = System.getProperty("os.name").toLowerCase().startsWith("windows")
@@ -79,7 +75,7 @@ object Util {
val buffer = new Array[Byte](8192)
val stream = Files.newInputStream(path)
var read = 0
- while ({read = stream.read(buffer); read} > 0) {
+ while ({ read = stream.read(buffer); read } > 0) {
md.update(buffer, 0, read)
}
val md5sum = md.digest()
@@ -92,7 +88,7 @@ object Util {
* passing in the Path to that new file, and delete the file when the
* function returns.
*/
- def withTempFile(f: (Path) => Unit) : Unit = withTempFile(null, f)
+ def withTempFile(f: (Path) => Unit): Unit = withTempFile(null, f)
/**
* Create a temporary file in /tmp/daffodil/ with a given suffix, call a user
@@ -174,10 +170,13 @@ object Util {
* @throws AssertionError if the actual exit code does not match the expected exit code
* @throws ExpectIOException if a CLITester expect validation operation fails
*/
- def runCLI
- (args: Array[String], classpaths: Seq[Path] = Seq(), fork: Boolean = false, timeout: Int = 10, debug: Boolean = false)
- (testFunc: (CLITester) => Unit)
- (expectedExitCode: ExitCode.Value): Unit = {
+ def runCLI(
+ args: Array[String],
+ classpaths: Seq[Path] = Seq(),
+ fork: Boolean = false,
+ timeout: Int = 10,
+ debug: Boolean = false,
+ )(testFunc: (CLITester) => Unit)(expectedExitCode: ExitCode.Value): Unit = {
val (toIn, fromOut, fromErr, cliThreadOrProc: Either[CLIThread, Process]) =
if (classpaths.nonEmpty || fork) {
@@ -322,8 +321,8 @@ object Util {
private class TestThread(
testFunc: (CLITester) => Unit,
tester: CLITester,
- cli: Either[Thread, Process])
- extends Thread {
+ cli: Either[Thread, Process],
+ ) extends Thread {
var optException: Option[Throwable] = None
@@ -359,7 +358,12 @@ object Util {
* arguments to use (excluding the daffodil binary) and streams to use for
* stdin/out/err.
*/
- private class CLIThread(args: Array[String], in: InputStream, out: OutputStream, err: OutputStream) extends Thread {
+ private class CLIThread(
+ args: Array[String],
+ in: InputStream,
+ out: OutputStream,
+ err: OutputStream,
+ ) extends Thread {
var exitCode: ExitCode.Value = _
override def run(): Unit = {
@@ -433,7 +437,7 @@ object Util {
val buffer = new Array[Byte](chunkSize)
val stream = Files.newInputStream(path)
var read = 0
- while ({read = stream.read(buffer); read} > 0) {
+ while ({ read = stream.read(buffer); read } > 0) {
if (read == chunkSize) {
expect.sendBytes(buffer)
} else {
@@ -552,25 +556,26 @@ object Util {
// space element and drop all the spaces. The following does this by
// accumulating args until we hit a space and adds that to the
// final array
- val (res, lastAccumulated) = buf.foldLeft((mutable.ArrayBuffer[String](), "")) { case ((resArray, accumulated), curVal) =>
- (accumulated, curVal) match {
- case ("", " ") => {
- // curVal is a space, but we have accumulated nothing. This means
- // there were multiple spaces in a row. Just ignore this curVal
- (resArray, "")
+ val (res, lastAccumulated) = buf.foldLeft((mutable.ArrayBuffer[String](), "")) {
+ case ((resArray, accumulated), curVal) =>
+ (accumulated, curVal) match {
+ case ("", " ") => {
+ // curVal is a space, but we have accumulated nothing. This means
+ // there were multiple spaces in a row. Just ignore this curVal
+ (resArray, "")
+ }
+ case (_, " ") => {
+ // curVal is a space and we have accumulated an argument. Append
+ // what we have accumulated to the array and reset the accumulated
+ // string--we will start accumulating for the next arg
+ (resArray :+ accumulated, "")
+ }
+ case _ => {
+ // curVal is not a space. Do not modify the array, but concatenate
+ // the curVal to what we've accumulated so far
+ (resArray, accumulated + curVal)
+ }
}
- case (_, " ") => {
- // curVal is a space and we have accumulated an argument. Append
- // what we have accumulated to the array and reset the accumulated
- // string--we will start accumulating for the next arg
- (resArray :+ accumulated, "")
- }
- case _ => {
- // curVal is not a space. Do not modify the array, but concatenate
- // the curVal to what we've accumulated so far
- (resArray, accumulated + curVal)
- }
- }
}
// if non-empty, the last thing we accumulated must be appended to the array
val args =
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestEmbedded.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestEmbedded.scala
index 2ebdae50a..e175aedeb 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestEmbedded.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestEmbedded.scala
@@ -19,19 +19,20 @@ package org.apache.daffodil.cliTest.schematron
import java.util.UUID
-import org.junit.Test
-
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestEmbedded {
@Test def alwaysFails(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/always-fails-1.dfdl.xsd")
-
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.sendLine(UUID.randomUUID.toString, inputDone = true)
- cli.expect("</always-fails>")
- } (ExitCode.ParseError)
+
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.sendLine(UUID.randomUUID.toString, inputDone = true)
+ cli.expect("</always-fails>")
+ }(ExitCode.ParseError)
}
@Test def unitPriceWithoutValidation(): Unit = {
@@ -40,99 +41,111 @@ class TestEmbedded {
runCLI(args"""parse -r list -s $schema""") { cli =>
cli.send("widget,monday,1,$5.00,$5.00", inputDone = true)
cli.expect("</ex:list>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
@Test def unitPriceWithValidation(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/unit_price.dfdl.xsd")
- runCLI(args"""parse -r list --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
+ runCLI(
+ args"""parse -r list --validate schematron="${jsonEscape(schema.toString)}" -s $schema""",
+ ) { cli =>
cli.send("widget,monday,1,$5.00,$6.00", inputDone = true)
cli.expect("</ex:list>")
cli.expectErr("Validation Error: wrong unit price for widget, monday")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
}
@Test def unitPriceWithValidationCheckMessage(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/unit_price.dfdl.xsd")
- runCLI(args"""parse -r list --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
+ runCLI(
+ args"""parse -r list --validate schematron="${jsonEscape(schema.toString)}" -s $schema""",
+ ) { cli =>
cli.send("widget,monday,5,$5.00,$25.00||gadget,tuesday,1,$10.00,$11.00", inputDone = true)
cli.expect("</ex:list>")
cli.expectErr("Validation Error: wrong unit price for gadget, tuesday")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
}
@Test def extends1(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/extends-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("bob;l;smith", inputDone = true)
- cli.expect("</name>")
- } (ExitCode.Success)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("bob;l;smith", inputDone = true)
+ cli.expect("</name>")
+ }(ExitCode.Success)
}
@Test def extends2(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/extends-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("ob;;smith", inputDone = true)
- cli.expect("</name>")
- } (ExitCode.Success)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("ob;;smith", inputDone = true)
+ cli.expect("</name>")
+ }(ExitCode.Success)
}
@Test def extends3(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/extends-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send(";;smith", inputDone = true)
- cli.expectErr("Validation Error: first is blank")
- } (ExitCode.ParseError)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send(";;smith", inputDone = true)
+ cli.expectErr("Validation Error: first is blank")
+ }(ExitCode.ParseError)
}
@Test def extends4(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/extends-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("bob;l;", inputDone = true)
- cli.expectErr("Validation Error: last is blank")
- } (ExitCode.ParseError)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("bob;l;", inputDone = true)
+ cli.expectErr("Validation Error: last is blank")
+ }(ExitCode.ParseError)
}
@Test def extends5(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/extends-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send(";l;", inputDone = true)
- cli.expectErr("Validation Error: last is blank")
- cli.expectErr("Validation Error: first is blank")
- } (ExitCode.ParseError)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send(";l;", inputDone = true)
+ cli.expectErr("Validation Error: last is blank")
+ cli.expectErr("Validation Error: first is blank")
+ }(ExitCode.ParseError)
}
@Test def testWithNs1(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/with-ns-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("0;1", inputDone = true)
- cli.expect("</myns:interval>")
- } (ExitCode.Success)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("0;1", inputDone = true)
+ cli.expect("</myns:interval>")
+ }(ExitCode.Success)
}
@Test def testWithNs2(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/with-ns-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("2;1", inputDone = true)
- cli.expectErr("Validation Error")
- } (ExitCode.ParseError)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("2;1", inputDone = true)
+ cli.expectErr("Validation Error")
+ }(ExitCode.ParseError)
}
@Test def testWithNs3(): Unit = {
val schema = path("daffodil-schematron/src/test/resources/xsd/with-ns-1.dfdl.xsd")
- runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") { cli =>
- cli.send("0;0", inputDone = true)
- cli.expectErr("Validation Error")
- } (ExitCode.ParseError)
+ runCLI(args"""parse --validate schematron="${jsonEscape(schema.toString)}" -s $schema""") {
+ cli =>
+ cli.send("0;0", inputDone = true)
+ cli.expectErr("Validation Error")
+ }(ExitCode.ParseError)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestSvrlOutput.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestSvrlOutput.scala
index 70b2c6308..796800015 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestSvrlOutput.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestSvrlOutput.scala
@@ -17,26 +17,33 @@
package org.apache.daffodil.cliTest.schematron
+import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardOpenOption.APPEND
-import java.nio.charset.StandardCharsets.UTF_8
+import scala.xml.XML
+
+import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Test
-import scala.xml.XML
-
-import org.apache.daffodil.cli.cliTest.Util._
-import org.apache.daffodil.cli.Main.ExitCode
-
class TestSvrlOutput {
private def makeConf(conf: Path, schematron: Path, svrl: Path): Unit = {
- Files.write(conf, s"""schematron.path="${jsonEscape(schematron.toString)}"\n""".getBytes(UTF_8), APPEND)
- Files.write(conf, s"""schematron.svrl.file="${jsonEscape(svrl.toString)}"\n""".getBytes(UTF_8), APPEND)
+ Files.write(
+ conf,
+ s"""schematron.path="${jsonEscape(schematron.toString)}"\n""".getBytes(UTF_8),
+ APPEND,
+ )
+ Files.write(
+ conf,
+ s"""schematron.svrl.file="${jsonEscape(svrl.toString)}"\n""".getBytes(UTF_8),
+ APPEND,
+ )
}
@Test def validationSuccess(): Unit = {
@@ -44,28 +51,30 @@ class TestSvrlOutput {
val schematron = path("daffodil-schematron/src/test/resources/sch/never-fails.sch")
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
- withTempFile(".conf", { conf =>
- withTempFile { svrl =>
-
- makeConf(conf, schematron, svrl)
-
- runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
- cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
- } (ExitCode.Success)
-
- XML.loadFile(svrl.toFile) match {
- case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
- val res = rules.find {
- case <svrl:failed-assert>{ _* }</svrl:failed-assert> => true
- case _ => false
- }
- // we should not have found failures
- assertFalse(res.isDefined)
- case _ =>
- fail("schematron pattern didnt match")
+ withTempFile(
+ ".conf",
+ { conf =>
+ withTempFile { svrl =>
+ makeConf(conf, schematron, svrl)
+
+ runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
+ cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
+ }(ExitCode.Success)
+
+ XML.loadFile(svrl.toFile) match {
+ case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
+ val res = rules.find {
+ case <svrl:failed-assert>{_*}</svrl:failed-assert> => true
+ case _ => false
+ }
+ // we should not have found failures
+ assertFalse(res.isDefined)
+ case _ =>
+ fail("schematron pattern didnt match")
+ }
}
- }
- })
+ },
+ )
}
// should get validation output file on a validation failure
@@ -74,47 +83,53 @@ class TestSvrlOutput {
val schematron = path("daffodil-schematron/src/test/resources/sch/always-fails.sch")
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
- withTempFile(".conf", { conf =>
- withTempFile { svrl =>
-
- makeConf(conf, schematron, svrl)
-
- runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
- cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
- } (ExitCode.ParseError)
-
- XML.loadFile(svrl.toFile) match {
- case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
- val res = rules.find {
- case <svrl:failed-assert>{ _* }</svrl:failed-assert> => true
- case _ => false
- }
- // we should have found some failures
- assertTrue(res.isDefined)
- case _ =>
- fail("schematron pattern didnt match")
+ withTempFile(
+ ".conf",
+ { conf =>
+ withTempFile { svrl =>
+ makeConf(conf, schematron, svrl)
+
+ runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
+ cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
+ }(ExitCode.ParseError)
+
+ XML.loadFile(svrl.toFile) match {
+ case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
+ val res = rules.find {
+ case <svrl:failed-assert>{_*}</svrl:failed-assert> => true
+ case _ => false
+ }
+ // we should have found some failures
+ assertTrue(res.isDefined)
+ case _ =>
+ fail("schematron pattern didnt match")
+ }
}
- }
- })
+ },
+ )
}
// shouldnt get a validation output file on parse failure
// based on negative test test_996_CLI_Parsing_negativeTest04
@Test def parseFailure(): Unit = {
- val schema = path("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
+ val schema = path(
+ "daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd",
+ )
val schematron = path("daffodil-schematron/src/test/resources/sch/never-fails.sch")
- withTempFile(".conf", { conf =>
- withTempFile { svrl =>
+ withTempFile(
+ ".conf",
+ { conf =>
+ withTempFile { svrl =>
+ makeConf(conf, schematron, svrl)
- makeConf(conf, schematron, svrl)
-
- runCLI(args"parse --validate schematron=$conf -s $schema -r unknown") { cli =>
- cli.send("12", inputDone = true)
- cli.expectErr("No root element found for unknown in any available namespace")
- } (ExitCode.UnableToCreateProcessor)
- }
- })
+ runCLI(args"parse --validate schematron=$conf -s $schema -r unknown") { cli =>
+ cli.send("12", inputDone = true)
+ cli.expectErr("No root element found for unknown in any available namespace")
+ }(ExitCode.UnableToCreateProcessor)
+ }
+ },
+ )
}
// parse should fail with validation diagnostic when unable to write to the specified location
@@ -124,14 +139,16 @@ class TestSvrlOutput {
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
val svrl = path("thisisnotavalidlocation/schematron.svrl")
- withTempFile(".conf", { conf =>
-
- makeConf(conf, schematron, svrl)
+ withTempFile(
+ ".conf",
+ { conf =>
+ makeConf(conf, schematron, svrl)
- runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
- cli.expectErr("[error] Validation Error")
- } (ExitCode.ParseError)
- })
+ runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
+ cli.expectErr("[error] Validation Error")
+ }(ExitCode.ParseError)
+ },
+ )
}
// validator output should overwrite existing file
@@ -140,29 +157,32 @@ class TestSvrlOutput {
val schematron = path("daffodil-schematron/src/test/resources/sch/never-fails.sch")
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
- withTempFile(".conf", { conf =>
- withTempFile { svrl =>
- Files.write(svrl, "=== this content will be overwritten ===".getBytes(UTF_8), APPEND)
-
- makeConf(conf, schematron, svrl)
-
- runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
- cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
- } (ExitCode.Success)
-
- XML.loadFile(svrl.toFile) match {
- case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
- val res = rules.find {
- case <svrl:failed-assert>{ _* }</svrl:failed-assert> => true
- case _ => false
- }
- // we should not have found failures
- assertFalse(res.isDefined)
- case _ =>
- fail("schematron pattern didnt match")
+ withTempFile(
+ ".conf",
+ { conf =>
+ withTempFile { svrl =>
+ Files.write(svrl, "=== this content will be overwritten ===".getBytes(UTF_8), APPEND)
+
+ makeConf(conf, schematron, svrl)
+
+ runCLI(args"parse --validate schematron=$conf -s $schema $input") { cli =>
+ cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
+ }(ExitCode.Success)
+
+ XML.loadFile(svrl.toFile) match {
+ case <svrl:schematron-output>{rules @ _*}</svrl:schematron-output> =>
+ val res = rules.find {
+ case <svrl:failed-assert>{_*}</svrl:failed-assert> => true
+ case _ => false
+ }
+ // we should not have found failures
+ assertFalse(res.isDefined)
+ case _ =>
+ fail("schematron pattern didnt match")
+ }
}
- }
- })
+ },
+ )
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestValidating.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestValidating.scala
index b246e25cc..548c87a2e 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestValidating.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/cli/cliTest/schematron/TestValidating.scala
@@ -17,10 +17,10 @@
package org.apache.daffodil.cliTest.schematron
-import org.junit.Test
-
-import org.apache.daffodil.cli.cliTest.Util._
import org.apache.daffodil.cli.Main.ExitCode
+import org.apache.daffodil.cli.cliTest.Util._
+
+import org.junit.Test
class TestValidating {
@@ -31,7 +31,7 @@ class TestValidating {
runCLI(args"parse -s $schema $input") { cli =>
cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
// always fails sch, with validate flag should fail
@@ -40,10 +40,12 @@ class TestValidating {
val schematron = path("daffodil-schematron/src/test/resources/sch/always-fails.sch")
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
- runCLI(args"""parse --validate schematron="${jsonEscape(schematron.toString)}" -s $schema $input""") { cli =>
+ runCLI(args"""parse --validate schematron="${jsonEscape(
+ schematron.toString,
+ )}" -s $schema $input""") { cli =>
cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
cli.expectErr("[error] Validation Error: never fails")
- } (ExitCode.ParseError)
+ }(ExitCode.ParseError)
}
// never fails sch, with validate flag should pass
@@ -52,8 +54,10 @@ class TestValidating {
val schematron = path("daffodil-schematron/src/test/resources/sch/never-fails.sch")
val input = path("daffodil-cli/src/test/resources/org/apache/daffodil/cli/input/uuid.txt")
- runCLI(args"""parse --validate schematron="${jsonEscape(schematron.toString)}" -s $schema $input""") { cli =>
+ runCLI(args"""parse --validate schematron="${jsonEscape(
+ schematron.toString,
+ )}" -s $schema $input""") { cli =>
cli.expect("<never-fails>2f6481e6-542c-11eb-ae93-0242ac130002</never-fails>")
- } (ExitCode.Success)
+ }(ExitCode.Success)
}
}
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/layers/BuggyTransformer.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/layers/BuggyTransformer.scala
index 52e440776..d1b8d8231 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/layers/BuggyTransformer.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/layers/BuggyTransformer.scala
@@ -18,26 +18,24 @@
package org.apache.daffodil.layers
import java.io.InputStream
-import org.apache.daffodil.runtime1.layers.LayerCompiler
+
import org.apache.daffodil.runtime1.layers.LayerCompileInfo
+import org.apache.daffodil.runtime1.layers.LayerCompiler
import org.apache.daffodil.runtime1.layers.LayerRuntimeInfo
import org.apache.daffodil.runtime1.layers.LayerTransformer
import org.apache.daffodil.runtime1.layers.LayerTransformerFactory
import org.apache.daffodil.runtime1.processors.ParseOrUnparseState
-
-final class BuggyLayerCompiler
- extends LayerCompiler("buggy") {
+final class BuggyLayerCompiler extends LayerCompiler("buggy") {
override def compileLayer(layerCompileInfo: LayerCompileInfo): BuggyTransformerFactory = {
new BuggyTransformerFactory(name)
}
}
-final class BuggyTransformerFactory(name: String)
- extends LayerTransformerFactory(name) {
+final class BuggyTransformerFactory(name: String) extends LayerTransformerFactory(name) {
- override def newInstance(layerRuntimeInfo: LayerRuntimeInfo)= {
+ override def newInstance(layerRuntimeInfo: LayerRuntimeInfo) = {
new BuggyTransformer(name, layerRuntimeInfo)
}
}
@@ -57,7 +55,10 @@ class BuggyTransformer(name: String, layerRuntimeInfo: LayerRuntimeInfo)
jos
}
- override protected def wrapLimitingStream(state: ParseOrUnparseState, jis: java.io.OutputStream) = {
+ override protected def wrapLimitingStream(
+ state: ParseOrUnparseState,
+ jis: java.io.OutputStream,
+ ) = {
jis
}
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI.scala
index 1f945bf19..8cef552e5 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI.scala
@@ -17,14 +17,16 @@
package org.apache.daffodil.core.api
+import org.apache.daffodil.lib.Implicits._
import org.apache.daffodil.lib.util._
-import org.junit.Test
-import org.apache.daffodil.lib.Implicits._; object INoWarn7 { ImplicitsSuppressUnusedImportWarning() }
+
+import org.junit.Test; object INoWarn7 { ImplicitsSuppressUnusedImportWarning() }
import org.apache.daffodil.core.util.TestUtils
class TestDFDLParser_New {
- @Test def testParseOccursCountKindOfParsedDelimitedBySeparatorImplicitWithMaxOccurs(): Unit = {
+ @Test def testParseOccursCountKindOfParsedDelimitedBySeparatorImplicitWithMaxOccurs()
+ : Unit = {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
@@ -34,13 +36,15 @@ class TestDFDLParser_New {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="delimited" maxOccurs="4" minOccurs="0" dfdl:occursCountKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5;6;7;8;.")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
- @Test def testParseOccursCountKindOfParsedDelimitedBySeparatorImplicitWithMaxOccurs2(): Unit = {
+ @Test def testParseOccursCountKindOfParsedDelimitedBySeparatorImplicitWithMaxOccurs2()
+ : Unit = {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
@@ -50,7 +54,8 @@ class TestDFDLParser_New {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="delimited" maxOccurs="100" minOccurs="0" dfdl:occursCountKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5;6;7;8!.")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI1.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI1.scala
index 508c50665..ba9537c6a 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI1.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestAPI1.scala
@@ -17,13 +17,14 @@
package org.apache.daffodil.core.api
+import scala.xml._
+
import org.apache.daffodil.core.util._
+import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.util._
import org.junit.Assert._
-import scala.xml._
-import org.apache.daffodil.lib.util._
import org.junit.Test
-import org.apache.daffodil.lib.Implicits._
class TestDFDLParser {
@@ -31,7 +32,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>)
+ <xs:element name="e1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>,
+ )
val (_, actual) = TestUtils.testString(sch, "5678")
val expected: Node = <e1>5678</e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -47,7 +49,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5")
val expected = <e1><s1>5</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -64,7 +67,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "56")
val expected = <e1><s1>5</s1><s2>6</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -80,7 +84,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }" dfdl:occursCountKind="fixed" minOccurs="3" maxOccurs="3"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "567")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -96,7 +101,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }" dfdl:occursCountKind="fixed" minOccurs="3" maxOccurs="3"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5,6,7")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -113,7 +119,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 5 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "55,000")
TestUtils.assertEqualsXMLElements(<e1><s1>5</s1><s2>5000</s2></e1>, actual)
}
@@ -129,7 +136,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 5 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "55.001")
}
@@ -147,7 +155,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:short" dfdl:lengthKind="explicit" dfdl:length="{ 5 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "55,000")
TestUtils.assertEqualsXMLElements(<e1><s1>5</s1><s2>5000</s2></e1>, actual)
}
@@ -162,7 +171,8 @@ class TestDFDLParser {
<xs:element name="s" type="xs:short" dfdl:lengthKind="explicit" dfdl:length="{ 6 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "70,000")
}
@@ -180,7 +190,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:byte" dfdl:lengthKind="explicit" dfdl:length="{ 3 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "55123")
TestUtils.assertEqualsXMLElements(<e1><s1>55</s1><s2>123</s2></e1>, actual)
}
@@ -198,16 +209,21 @@ class TestDFDLParser {
<xs:element name="number" type="xs:long" dfdl:lengthKind="explicit" dfdl:length="{ 5 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "1-800-555-1212")
- TestUtils.assertEqualsXMLElements(<e1><country>1</country><area>-800</area><region>-555</region><number>-1212</number></e1>, actual)
+ TestUtils.assertEqualsXMLElements(
+ <e1><country>1</country><area>-800</area><region>-555</region><number>-1212</number></e1>,
+ actual,
+ )
}
@Test def testNumber2(): Unit = {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="mersenne" type="xs:byte" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>)
+ <xs:element name="mersenne" type="xs:byte" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>,
+ )
val (_, actual) = TestUtils.testString(sch, "-127")
TestUtils.assertEqualsXMLElements(<mersenne>-127</mersenne>, actual)
}
@@ -216,7 +232,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="perfect" type="xs:byte" dfdl:textNumberPattern="+0" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>)
+ <xs:element name="perfect" type="xs:byte" dfdl:textNumberPattern="+0" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>,
+ )
val (_, actual) = TestUtils.testString(sch, "+3")
TestUtils.assertEqualsXMLElements(<perfect>3</perfect>, actual)
}
@@ -225,7 +242,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="needs-square-root" type="xs:unsignedLong" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>)
+ <xs:element name="needs-square-root" type="xs:unsignedLong" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "-3")
}
@@ -236,7 +254,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="world-population" type="xs:unsignedInt" dfdl:lengthKind="explicit" dfdl:length="{ 13 }"/>)
+ <xs:element name="world-population" type="xs:unsignedInt" dfdl:lengthKind="explicit" dfdl:length="{ 13 }"/>,
+ )
val e = intercept[Exception] {
// As of 18:31 UTC (EST+5) Jun 8, 2012
TestUtils.testString(sch, "7,018,631,476")
@@ -248,7 +267,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="last-element-indicator" type="xs:unsignedShort" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>)
+ <xs:element name="last-element-indicator" type="xs:unsignedShort" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "-1")
}
@@ -259,7 +279,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="bits" type="xs:unsignedByte" dfdl:lengthKind="explicit" dfdl:length="{ 3 }"/>)
+ <xs:element name="bits" type="xs:unsignedByte" dfdl:lengthKind="explicit" dfdl:length="{ 3 }"/>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "256")
}
@@ -276,7 +297,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 20 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "55555555555555555555")
}
@@ -293,7 +315,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:initiator="((" dfdl:terminator="))" dfdl:lengthKind="explicit" dfdl:length="{ 1 + 1 }" dfdl:occursCountKind="fixed" minOccurs="3" maxOccurs="3"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "[[{{((55)),,((66)),,((77))}}]]")
val expected = <e1><s1>55</s1><s1>66</s1><s1>77</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -309,7 +332,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:initiator="((" dfdl:terminator="))" dfdl:lengthKind="explicit" dfdl:length="{ 1 + 0 + 1 }" dfdl:occursCountKind="fixed" minOccurs="3" maxOccurs="3"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "[[{{((55)),,((66)),,((77))}}]]")
val expected = <e1><s1>55</s1><s1>66</s1><s1>77</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -319,7 +343,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>)
+ <xs:element name="e1" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>,
+ )
val e = intercept[Exception] {
TestUtils.testString(sch, "A")
}
@@ -337,7 +362,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5678A")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1><s2>A</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -354,7 +380,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "5;6;7;8;A")
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1><s2>A</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -371,7 +398,8 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="delimited" dfdl:terminator="."/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
val (_, actual) = TestUtils.testString(sch, "5;6;7;8;A.", areTracing)
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1><s2>A</s2></e1>
@@ -388,7 +416,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:string" dfdl:lengthKind="delimited" minOccurs="0" dfdl:occursCountKind="parsed" dfdl:terminator=";"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
val (_, actual) = TestUtils.testString(sch, "5;6;7;8;.", areTracing)
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1></e1>
@@ -405,7 +434,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="delimited" minOccurs="0" dfdl:occursCountKind="implicit" maxOccurs="4"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
val (_, actual) = TestUtils.testString(sch, "5;6;7;8;.", areTracing)
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1></e1>
@@ -423,7 +453,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="delimited" minOccurs="0" dfdl:occursCountKind="parsed"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
val (_, actual) = TestUtils.testString(sch, "5;6;7;8!.", areTracing)
val expected = <e1><s1>5</s1><s1>6</s1><s1>7</s1><s1>8</s1></e1>
@@ -441,7 +472,8 @@ class TestDFDLParser {
<xs:element name="s1" type="xs:int" dfdl:lengthKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testBinary(sch, "FFFFFFFF")
val expected = <e1><s1>-1</s1></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -458,9 +490,11 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:int" dfdl:byteOrder="littleEndian" dfdl:lengthKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
- val (_, actual) = TestUtils.testBinary(sch, "000000013bFFFFFFFF3b080402013b000000003bFFFFFF7F", areTracing)
+ val (_, actual) =
+ TestUtils.testBinary(sch, "000000013bFFFFFFFF3b080402013b000000003bFFFFFF7F", areTracing)
val expected = <e1><s1>1</s1><s1>-1</s1><s1>134480385</s1><s1>0</s1><s2>2147483647</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
@@ -469,7 +503,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format representation="binary" byteOrder="bigEndian" binaryNumberRep="binary" binaryFloatRep="ieee" ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>)
+ <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>,
+ )
val (_, actual) = TestUtils.testBinary(sch, "3FF0000000000000")
val expected = <e1>1.0</e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -479,7 +514,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format representation="binary" byteOrder="bigEndian" binaryNumberRep="binary" binaryFloatRep="ieee" ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>)
+ <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>,
+ )
val (_, actual) = TestUtils.testBinary(sch, "BFF0000000000000")
val expected = <e1>-1.0</e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -489,7 +525,8 @@ class TestDFDLParser {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format representation="binary" byteOrder="bigEndian" binaryNumberRep="binary" binaryFloatRep="ieee" ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>)
+ <xs:element name="e1" type="xs:double" dfdl:lengthKind="implicit"/>,
+ )
val (_, actual) = TestUtils.testBinary(sch, "0000000000000001")
val expected = <e1>4.9E-324</e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -506,9 +543,14 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:double" dfdl:byteOrder="littleEndian" dfdl:lengthKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
- val (_, actual) = TestUtils.testBinary(sch, "3FF00000000000003bBFF00000000000003b08040201080402013b00000000000000003bFFFFFFFFFFFFFF7F")
- val expected = <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.7340609871421765E-270</s1><s1>0.0</s1><s2>NaN</s2></e1>
+ </xs:element>,
+ )
+ val (_, actual) = TestUtils.testBinary(
+ sch,
+ "3FF00000000000003bBFF00000000000003b08040201080402013b00000000000000003bFFFFFFFFFFFFFF7F",
+ )
+ val expected =
+ <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.7340609871421765E-270</s1><s1>0.0</s1><s2>NaN</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
@@ -524,9 +566,11 @@ class TestDFDLParser {
<xs:element name="s3" type="xs:double" dfdl:lengthKind="explicit" dfdl:length="{ 7 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(sch, "01.0;-1.0;4.15;0.31;8.6E-2001,234.9")
- val expected = <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.15</s1><s1>0.31</s1><s2>8.6E-200</s2><s3>1234.9</s3></e1>
+ val expected =
+ <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.15</s1><s1>0.31</s1><s2>8.6E-200</s2><s3>1234.9</s3></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
@@ -541,9 +585,12 @@ class TestDFDLParser {
<xs:element name="s2" type="xs:float" dfdl:byteOrder="littleEndian" dfdl:lengthKind="implicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
- val (_, actual) = TestUtils.testBinary(sch, "3F8000003bBF8000003b080402013b000000003b0000C07F")
- val expected = <e1><s1>1.0</s1><s1>-1.0</s1><s1>3.972466E-34</s1><s1>0.0</s1><s2>NaN</s2></e1>
+ </xs:element>,
+ )
+ val (_, actual) =
+ TestUtils.testBinary(sch, "3F8000003bBF8000003b080402013b000000003b0000C07F")
+ val expected =
+ <e1><s1>1.0</s1><s1>-1.0</s1><s1>3.972466E-34</s1><s1>0.0</s1><s2>NaN</s2></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
@@ -559,10 +606,12 @@ class TestDFDLParser {
<xs:element name="s3" type="xs:float" dfdl:lengthKind="explicit" dfdl:length="{ 7 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val areTracing = false
val (_, actual) = TestUtils.testString(sch, "01.0;-1.0;4.15;0.31;-7.1E81,234.9", areTracing)
- val expected = <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.15</s1><s1>0.31</s1><s2>-7.1E8</s2><s3>1234.9</s3></e1>
+ val expected =
+ <e1><s1>1.0</s1><s1>-1.0</s1><s1>4.15</s1><s1>0.31</s1><s2>-7.1E8</s2><s3>1234.9</s3></e1>
TestUtils.assertEqualsXMLElements(expected, actual)
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestDsomCompiler3.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestDsomCompiler3.scala
index 58eafd9bb..8f1f31f7b 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestDsomCompiler3.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestDsomCompiler3.scala
@@ -17,16 +17,18 @@
package org.apache.daffodil.core.api
-import org.apache.daffodil.lib.xml.XMLUtils
-import org.apache.daffodil.lib.util._
-import org.apache.daffodil.lib.Implicits._
+import java.io.File
+
import org.apache.daffodil.core.compiler._
+import org.apache.daffodil.core.dsom.DFDLElement
+import org.apache.daffodil.lib.Implicits._
import org.apache.daffodil.lib.schema.annotation.props.gen._
+import org.apache.daffodil.lib.util._
+import org.apache.daffodil.lib.xml.XMLUtils
+
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
-import java.io.File
import org.junit.Test
-import org.apache.daffodil.core.dsom.DFDLElement
class TestDsomCompiler3 {
@@ -39,10 +41,9 @@ class TestDsomCompiler3 {
val sc = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
-
<xs:element name="list" type="tns:example1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -51,7 +52,8 @@ class TestDsomCompiler3 {
<xs:sequence dfdl:separator="">
<xs:element name="w" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val tmpDir = new File("./dfdl_tmp")
if (tmpDir.exists) {
@@ -72,7 +74,7 @@ class TestDsomCompiler3 {
//
val Seq(schema) = sset.schemas
val Seq(schemaDoc, _) = schema.schemaDocuments
- val Seq(decl) = schemaDoc.globalElementDecls.map{ _.asRoot }
+ val Seq(decl) = schemaDoc.globalElementDecls.map { _.asRoot }
val Seq(ct) = schemaDoc.globalComplexTypeDefs
assertEquals("example1", ct.name)
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestForHeapDump.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestForHeapDump.scala
index 87a427867..c43341e77 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestForHeapDump.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestForHeapDump.scala
@@ -17,15 +17,13 @@
package org.apache.daffodil.core.api;
-import org.apache.daffodil.lib.api._
-
+import scala.xml.NodeSeq
import org.apache.daffodil.core.util.TestUtils.compileSchema
+import org.apache.daffodil.lib.api._
import org.apache.daffodil.lib.util._
-import org.junit.Assert.fail
-// import org.junit.Test
-import scala.xml.NodeSeq
+import org.junit.Assert.fail
/**
* Test rig that allows capture of heap dumps using jvisualVM, for subsequent
@@ -56,11 +54,12 @@ class TestForHeapDump {
*/
def getDataProcWithInclude() = {
val sch = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat" lengthKind="explicit"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat" lengthKind="explicit"/>,
rootElem,
elementFormDefault = "unqualified",
- useDefaultNamespace = false)
+ useDefaultNamespace = false,
+ )
val p = compileSchema(sch).withValidationMode(ValidationMode.Off)
p
}
@@ -74,7 +73,7 @@ class TestForHeapDump {
def getDataProcNoInclude() = {
val sch = SchemaUtils.dfdlTestSchema(
NodeSeq.Empty,
- <dfdl:format
+ <dfdl:format
alignment="1"
alignmentUnits="bytes"
binaryFloatRep="ieee"
@@ -144,7 +143,8 @@ class TestForHeapDump {
/>,
rootElem,
elementFormDefault = "unqualified",
- useDefaultNamespace = false)
+ useDefaultNamespace = false,
+ )
val p = compileSchema(sch).withValidationMode(ValidationMode.Off)
p
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestParseIndividualMessages.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestParseIndividualMessages.scala
index 3772fdd8f..31371299c 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestParseIndividualMessages.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/api/TestParseIndividualMessages.scala
@@ -17,15 +17,6 @@
package org.apache.daffodil.core.api
-import org.apache.daffodil.runtime1.api._
-
-import org.apache.daffodil.lib.Implicits.intercept
-import org.apache.daffodil.io.SocketPairTestRig
-import org.apache.daffodil.lib.util.SchemaUtils
-import org.apache.daffodil.core.util.TestUtils
-import org.junit.Assert._
-import org.junit.Test
-
import java.io.InputStream
import java.io.OutputStream
import scala.concurrent.Await
@@ -35,6 +26,14 @@ import scala.concurrent.TimeoutException
import scala.concurrent.duration.Duration
import scala.xml.Node
+import org.apache.daffodil.core.util.TestUtils
+import org.apache.daffodil.io.SocketPairTestRig
+import org.apache.daffodil.lib.Implicits.intercept
+import org.apache.daffodil.lib.util.SchemaUtils
+import org.apache.daffodil.runtime1.api._
+
+import org.junit.Assert._
+import org.junit.Test
/**
* Shows that we can parse exactly 1 message from a TCP network socket
@@ -48,9 +47,10 @@ class TestParseIndividualMessages {
// DFDL schema for element e1 which occupies exactly 4 bytes.
//
val exactly4ByteSch = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format representation="binary" byteOrder="bigEndian" binaryNumberRep="binary" ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="4"/>)
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format representation="binary" byteOrder="bigEndian" binaryNumberRep="binary" ref="tns:GeneralFormat"/>,
+ <xs:element name="e1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="4"/>,
+ )
/**
* Test shows that at least for simple fixed-length data, Daffodil parse returns
@@ -88,10 +88,11 @@ class TestParseIndividualMessages {
// DFDL schema for delimited element.
//
private def delimitedSchema(term: String) = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format representation="text" ref="tns:GeneralFormat"/>,
- <xs:element name="e1" type="xs:string" dfdl:lengthKind="delimited"
- dfdl:terminator={ term } />)
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format representation="text" ref="tns:GeneralFormat"/>,
+ <xs:element name="e1" type="xs:string" dfdl:lengthKind="delimited"
+ dfdl:terminator={term} />,
+ )
/**
* Helper so we can test various delimiter-oriented scenarios.
@@ -103,7 +104,8 @@ class TestParseIndividualMessages {
private def testHelperDaffodilParseDelimitedFromNetwork(
data: String,
terminator: String,
- followingDataString: String) = {
+ followingDataString: String,
+ ) = {
val sptr = new SocketPairTestRig {
override def test(pos: OutputStream, cis: InputStream): Unit = {
@@ -145,7 +147,9 @@ class TestParseIndividualMessages {
intercept[TimeoutException] {
testHelperDaffodilParseDelimitedFromNetwork("1234", "$", "$")
}
- fail("if we get here, then we intercepted a TimeoutException, which means Daffodil was hung.")
+ fail(
+ "if we get here, then we intercepted a TimeoutException, which means Daffodil was hung.",
+ )
}
/**
@@ -159,8 +163,7 @@ class TestParseIndividualMessages {
*/
@Test // DAFFODIL-2504
def testDaffodilParseFromNetworkDelimited1b(): Unit = {
- testHelperDaffodilParseDelimitedFromNetwork("1234", "$",
- "$1234567")
+ testHelperDaffodilParseDelimitedFromNetwork("1234", "$", "$1234567")
}
/**
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionEvaluation.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionEvaluation.scala
index 610f04545..123f969c8 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionEvaluation.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionEvaluation.scala
@@ -17,27 +17,30 @@
package org.apache.daffodil.core.dpath
-import org.apache.daffodil.runtime1.dpath.NodeInfo
+import scala.util.parsing.combinator.Parsers
-import org.junit.Assert._
-import org.junit.Test
-import org.apache.daffodil.lib.util.SchemaUtils
import org.apache.daffodil.core.compiler._
-import scala.util.parsing.combinator.Parsers
-import org.apache.daffodil.lib.xml.XMLUtils
+import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.util.SchemaUtils
import org.apache.daffodil.lib.xml.GlobalQName
-import org.apache.daffodil.lib.Implicits._; object INoWarn2 { ImplicitsSuppressUnusedImportWarning() }
-import org.apache.daffodil.runtime1.processors.parsers.PState
+import org.apache.daffodil.lib.xml.XMLUtils
+import org.apache.daffodil.runtime1.dpath.NodeInfo
+
+import org.junit.Assert._
+import org.junit.Test; object INoWarn2 { ImplicitsSuppressUnusedImportWarning() }
+import org.apache.daffodil.core.infoset.TestInfoset
import org.apache.daffodil.core.util.TestUtils
import org.apache.daffodil.io.InputSourceDataInputStream
+import org.apache.daffodil.runtime1.infoset.InfosetDocument
import org.apache.daffodil.runtime1.infoset.NullInfosetOutputter
-import org.apache.daffodil.core.infoset.TestInfoset
import org.apache.daffodil.runtime1.processors.DataProcessor
-import org.apache.daffodil.runtime1.infoset.InfosetDocument
+import org.apache.daffodil.runtime1.processors.parsers.PState
class TestDFDLExpressionEvaluation extends Parsers {
- def testExpr(testSchema: scala.xml.Elem, infosetAsXML: scala.xml.Elem, expr: String)(body: Any => Unit): Unit = {
+ def testExpr(testSchema: scala.xml.Elem, infosetAsXML: scala.xml.Elem, expr: String)(
+ body: Any => Unit,
+ ): Unit = {
val schemaCompiler = Compiler()
.withTunable("allowExternalPathExpressions", "true")
.withTunable("releaseUnneededInfoset", "false")
@@ -48,11 +51,20 @@ class TestDFDLExpressionEvaluation extends Parsers {
val infosetRootElem = TestInfoset.elem2Infoset(infosetAsXML, dp)
val erd = infosetRootElem.erd
val qn = GlobalQName(Some("daf"), "testExpr", XMLUtils.dafintURI)
- val exprCompiler = new DFDLPathExpressionParser[AnyRef](qn, NodeInfo.AnyType, testSchema.scope, erd.dpathCompileInfo, false, sset)
+ val exprCompiler = new DFDLPathExpressionParser[AnyRef](
+ qn,
+ NodeInfo.AnyType,
+ testSchema.scope,
+ erd.dpathCompileInfo,
+ false,
+ sset,
+ )
val compiledExpr = exprCompiler.compile(expr)
val doc = infosetRootElem.parent.asInstanceOf[InfosetDocument]
- val dis = InputSourceDataInputStream(java.nio.ByteBuffer.allocate(0)) // fake. Zero bits available.
+ val dis = InputSourceDataInputStream(
+ java.nio.ByteBuffer.allocate(0),
+ ) // fake. Zero bits available.
val outputter = new NullInfosetOutputter()
val pstate = PState.createInitialPState(doc, erd, dis, outputter, dp, areDebugging = false)
val result = compiledExpr.evaluate(pstate)
@@ -63,7 +75,8 @@ class TestDFDLExpressionEvaluation extends Parsers {
val schema = SchemaUtils.dfdlTestSchemaUnqualified(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>)
+ <xs:element name="a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>,
+ )
val data = <a xmlns="http://example.com">aaaaa</a>
testExpr(schema, data, "{ /tns:a }") { (res: Any) =>
@@ -81,9 +94,10 @@ class TestDFDLExpressionEvaluation extends Parsers {
<xs:element name="a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val ex = "http://example.com"
- val data = <ex:b xmlns:ex={ ex }><a>aaaaa</a></ex:b>
+ val data = <ex:b xmlns:ex={ex}><a>aaaaa</a></ex:b>
testExpr(schema, data, "{ /tns:b/a }") { (res: Any) =>
assertEquals("aaaaa", res)
}
@@ -99,7 +113,8 @@ class TestDFDLExpressionEvaluation extends Parsers {
<xs:element name="a" maxOccurs="2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val data = <ex:b xmlns:ex="http://example.com"><a>aaaaa</a><a>bbbbb</a></ex:b>
testExpr(schema, data, "{ fn:count(/tns:b/a) }") { (res: Any) =>
assertEquals(2L, res)
@@ -116,7 +131,8 @@ class TestDFDLExpressionEvaluation extends Parsers {
<xs:element name="a" maxOccurs="2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val data = <ex:b xmlns:ex="http://example.com"><a>aaaaa</a><a>bbbbb</a></ex:b>
testExpr(schema, data, "{ /tns:b/a[1] }") { (res: Any) =>
assertEquals("aaaaa", res)
@@ -133,7 +149,8 @@ class TestDFDLExpressionEvaluation extends Parsers {
<xs:element name="a" maxOccurs="2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val data = <ex:b xmlns:ex="http://example.com"><a>aaaaa</a><a>bbbbb</a></ex:b>
testExpr(schema, data, "{ /tns:b/a[2] }") { (res: Any) =>
assertEquals("bbbbb", res)
@@ -151,7 +168,8 @@ class TestDFDLExpressionEvaluation extends Parsers {
<xs:element name="a" type="xs:long" dfdl:inputValueCalc="{ ../i }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
TestUtils.testString(schema, "")
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionTree.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionTree.scala
index 44717e8e8..ffcac8380 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionTree.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDFDLExpressionTree.scala
@@ -17,20 +17,20 @@
package org.apache.daffodil.core.dpath
-import org.apache.daffodil.runtime1.dpath._
+import java.math.{ BigDecimal => JBigDecimal, BigInteger => JBigInt }
+import scala.util.parsing.combinator.Parsers
+import org.apache.daffodil.core.compiler._
+import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.util.SchemaUtils
+import org.apache.daffodil.lib.xml.StepQName
+import org.apache.daffodil.lib.xml._
import org.apache.daffodil.runtime1.dpath.NodeInfo
+import org.apache.daffodil.runtime1.dpath._
+import org.apache.daffodil.runtime1.processors.ElementRuntimeData
import org.junit.Assert._
import org.junit.Test
-import org.apache.daffodil.lib.util.SchemaUtils
-import org.apache.daffodil.core.compiler._
-import scala.util.parsing.combinator.Parsers
-import org.apache.daffodil.lib.xml._
-import org.apache.daffodil.runtime1.processors.ElementRuntimeData
-import org.apache.daffodil.lib.xml.StepQName
-import org.apache.daffodil.lib.Implicits._
-import java.math.{ BigDecimal => JBigDecimal, BigInteger => JBigInt }
class TestDFDLExpressionTree extends Parsers {
val qn = GlobalQName(Some("daf"), "testExpr", XMLUtils.dafintURI)
@@ -38,7 +38,8 @@ class TestDFDLExpressionTree extends Parsers {
val dummySchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="title" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>)
+ <xs:element name="title" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:unsignedInt(5) }"/>,
+ )
def testExpr(testSchema: scala.xml.Elem, expr: String)(body: Expression => Unit): Unit = {
val schemaCompiler = Compiler()
@@ -49,12 +50,21 @@ class TestDFDLExpressionTree extends Parsers {
val decl = declf.asRoot
val erd = decl.elementRuntimeData
- val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.String, testSchema.scope, erd.dpathCompileInfo, false, sset)
+ val exprCompiler = new DFDLPathExpressionParser(
+ qn,
+ NodeInfo.String,
+ testSchema.scope,
+ erd.dpathCompileInfo,
+ false,
+ sset,
+ )
val result = exprCompiler.getExpressionTree(expr)
body(result)
}
- def testExpr2(testSchema: scala.xml.Elem, expr: String)(body: (Expression, ElementRuntimeData) => Unit): Unit = {
+ def testExpr2(testSchema: scala.xml.Elem, expr: String)(
+ body: (Expression, ElementRuntimeData) => Unit,
+ ): Unit = {
val schemaCompiler = Compiler()
val sset = schemaCompiler.compileNode(testSchema).sset
val Seq(schema) = sset.schemas
@@ -62,7 +72,14 @@ class TestDFDLExpressionTree extends Parsers {
val Seq(declf) = schemaDoc.globalElementDecls
val decl = declf.asRoot
val erd = decl
- val exprCompiler = new DFDLPathExpressionParser(qn, NodeInfo.AnyType, testSchema.scope, decl.dpathCompileInfo, false, sset)
+ val exprCompiler = new DFDLPathExpressionParser(
+ qn,
+ NodeInfo.AnyType,
+ testSchema.scope,
+ decl.dpathCompileInfo,
+ false,
+ sset,
+ )
val result = exprCompiler.getExpressionTree(expr)
body(result, erd.elementRuntimeData)
}
@@ -82,16 +99,24 @@ class TestDFDLExpressionTree extends Parsers {
</xs:element>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val aSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:string(xs:unsignedInt(5)) }"/>)
+ <xs:element name="a" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:string(xs:unsignedInt(5)) }"/>,
+ )
@Test def test_a() = {
testExpr2(aSchema, "{ /tns:a }") { (ce, erd) =>
- val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = ce
+ val WholeExpression(
+ _,
+ RootPathExpression(Some(RelativePathExpression(steps, _))),
+ _,
+ _,
+ _,
+ ) = ce
val List(n1: DownStepExpression) = steps
val n1p @ NamedStep("tns:a", None) = n1;
assertNotNull(n1p)
@@ -114,11 +139,18 @@ class TestDFDLExpressionTree extends Parsers {
<xs:element name="a" maxOccurs="2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ xs:string(xs:unsignedInt(5)) }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
@Test def test_a_pred(): Unit = {
testExpr2(bSchema, "{ /tns:b/a[/tns:b/i] }") { (ce, erd) =>
- val w @ WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = ce
+ val w @ WholeExpression(
+ _,
+ RootPathExpression(Some(RelativePathExpression(steps, _))),
+ _,
+ _,
+ _,
+ ) = ce
val List(b, a) = steps
val bp @ NamedStep("tns:b", None) = b; assertNotNull(bp)
val NamedStep("a", Some(PredicateExpression(i))) = a
@@ -149,7 +181,8 @@ class TestDFDLExpressionTree extends Parsers {
val WholeExpression(_, RelativePathExpression(steps, _), _, _, _) = actual
val List(n1, n2, n3) = steps
val u @ Up(None) = n1; assertNotNull(u)
- val u2 @ Up(Some(PredicateExpression(LiteralExpression(two: JBigInt)))) = n2; assertNotNull(u2)
+ val u2 @ Up(Some(PredicateExpression(LiteralExpression(two: JBigInt)))) = n2;
+ assertNotNull(u2)
assertEquals(JBigInt.valueOf(2), two)
val n3p @ NamedStep("bookstore", None) = n3; assertNotNull(n3p)
}
@@ -176,7 +209,13 @@ class TestDFDLExpressionTree extends Parsers {
@Test def test_absolutePath() = {
testExpr2(testSchema, "{ /tns:bookstore/book/title }") { (actual, erd) =>
- val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = actual
+ val WholeExpression(
+ _,
+ RootPathExpression(Some(RelativePathExpression(steps, _))),
+ _,
+ _,
+ _,
+ ) = actual
val List(n1, n2, n3) = steps.asInstanceOf[List[NamedStep]]
val n1p @ NamedStep("tns:bookstore", None) = n1; assertNotNull(n1p)
assertTrue(n1.isFirstStep)
@@ -219,7 +258,13 @@ class TestDFDLExpressionTree extends Parsers {
@Test def test_pathNoSuchElement1(): Unit = {
testExpr2(testSchema, "{ /thereIsNoElementWithThisName }") { (actual, erd) =>
- val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(List(step: NamedStep), _))), _, _, _) = actual
+ val WholeExpression(
+ _,
+ RootPathExpression(Some(RelativePathExpression(List(step: NamedStep), _))),
+ _,
+ _,
+ _,
+ ) = actual
val exc = intercept[Exception] {
step.stepElements
}
@@ -233,7 +278,13 @@ class TestDFDLExpressionTree extends Parsers {
@Test def test_predPath() = {
testExpr(dummySchema, "{ /bookstore[$i]/book/title }") { actual =>
- val WholeExpression(_, RootPathExpression(Some(RelativePathExpression(steps, _))), _, _, _) = actual
+ val WholeExpression(
+ _,
+ RootPathExpression(Some(RelativePathExpression(steps, _))),
+ _,
+ _,
+ _,
+ ) = actual
val List(n1, n2, n3) = steps
val NamedStep("bookstore", pred) = n1
// println(pred)
@@ -246,7 +297,16 @@ class TestDFDLExpressionTree extends Parsers {
@Test def testAddConstants(): Unit = {
testExpr(dummySchema, "{ 1 + 2 }") { actual =>
- val a @ WholeExpression(_, AdditiveExpression("+", List(LiteralExpression(one: JBigInt), LiteralExpression(two: JBigInt))), _, _, _) = actual; assertNotNull(a)
+ val a @ WholeExpression(
+ _,
+ AdditiveExpression(
+ "+",
+ List(LiteralExpression(one: JBigInt), LiteralExpression(two: JBigInt)),
+ ),
+ _,
+ _,
+ _,
+ ) = actual; assertNotNull(a)
assertEquals(JBigInt.valueOf(1), one)
assertEquals(JBigInt.valueOf(2), two)
}
@@ -254,25 +314,37 @@ class TestDFDLExpressionTree extends Parsers {
@Test def testFnTrue(): Unit = {
testExpr(dummySchema, "{ fn:true() }") { actual =>
- val a @ WholeExpression(_, FunctionCallExpression("fn:true", Nil), _, _, _) = actual; assertNotNull(a)
+ val a @ WholeExpression(_, FunctionCallExpression("fn:true", Nil), _, _, _) = actual;
+ assertNotNull(a)
}
}
@Test def test_numbers1() = {
testExpr(dummySchema, "{ 0. }") { actual: Expression =>
val res = JBigDecimal.ZERO
- val a @ WholeExpression(_, LiteralExpression(actualRes: JBigDecimal), _, _, _) = actual; assertNotNull(a)
+ val a @ WholeExpression(_, LiteralExpression(actualRes: JBigDecimal), _, _, _) = actual;
+ assertNotNull(a)
assertEquals(res, actualRes)
}
}
@Test def test_numbers() = {
- testExpr(dummySchema, "{ 5.0E2 }") { case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ; }
- testExpr(dummySchema, "{ 5E2 }") { case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ; }
- testExpr(dummySchema, "{ .2E2 }") { case WholeExpression(_, LiteralExpression(20.0), _, _, _) => /* ok */ ; }
- testExpr(dummySchema, "{ .2E-3 }") { case WholeExpression(_, LiteralExpression(0.0002), _, _, _) => /* ok */ ; }
- testExpr(dummySchema, "{ .2E+3 }") { case WholeExpression(_, LiteralExpression(200.0), _, _, _) => /* ok */ ; }
+ testExpr(dummySchema, "{ 5.0E2 }") {
+ case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ;
+ }
+ testExpr(dummySchema, "{ 5E2 }") {
+ case WholeExpression(_, LiteralExpression(500.0), _, _, _) => /* ok */ ;
+ }
+ testExpr(dummySchema, "{ .2E2 }") {
+ case WholeExpression(_, LiteralExpression(20.0), _, _, _) => /* ok */ ;
+ }
+ testExpr(dummySchema, "{ .2E-3 }") {
+ case WholeExpression(_, LiteralExpression(0.0002), _, _, _) => /* ok */ ;
+ }
+ testExpr(dummySchema, "{ .2E+3 }") {
+ case WholeExpression(_, LiteralExpression(200.0), _, _, _) => /* ok */ ;
+ }
// testExpr(dummySchema, "0.") { actual =>
// val res = new JBigDecimal("0.0")
@@ -282,21 +354,28 @@ class TestDFDLExpressionTree extends Parsers {
val res = new JBigDecimal("0.1")
val a @ WholeExpression(_, LiteralExpression(`res`), _, _, _) = actual; assertNotNull(a)
}
- testExpr(dummySchema, "{ 982304892038409234982304892038409234.0909808908982304892038409234 }") { actual =>
- val res = new JBigDecimal("982304892038409234982304892038409234.0909808908982304892038409234")
+ testExpr(
+ dummySchema,
+ "{ 982304892038409234982304892038409234.0909808908982304892038409234 }",
+ ) { actual =>
+ val res =
+ new JBigDecimal("982304892038409234982304892038409234.0909808908982304892038409234")
val WholeExpression(_, LiteralExpression(r: JBigDecimal), _, _, _) = actual
assertEquals(res, r)
}
testExpr(dummySchema, "{ 0 }") { actual =>
val res = JBigInt.ZERO
- val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual; assertNotNull(a)
+ val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual;
+ assertNotNull(a)
assertEquals(res, actualRes)
}
- testExpr(dummySchema, "{ 9817239872193792873982173948739879128370982398723897921370 }") { actual =>
- val res = new JBigInt("9817239872193792873982173948739879128370982398723897921370")
- val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual; assertNotNull(a)
- assertEquals(res, actualRes)
+ testExpr(dummySchema, "{ 9817239872193792873982173948739879128370982398723897921370 }") {
+ actual =>
+ val res = new JBigInt("9817239872193792873982173948739879128370982398723897921370")
+ val a @ WholeExpression(_, LiteralExpression(actualRes: JBigInt), _, _, _) = actual;
+ assertNotNull(a)
+ assertEquals(res, actualRes)
}
}
@@ -332,41 +411,70 @@ class TestDFDLExpressionTree extends Parsers {
}
testFn("{ fn:true() }") { actual => assertEquals("true", actual.functionQName.local) }
- testFn("{ fn:concat('a', 'b') }") { actual => assertEquals("concat", actual.functionQName.local) }
+ testFn("{ fn:concat('a', 'b') }") { actual =>
+ assertEquals("concat", actual.functionQName.local)
+ }
}
@Test def test_binaryOps() = {
- testExpr(dummySchema, """{
+ testExpr(
+ dummySchema,
+ """{
if (a or b and c gt d)
then if (c gt d)
then e + f * g
else -h
else +i
- }""") { actual =>
+ }""",
+ ) { actual =>
val WholeExpression(_, IfExpression(Seq(pred, thenPart, elsePart)), _, _, _) = actual
val p @ OrExpression(
- List(RelativePathExpression(List(NamedStep("a", None)), _),
+ List(
+ RelativePathExpression(List(NamedStep("a", None)), _),
AndExpression(
- List(RelativePathExpression(List(NamedStep("b", None)), _),
- ComparisonExpression("gt",
- List(RelativePathExpression(List(NamedStep("c", None)), _),
- RelativePathExpression(List(NamedStep("d", None)), _)))
- )))) = pred
+ List(
+ RelativePathExpression(List(NamedStep("b", None)), _),
+ ComparisonExpression(
+ "gt",
+ List(
+ RelativePathExpression(List(NamedStep("c", None)), _),
+ RelativePathExpression(List(NamedStep("d", None)), _),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ) = pred
assertNotNull(p)
val th @ IfExpression(
- List(ComparisonExpression("gt",
- List(RelativePathExpression(List(NamedStep("c", None)), _),
- RelativePathExpression(List(NamedStep("d", None)), _))),
- AdditiveExpression("+",
- List(RelativePathExpression(List(NamedStep("e", None)), _),
- MultiplicativeExpression("*",
- List(RelativePathExpression(List(NamedStep("f", None)), _),
- RelativePathExpression(List(NamedStep("g", None)), _)))
- )),
- UnaryExpression("-", RelativePathExpression(List(NamedStep("h", None)), _)))) = thenPart
+ List(
+ ComparisonExpression(
+ "gt",
+ List(
+ RelativePathExpression(List(NamedStep("c", None)), _),
+ RelativePathExpression(List(NamedStep("d", None)), _),
+ ),
+ ),
+ AdditiveExpression(
+ "+",
+ List(
+ RelativePathExpression(List(NamedStep("e", None)), _),
+ MultiplicativeExpression(
+ "*",
+ List(
+ RelativePathExpression(List(NamedStep("f", None)), _),
+ RelativePathExpression(List(NamedStep("g", None)), _),
+ ),
+ ),
+ ),
+ ),
+ UnaryExpression("-", RelativePathExpression(List(NamedStep("h", None)), _)),
+ ),
+ ) = thenPart
assertNotNull(th)
- val el @ UnaryExpression("+", RelativePathExpression(List(NamedStep("i", None)), _)) = elsePart
+ val el @ UnaryExpression("+", RelativePathExpression(List(NamedStep("i", None)), _)) =
+ elsePart
assertNotNull(el)
}
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDPath.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDPath.scala
index bed9ebcfa..9eb8a3572 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDPath.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dpath/TestDPath.scala
@@ -17,15 +17,16 @@
package org.apache.daffodil.core.dpath
-import org.junit.Test
-import org.apache.daffodil.lib.Implicits._; object INoWarn { ImplicitsSuppressUnusedImportWarning() }
-import org.apache.daffodil.lib.util.SchemaUtils
+import org.apache.daffodil.lib.Implicits._
+
+import org.junit.Test; object INoWarn { ImplicitsSuppressUnusedImportWarning() }
import org.apache.daffodil.core.util.TestUtils
+import org.apache.daffodil.lib.util.SchemaUtils
class TestDPath {
val testSchemaNoRef = SchemaUtils.dfdlTestSchemaUnqualified(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" representation="binary" binaryNumberRep="binary" lengthUnits="bytes"/>,
<xs:element name="a">
<xs:complexType>
@@ -40,14 +41,15 @@ class TestDPath {
</xs:element>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
@Test def test_twoUpwardSteps(): Unit = {
TestUtils.testString(testSchemaNoRef, "")
}
val testSchema = SchemaUtils.dfdlTestSchemaUnqualified(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" representation="binary" binaryNumberRep="binary" lengthUnits="bytes"/>,
<xs:element name="a">
<xs:complexType>
@@ -63,14 +65,15 @@ class TestDPath {
<xs:element name="d" type="xs:int" dfdl:inputValueCalc="{ ../../b }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
@Test def test_twoUpwardStepsAcrossElementReference(): Unit = {
TestUtils.testString(testSchema, "")
}
val testSchema2 = SchemaUtils.dfdlTestSchemaUnqualified(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" representation="binary" binaryNumberRep="binary" lengthUnits="bytes"/>,
<xs:element name="a">
<xs:complexType>
@@ -80,7 +83,8 @@ class TestDPath {
</xs:sequence>
</xs:complexType>
</xs:element>
- <xs:element name="c" type="xs:int" dfdl:inputValueCalc="{ ../b }"/>)
+ <xs:element name="c" type="xs:int" dfdl:inputValueCalc="{ ../b }"/>,
+ )
@Test def test_oneUpwardStepsAcrossElementReference(): Unit = {
TestUtils.testString(testSchema2, "")
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestAppinfoSyntax.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestAppinfoSyntax.scala
index 08ea698db..c8a7a4e1a 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestAppinfoSyntax.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestAppinfoSyntax.scala
@@ -19,12 +19,13 @@ package org.apache.daffodil.core.dsom
import scala.xml.Elem
-import org.apache.daffodil.lib.xml.XMLUtils
-import org.junit.Assert._
-import org.junit.Test
import org.apache.daffodil.core.compiler._
import org.apache.daffodil.core.util.TestUtils
import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.xml.XMLUtils
+
+import org.junit.Assert._
+import org.junit.Test
/**
* Tests that verify that Daffodil works properly with other
@@ -41,16 +42,18 @@ class TestAppinfoSyntax {
@Test def testAppinfoWithNonNativeAttributes(): Unit = {
val expected = "this is a non-native attribute"
val nnURI = "urn:nonNativeAttributeNamespaceURN"
- val sc = <xs:schema xmlns:xs={ xsd } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={ nnURI }>
+ val sc = <xs:schema xmlns:xs={
+ xsd
+ } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={nnURI}>
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:annotation>
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute1={expected}>
<dfdl:format ref="GeneralFormat"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="root" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -75,22 +78,24 @@ class TestAppinfoSyntax {
@Test def testMultipleAppinfos(): Unit = {
val expected = "this is a non-native attribute"
val nnURI = "urn:nonNativeAttributeNamespaceURN"
- val sc = <xs:schema xmlns:xs={ xsd } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={ nnURI }>
+ val sc = <xs:schema xmlns:xs={
+ xsd
+ } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={nnURI}>
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:annotation>
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute1={expected}>
<dfdl:format ref="GeneralFormat"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="root" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:annotation>
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute2={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute2={expected}>
<dfdl:format ref="GeneralFormat"/>
</xs:appinfo>
</xs:annotation>
@@ -120,17 +125,19 @@ class TestAppinfoSyntax {
@Test def testMixedAnnotationElementsInsideDFDLAppinfo(): Unit = {
val expected = "this is a non-native attribute"
val nnURI = "urn:nonNativeAttributeNamespaceURN"
- val sc = <xs:schema xmlns:xs={ xsd } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={ nnURI }>
+ val sc = <xs:schema xmlns:xs={
+ xsd
+ } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={nnURI}>
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:annotation>
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute1={expected}>
<dfdl:format ref="GeneralFormat"/>
<foo:anotherAnnotationElementAdjacentToDFDLAnnotation/>
</xs:appinfo>
</xs:annotation>
<xs:element name="root" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -156,26 +163,28 @@ class TestAppinfoSyntax {
val expected = "this is a non-native attribute"
val nnURI = "urn:nonNativeAttributeNamespaceURN"
val nnURI2 = "urn:anotherNonNativeURI"
- val sc = <xs:schema xmlns:xs={ xsd } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={ nnURI } xmlns:bar={ nnURI2 }>
+ val sc = <xs:schema xmlns:xs={
+ xsd
+ } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={nnURI} xmlns:bar={nnURI2}>
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<xs:annotation>
- <xs:appinfo source={ nnURI } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={nnURI} foo:nonNativeAttribute1={expected}>
<!-- since the source is not DFDL's, this should be completely ignored. -->
<foo:thisIsAnAnnotationElement/>
</xs:appinfo>
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute1={expected}>
<dfdl:format ref="GeneralFormat"/>
</xs:appinfo>
</xs:annotation>
<xs:element name="root" type="xs:int" dfdl:lengthKind="explicit" dfdl:length="1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:annotation>
- <xs:appinfo source={ nnURI2 } bar:nonNativeAttribute2={ expected }>
+ <xs:appinfo source={nnURI2} bar:nonNativeAttribute2={expected}>
<bar:anotherAppinfoAnnotationElement/>
</xs:appinfo>
</xs:annotation>
@@ -199,13 +208,15 @@ class TestAppinfoSyntax {
@Test def testAppinfoWithComments(): Unit = {
val expected = "this is a non-native attribute"
val nnURI = "urn:nonNativeAttributeNamespaceURN"
- val sc = <xs:schema xmlns:xs={ xsd } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={ nnURI }>
+ val sc = <xs:schema xmlns:xs={
+ xsd
+ } xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:foo={nnURI}>
<!-- This is a comment -->
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
<!-- This is a comment -->
<xs:annotation>
<!-- This is a comment -->
- <xs:appinfo source={ dfdl } foo:nonNativeAttribute1={ expected }>
+ <xs:appinfo source={dfdl} foo:nonNativeAttribute1={expected}>
<!-- This is a comment -->
<dfdl:format ref="GeneralFormat"/>
<!-- This is a comment -->
@@ -217,7 +228,7 @@ class TestAppinfoSyntax {
<!-- This is a comment -->
<xs:annotation>
<!-- This is a comment -->
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<!-- This is a comment -->
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
<!-- This is a comment -->
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestBinaryInput_01.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestBinaryInput_01.scala
index df25072ab..c88a0d3c9 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestBinaryInput_01.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestBinaryInput_01.scala
@@ -17,8 +17,9 @@
package org.apache.daffodil.core.dsom
-import java.math.{BigInteger => JBigInt}
+import java.math.{ BigInteger => JBigInt }
import java.nio.ByteBuffer
+
import org.apache.daffodil.io.DataInputStream
import org.apache.daffodil.io.FakeFormatInfo
import org.apache.daffodil.io.FormatInfo
@@ -26,9 +27,10 @@ import org.apache.daffodil.io.InputSourceDataInputStream
import org.apache.daffodil.lib.schema.annotation.props.gen.BitOrder
import org.apache.daffodil.lib.schema.annotation.props.gen.ByteOrder
import org.apache.daffodil.lib.util.Misc
+
import org.junit.After
-import org.junit.Test
import org.junit.Assert.assertEquals
+import org.junit.Test
// Do no harm number 16 of 626 fail in regression, 154 in total of 797
@@ -177,15 +179,23 @@ class TestBinaryInput_01 {
def testBufferBigIntBigEndianExtraction(): Unit = {
val (dis, finfo) = fromString("Thirty-two character long string", BE, msbFirst)
val bigInt = getBigInt(finfo, dis, 0, 256)
- assertEquals(new JBigInt("38178759144797737047702418052138682097409903778432721523410841200294898527847"),
- bigInt)
+ assertEquals(
+ new JBigInt(
+ "38178759144797737047702418052138682097409903778432721523410841200294898527847",
+ ),
+ bigInt,
+ )
}
@Test
def testBufferBigIntLittleEndianExtraction(): Unit = {
val (dis, finfo) = fromString("Thirty-two character long string", LE, msbFirst)
- assertEquals(new JBigInt("46783304350265979503919546124020768339208030665592297039403372142674722777172"),
- getBigInt(finfo, dis, 0, 256))
+ assertEquals(
+ new JBigInt(
+ "46783304350265979503919546124020768339208030665592297039403372142674722777172",
+ ),
+ getBigInt(finfo, dis, 0, 256),
+ )
}
// Aligned but not full string
@@ -225,7 +235,7 @@ class TestBinaryInput_01 {
@Test
def testBufferBitByteLittleEndianExtraction(): Unit = {
val (dis, finfo) = fromString("3>", LE, msbFirst)
- assertEquals(0xCC, getLong(finfo, dis, 2, 8))
+ assertEquals(0xcc, getLong(finfo, dis, 2, 8))
}
// Non-Aligned multi-byte
@@ -276,9 +286,9 @@ class TestBinaryInput_01 {
}
@Test def testOneBit3LSBFirst(): Unit = {
- val (dis, finfo) = fromBytes(JBigInt.valueOf(0xE4567A).toByteArray, LE, lsbFirst)
+ val (dis, finfo) = fromBytes(JBigInt.valueOf(0xe4567a).toByteArray, LE, lsbFirst)
val bit1 = getLong(finfo, dis, 13, 12)
- assertEquals(0x2B7, bit1)
+ assertEquals(0x2b7, bit1)
}
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompiler.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompiler.scala
index 98b5b20f9..9f0945327 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompiler.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompiler.scala
@@ -17,19 +17,18 @@
package org.apache.daffodil.core.dsom
-import org.apache.daffodil.core.util._
-
-import org.junit.Assert._
-import org.junit.Test
-
import scala.xml.Node
import scala.xml.Utility
import scala.xml.XML
-import org.apache.daffodil.lib.Implicits._; object INoWarnDSOM1 { ImplicitsSuppressUnusedImportWarning() }
+import org.apache.daffodil.core.util._
+import org.apache.daffodil.lib.Implicits._
+
+import org.junit.Assert._
+import org.junit.Test; object INoWarnDSOM1 { ImplicitsSuppressUnusedImportWarning() }
+import org.apache.daffodil.core.compiler._
import org.apache.daffodil.lib.api.Diagnostic
import org.apache.daffodil.lib.api.URISchemaSource
-import org.apache.daffodil.core.compiler._
import org.apache.daffodil.lib.schema.annotation.props.AlignmentType
import org.apache.daffodil.lib.schema.annotation.props.Found
import org.apache.daffodil.lib.schema.annotation.props.gen.AlignmentUnits
@@ -71,7 +70,8 @@ class TestDsomCompiler {
<xs:sequence>
<xs:element name="w" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
@@ -94,7 +94,8 @@ class TestDsomCompiler {
<xs:element name="w" type="xsd:int" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler().withCheckAllTopLevel(true)
val sset = compiler.compileNode(sch).sset
@@ -113,7 +114,8 @@ class TestDsomCompiler {
val sch: Node = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="list" type="typeDoesNotExist"/>)
+ <xs:element name="list" type="typeDoesNotExist"/>,
+ )
val pf = Compiler().compileNode(sch)
assertTrue(pf.isError)
val msg = pf.getDiagnostics.toString
@@ -123,7 +125,8 @@ class TestDsomCompiler {
// FIXME - convert this test to TDML or drop if there is coverage other places.
@Test def testTypeReferentialError2(): Unit = {
- val sch: Node = <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/">
+ val sch: Node =
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/">
<element name="foo" type="bar"/><!-- Illegal: no prefix on name of the type. -->
<complexType name="bar">
<sequence/>
@@ -146,7 +149,8 @@ class TestDsomCompiler {
<xs:element name="w" type="xsd:int" dfdl:byteOrder="invalidValue" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler().withCheckAllTopLevel(true)
val sset = Compiler().compileNode(s).sset
sset.isError // forces compilation
@@ -161,10 +165,9 @@ class TestDsomCompiler {
val sc = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
-
<xs:element name="list" type="tns:example1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -173,7 +176,8 @@ class TestDsomCompiler {
<xs:sequence dfdl:separator="">
<xs:element name="w" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val sset = Compiler().compileNode(sc).sset
@@ -191,10 +195,9 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
-
<xs:element name="list" type="tns:example1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element encoding="US-ASCII" alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -203,7 +206,8 @@ class TestDsomCompiler {
<xs:sequence dfdl:separatorSuppressionPolicy="never" dfdl:separator="">
<xs:element name="w" type="xs:int" maxOccurs="1" dfdl:lengthKind="explicit" dfdl:length="1" dfdl:occursCountKind="fixed"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val w = Utility.trim(testSchema)
@@ -228,7 +232,9 @@ class TestDsomCompiler {
// removed. So for this particular test, use the DaffodilXMLLoader (which
// does remove comments and what is normally used by Daffodil) to load the
// XML to a Scala XML Node.
- val source = URISchemaSource(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml"))
+ val source = URISchemaSource(
+ Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml"),
+ )
val loader = new DaffodilXMLLoader(null)
val testSchema = loader.load(source, None)
@@ -247,13 +253,17 @@ class TestDsomCompiler {
val e3 = e3d.asRoot
assertEquals(
ByteOrder.BigEndian.toString.toLowerCase(),
- e1d.formatAnnotation.asInstanceOf[DFDLElement].getPropertyForUnitTest("byteOrder").toLowerCase())
+ e1d.formatAnnotation
+ .asInstanceOf[DFDLElement]
+ .getPropertyForUnitTest("byteOrder")
+ .toLowerCase(),
+ )
val Seq(_, a2) = e3d.annotationObjs // third one has two annotations
assertTrue(a2.isInstanceOf[DFDLAssert]) // second annotation is newVariableInstance
assertEquals(OccursCountKind.Implicit.toString, e3.getProperty("occursCountKind"))
// Explore local complex type def
- val seq = e1.complexType.modelGroup.asInstanceOf[LocalSequence] //... which is a sequence
- seq.formatAnnotation.asInstanceOf[DFDLSequence] //...annotated with...
+ val seq = e1.complexType.modelGroup.asInstanceOf[LocalSequence] // ... which is a sequence
+ seq.formatAnnotation.asInstanceOf[DFDLSequence] // ...annotated with...
assertEquals(YesNo.No, seq.initiatedContent) // initiatedContent="no"
val Seq(e1a: DFDLElement) = e1d.annotationObjs
@@ -262,25 +272,40 @@ class TestDsomCompiler {
// Explore global simple type defs
val Seq(st1, _, _, _) = sd.globalSimpleTypeDefs // there are two.
val Seq(b1, b2, _, b4) = st1.annotationObjs // first one has 4 annotations
- assertEquals(AlignmentUnits.Bytes.toString.toLowerCase, b1.asInstanceOf[DFDLSimpleType].getPropertyForUnitTest("alignmentUnits")) // first has alignmentUnits
- assertEquals("tns:myVar1", b2.asInstanceOf[DFDLSetVariable].ref) // second is setVariable with a ref
- assertEquals("yadda yadda yadda", b4.asInstanceOf[DFDLAssert].messageAttrib.get) // fourth is an assert with yadda message
+ assertEquals(
+ AlignmentUnits.Bytes.toString.toLowerCase,
+ b1.asInstanceOf[DFDLSimpleType].getPropertyForUnitTest("alignmentUnits"),
+ ) // first has alignmentUnits
+ assertEquals(
+ "tns:myVar1",
+ b2.asInstanceOf[DFDLSetVariable].ref,
+ ) // second is setVariable with a ref
+ assertEquals(
+ "yadda yadda yadda",
+ b4.asInstanceOf[DFDLAssert].messageAttrib.get,
+ ) // fourth is an assert with yadda message
// Explore define formats
val Seq(df1, _) = sd.defineFormats // there are two
val def1 = df1.asInstanceOf[DFDLDefineFormat]
assertEquals("def1", def1.name) // first is named "def1"
- assertEquals(Representation.Text.toString.toLowerCase, def1.formatAnnotation.getPropertyForUnitTest("representation")) // has representation="text"
+ assertEquals(
+ Representation.Text.toString.toLowerCase,
+ def1.formatAnnotation.getPropertyForUnitTest("representation"),
+ ) // has representation="text"
// Explore define variables
val Seq(dv1, _) = sd.defineVariables // there are two
assertNotNull(dv1)
- //assertEquals("2003年08月27日", dv2.asInstanceOf[DFDLDefineVariable].defaultValue) // second has kanji chars in default value
+ // assertEquals("2003年08月27日", dv2.asInstanceOf[DFDLDefineVariable].defaultValue) // second has kanji chars in default value
// Explore define escape schemes
val Seq(desc1) = sd.defineEscapeSchemes // only one of these
val es = desc1.forComponent(e1a).escapeScheme.escapeCharacterRaw.asInstanceOf[Found].value
- assertEquals("%%", es) // has escapeCharacter="%%" (note: string literals not digested yet, so %% is %%, not %.
+ assertEquals(
+ "%%",
+ es,
+ ) // has escapeCharacter="%%" (note: string literals not digested yet, so %% is %%, not %.
// Explore global group defs
val Seq(_, root, _*) = sd.globalElementDecls
@@ -292,13 +317,15 @@ class TestDsomCompiler {
assertEquals("gr", ggd1.namedQName.local)
assertEquals("hiddenGroup", ggd2.namedQName.local)
- //Explore LocalSimpleTypeDef
- val Seq(c1: LocalElementDecl, _: LocalElementDecl, c3: LocalElementDecl, rest @ _*) = cgr.groupMembers
- val ist = c3.asInstanceOf[LocalElementDecl].immediateType.get.asInstanceOf[LocalSimpleTypeDef]
+ // Explore LocalSimpleTypeDef
+ val Seq(c1: LocalElementDecl, _: LocalElementDecl, c3: LocalElementDecl, rest @ _*) =
+ cgr.groupMembers
+ val ist =
+ c3.asInstanceOf[LocalElementDecl].immediateType.get.asInstanceOf[LocalSimpleTypeDef]
val istBase = ist.optRestriction.get.baseQName.toQNameString
assertEquals("tns:aType", istBase)
- //Explore LocalElementDecl
+ // Explore LocalElementDecl
assertEquals(1, c1.maxOccurs)
val Seq(c1a) = c1.annotationObjs
assertEquals("{ $myVar1 eq (+47 mod 4) }", c1a.asInstanceOf[DFDLDiscriminator].testBody.get)
@@ -312,7 +339,8 @@ class TestDsomCompiler {
}
@Test def test4(): Unit = {
- val testSchema = XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
+ val testSchema =
+ XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -324,7 +352,8 @@ class TestDsomCompiler {
val Seq(_: ElementRef, cgr: ChoiceGroupRef) = seq1.groupMembers
val cgd = cgr.groupDef
- val Seq(_, cd2: LocalElementDecl, rest @ _*) = cgd.groupMembersNotShared // Children nodes of Choice-node, there are 3
+ val Seq(_, cd2: LocalElementDecl, rest @ _*) =
+ cgd.groupMembersNotShared // Children nodes of Choice-node, there are 3
// val Seq(a1: DFDLChoice) = ch1.annotationObjs // Obtain the annotation object that is a child
// of the group node.
@@ -341,8 +370,12 @@ class TestDsomCompiler {
@Test def test_named_format_chaining(): Unit = {
val testSchema =
XML.load(
- Misc.getRequiredResource(
- "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml").toURL)
+ Misc
+ .getRequiredResource(
+ "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml",
+ )
+ .toURL,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -359,14 +392,20 @@ class TestDsomCompiler {
@Test def test_simple_types_access_works(): Unit = {
val testSchema =
XML.load(
- Misc.getRequiredResource(
- "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml").toURL)
+ Misc
+ .getRequiredResource(
+ "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml",
+ )
+ .toURL,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd) = sch.schemaDocuments
- val Seq(_, x, _, _, _, _) = sd.globalElementDecls.map { _.asRoot } // Obtain global element nodes
+ val Seq(_, x, _, _, _, _) = sd.globalElementDecls.map {
+ _.asRoot
+ } // Obtain global element nodes
assertEquals(AlignmentUnits.Bytes, x.alignmentUnits)
}
@@ -374,14 +413,20 @@ class TestDsomCompiler {
@Test def test_simple_types_property_combining(): Unit = {
val testSchema =
XML.load(
- Misc.getRequiredResource(
- "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml").toURL)
+ Misc
+ .getRequiredResource(
+ "/test/example-of-named-format-chaining-and-element-simpleType-property-combining.dfdl.xml",
+ )
+ .toURL,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd) = sch.schemaDocuments
- val Seq(_, ge2, ge3, ge4, ge5, ge6) = sd.globalElementDecls.map { _.asRoot } // Obtain global element nodes
+ val Seq(_, ge2, ge3, ge4, ge5, ge6) = sd.globalElementDecls.map {
+ _.asRoot
+ } // Obtain global element nodes
assertEquals(AlignmentUnits.Bytes, ge2.alignmentUnits)
@@ -404,7 +449,8 @@ class TestDsomCompiler {
}
@Test def test_simpleType_base_combining(): Unit = {
- val testSchema = XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
+ val testSchema =
+ XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -430,14 +476,18 @@ class TestDsomCompiler {
assertEquals("ex", baseQName.prefix.get)
assertEquals("aaType", baseQName.local)
- assertTrue(gs1.formatAnnotation.verifyPropValue("alignmentUnits", "bytes")) // SimpleType - Local
+ assertTrue(
+ gs1.formatAnnotation.verifyPropValue("alignmentUnits", "bytes"),
+ ) // SimpleType - Local
assertTrue(e1.verifyPropValue("byteOrder", "bigEndian")) // SimpleType - Base
assertTrue(e1.verifyPropValue("occursCountKind", "implicit")) // Default Format
assertTrue(e1.verifyPropValue("representation", "text")) // Define Format - def1
assertTrue(e1.verifyPropValue("encoding", "UTF-8")) // Define Format - def1
assertTrue(e1.verifyPropValue("textStandardBase", "10")) // Define Format - def2
- assertTrue(e1.verifyPropValue("escapeSchemeRef", "tns:quotingScheme")) // Define Format - def2
+ assertTrue(
+ e1.verifyPropValue("escapeSchemeRef", "tns:quotingScheme"),
+ ) // Define Format - def2
val gs3 = gs3f // Global SimpleType - aTypeError - overlapping base props
@@ -451,7 +501,8 @@ class TestDsomCompiler {
}
@Test def test_group_references(): Unit = {
- val testSchema = XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
+ val testSchema =
+ XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -504,7 +555,8 @@ class TestDsomCompiler {
}
@Test def test_ibm_7132(): Unit = {
- val ibm7132Schema = XML.load(Misc.getRequiredResource("/test/TestRefChainingIBM7132.dfdl.xml").toURL)
+ val ibm7132Schema =
+ XML.load(Misc.getRequiredResource("/test/TestRefChainingIBM7132.dfdl.xml").toURL)
// val ibm7132Schema = "test/TestRefChainingIBM7132.dfdl.xml"
val sset = SchemaSet(ibm7132Schema)
// val Seq(sch) = sset.schemas
@@ -536,7 +588,8 @@ class TestDsomCompiler {
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:defineFormat name="ref1"> <dfdl:format initiator=":"/> </dfdl:defineFormat>,
<xs:element name="e1" dfdl:lengthKind="implicit" dfdl:ref="tns:ref1" type="xs:string">
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd, _) = sch.schemaDocuments
@@ -554,7 +607,8 @@ class TestDsomCompiler {
<dfdl:format initiator=":" alignmentUnits="bits"/>
</dfdl:defineFormat>,
<xs:element name="e1" dfdl:lengthKind="implicit" dfdl:ref="tns:ref1" type="xs:string">
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd, _) = sch.schemaDocuments
@@ -596,7 +650,8 @@ class TestDsomCompiler {
<xs:element name="block" type="xsd:string" maxOccurs="unbounded" dfdl:representation="text" dfdl:separator="," dfdl:terminator="%NL;" dfdl:escapeSchemeRef="cStyleComment"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd, _) = sch.schemaDocuments
@@ -623,7 +678,8 @@ class TestDsomCompiler {
}
@Test def test_element_references(): Unit = {
- val testSchema = XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
+ val testSchema =
+ XML.load(Misc.getRequiredResource("/test/example-of-most-dfdl-constructs.dfdl.xml").toURL)
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -641,8 +697,8 @@ class TestDsomCompiler {
assertEquals(2, e1r.maxOccurs)
assertEquals(1, e1r.minOccurs)
assertEquals(AlignmentUnits.Bytes, e1r.alignmentUnits)
- //assertEquals(true, e1.nillable) // TODO: e1.nillable doesn't exist?
- //assertEquals("%ES; %% %#0; %NUL;%ACK; foo%#rF2;%#rF7;bar %WSP*; %#2024;%#xAABB; &ߧ쳝 -1", e1.nilValue) // TODO: Do not equal each other!
+ // assertEquals(true, e1.nillable) // TODO: e1.nillable doesn't exist?
+ // assertEquals("%ES; %% %#0; %NUL;%ACK; foo%#rF2;%#rF7;bar %WSP*; %#2024;%#xAABB; &ߧ쳝 -1", e1.nilValue) // TODO: Do not equal each other!
assertEquals(NilKind.LiteralValue, e1r.nilKind)
}
@@ -659,7 +715,8 @@ class TestDsomCompiler {
<xs:element name="s" type="xs:int"/>
</xs:sequence>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
val Seq(sd, _) = sch.schemaDocuments
@@ -690,13 +747,14 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:string" dfdl:initiator="*" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>)
+ <xs:element name="data" type="xs:string" dfdl:initiator="*" dfdl:lengthKind="explicit" dfdl:length="{ 4 }"/>,
+ )
// val actual = TestUtils.testString(testSchema, "*word")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<data"))
// assertTrue(actualString.endsWith(">word</data>"))
- val infoset = <data xmlns={ example }>word</data>
+ val infoset = <data xmlns={example}>word</data>
TestUtils.testUnparsing(testSchema, infoset, "*word")
}
@@ -704,13 +762,14 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:string" dfdl:terminator="!" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>)
+ <xs:element name="data" type="xs:string" dfdl:terminator="!" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>,
+ )
// val actual = TestUtils.testString(testSchema, "37!")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<data"))
// assertTrue(actualString.endsWith(">37</data>"))
- val infoset = <data xmlns={ example }>37</data>
+ val infoset = <data xmlns={example}>37</data>
TestUtils.testUnparsing(testSchema, infoset, "37!")
}
@@ -718,13 +777,14 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:string" dfdl:initiator="*" dfdl:terminator="! $" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>)
+ <xs:element name="data" type="xs:string" dfdl:initiator="*" dfdl:terminator="! $" dfdl:lengthKind="explicit" dfdl:length="{ 2 }"/>,
+ )
// val actual = TestUtils.testString(testSchema, "*37$")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<data"))
// assertTrue(actualString.endsWith(">37</data>"))
- val infoset = <data xmlns={ example }>37</data>
+ val infoset = <data xmlns={example}>37</data>
TestUtils.testUnparsing(testSchema, infoset, "*37!")
}
@@ -761,10 +821,9 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
-
<xs:element name="list" type="tns:example1">
<xs:annotation>
- <xs:appinfo source={ dfdl }>
+ <xs:appinfo source={dfdl}>
<dfdl:element alignmentUnits="bytes"/>
</xs:appinfo>
</xs:annotation>
@@ -775,13 +834,16 @@ class TestDsomCompiler {
<xs:element name="moredata" type="xs:string" dfdl:length="3" dfdl:lengthKind="explicit" dfdl:initiator="%%"/>
<xs:element name="anddata" type="xs:int" dfdl:length="2" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
// val actual = TestUtils.testString(testSchema, "50.93^%XYZ^42")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<list"))
// assertTrue(actualString.endsWith("><somedata>50.93</somedata><moredata>XYZ</moredata><anddata>42</anddata></list>"))
- val infoset = <list xmlns={ example }><somedata>50.93</somedata><moredata>XYZ</moredata><anddata>42</anddata></list>
+ val infoset = <list xmlns={
+ example
+ }><somedata>50.93</somedata><moredata>XYZ</moredata><anddata>42</anddata></list>
TestUtils.testUnparsing(testSchema, infoset, "50.93^%XYZ^42")
}
@@ -989,13 +1051,14 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:int" dfdl:representation="binary"/>)
+ <xs:element name="data" type="xs:int" dfdl:representation="binary"/>,
+ )
// val actual = TestUtils.testBinary(testSchema, "0000000F")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<data"))
// assertTrue(actualString.endsWith(">15</data>"))
- val infoset = <data xmlns={ example }>15</data>
+ val infoset = <data xmlns={example}>15</data>
val bytes = List[Byte](0, 0, 0, 15).toArray
TestUtils.testUnparsingBinary(testSchema, infoset, bytes)
}
@@ -1004,13 +1067,14 @@ class TestDsomCompiler {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:int" dfdl:representation="binary" dfdl:byteOrder='littleEndian'/>)
+ <xs:element name="data" type="xs:int" dfdl:representation="binary" dfdl:byteOrder='littleEndian'/>,
+ )
// val actual = TestUtils.testBinary(testSchema, "0F000000")
// val actualString = actual.result.toString
// assertTrue(actualString.startsWith("<data"))
// assertTrue(actualString.endsWith(">15</data>"))
- val infoset = <data xmlns={ example }>15</data>
+ val infoset = <data xmlns={example}>15</data>
val bytes = List[Byte](15, 0, 0, 0).toArray
TestUtils.testUnparsingBinary(testSchema, infoset, bytes)
}
@@ -1051,7 +1115,8 @@ class TestDsomCompiler {
<xs:pattern value="2"/>
<xs:pattern value="3"/>
</xs:restriction>
- </xs:simpleType>)
+ </xs:simpleType>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
@@ -1090,7 +1155,8 @@ class TestDsomCompiler {
<xs:pattern value="8"/>
<xs:pattern value="9"/>
</xs:restriction>
- </xs:simpleType>)
+ </xs:simpleType>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompilerUnparse1.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompilerUnparse1.scala
index 92482832c..7565b62ac 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompilerUnparse1.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestDsomCompilerUnparse1.scala
@@ -18,11 +18,11 @@
package org.apache.daffodil.core.dsom
import org.apache.daffodil.core.util._
+import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.util._
+import org.apache.daffodil.lib.xml.XMLUtils
import org.junit.Test
-import org.apache.daffodil.lib.xml.XMLUtils
-import org.apache.daffodil.lib.util._
-import org.apache.daffodil.lib.Implicits._
class TestDsomCompilerUnparse1 {
@@ -42,8 +42,10 @@ class TestDsomCompilerUnparse1 {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1"/>
</xs:sequence>
</xs:complexType>
- </xs:element>, elementFormDefault = "unqualified")
- val infoset = <ex:e1 xmlns:ex={ example }><s1>1</s1><s2>2</s2></ex:e1>
+ </xs:element>,
+ elementFormDefault = "unqualified",
+ )
+ val infoset = <ex:e1 xmlns:ex={example}><s1>1</s1><s2>2</s2></ex:e1>
val areTracing = false
TestUtils.testUnparsing(sch, infoset, "12", areTracing)
}
@@ -62,8 +64,10 @@ class TestDsomCompilerUnparse1 {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="1"/>
</xs:sequence>
</xs:complexType>
- </xs:element>, elementFormDefault = "unqualified")
- val infoset = <ex:e1 xmlns:ex={ example }><s1>1</s1><s2>2</s2></ex:e1>
+ </xs:element>,
+ elementFormDefault = "unqualified",
+ )
+ val infoset = <ex:e1 xmlns:ex={example}><s1>1</s1><s2>2</s2></ex:e1>
TestUtils.testUnparsing(sch, infoset, "[1,2]")
}
@@ -81,8 +85,10 @@ class TestDsomCompilerUnparse1 {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="delimited"/>
</xs:sequence>
</xs:complexType>
- </xs:element>, elementFormDefault = "unqualified")
- val infoset = <ex:e1 xmlns:ex={ example }><s1>1</s1><s2>2</s2></ex:e1>
+ </xs:element>,
+ elementFormDefault = "unqualified",
+ )
+ val infoset = <ex:e1 xmlns:ex={example}><s1>1</s1><s2>2</s2></ex:e1>
TestUtils.testUnparsing(sch, infoset, "[1,2]")
}
@@ -107,8 +113,10 @@ class TestDsomCompilerUnparse1 {
<xs:maxLength value="3"/>
<xs:minLength value="3"/>
</xs:restriction>
- </xs:simpleType>, elementFormDefault = "unqualified")
- val infoset = <ex:e1 xmlns:ex={ example }><s1>1</s1><s2>2</s2><s3>3</s3></ex:e1>
+ </xs:simpleType>,
+ elementFormDefault = "unqualified",
+ )
+ val infoset = <ex:e1 xmlns:ex={example}><s1>1</s1><s2>2</s2><s3>3</s3></ex:e1>
TestUtils.testUnparsing(sch, infoset, "!#1__,__2,_3_#!")
}
@@ -132,8 +140,10 @@ class TestDsomCompilerUnparse1 {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="delimited" dfdl:escapeSchemeRef="cStyleComment"/>
</xs:sequence>
</xs:complexType>
- </xs:element>, elementFormDefault = "unqualified")
- val infoset = <ex:e1 xmlns:ex={ example }><s1>one, two</s1><s2>, three and four*/</s2></ex:e1>
+ </xs:element>,
+ elementFormDefault = "unqualified",
+ )
+ val infoset = <ex:e1 xmlns:ex={example}><s1>one, two</s1><s2>, three and four*/</s2></ex:e1>
val areTracing = false
TestUtils.testUnparsing(sch, infoset, "one#, two,/*, three and four#*/*/", areTracing)
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestExternalVariables.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestExternalVariables.scala
index 4308ebea2..0ea16fde9 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestExternalVariables.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestExternalVariables.scala
@@ -18,23 +18,23 @@
package org.apache.daffodil.core.dsom
import java.nio.channels.Channels
-
import scala.xml.Node
+import org.apache.daffodil.core.compiler.Compiler
+import org.apache.daffodil.io.InputSourceDataInputStream
import org.apache.daffodil.lib.Implicits._
import org.apache.daffodil.lib.Implicits.ns2String
import org.apache.daffodil.lib.api.UnitTestSchemaSource
-import org.apache.daffodil.core.compiler.Compiler
-import org.apache.daffodil.runtime1.externalvars.ExternalVariablesLoader
-import org.apache.daffodil.runtime1.infoset.ScalaXMLInfosetOutputter
-import org.apache.daffodil.io.InputSourceDataInputStream
-import org.apache.daffodil.runtime1.processors.ExternalVariableException
-import org.apache.daffodil.runtime1.processors.VariableMap
import org.apache.daffodil.lib.util.Misc
import org.apache.daffodil.lib.util.SchemaUtils
import org.apache.daffodil.lib.xml.NS
import org.apache.daffodil.lib.xml.QName
import org.apache.daffodil.lib.xml.XMLUtils
+import org.apache.daffodil.runtime1.externalvars.ExternalVariablesLoader
+import org.apache.daffodil.runtime1.infoset.ScalaXMLInfosetOutputter
+import org.apache.daffodil.runtime1.processors.ExternalVariableException
+import org.apache.daffodil.runtime1.processors.VariableMap
+
import org.junit.Assert._
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@@ -67,7 +67,8 @@ class TestExternalVariables {
<xs:choice>
<xs:sequence/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
lazy val xsd_sset = SchemaSet(sch, "http://example.com", "fake")
lazy val xsd_schema = xsd_sset.getSchema(NS("http://example.com")).get
lazy val fakeSD = xsd_schema.schemaDocuments(0)
@@ -90,16 +91,21 @@ class TestExternalVariables {
<xs:choice>
<xs:sequence/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
sch
}
- def generateTestSchemaWithTarget(topLevelAnnotations: Seq[Node], theTargetNS: String, importSchemaLocation: String,
- hasDefaultNamespace : Boolean = true) = {
+ def generateTestSchemaWithTarget(
+ topLevelAnnotations: Seq[Node],
+ theTargetNS: String,
+ importSchemaLocation: String,
+ hasDefaultNamespace: Boolean = true,
+ ) = {
val sch = SchemaUtils.dfdlTestSchemaWithTarget(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
topLevelAnnotations,
- <xs:import schemaLocation={ importSchemaLocation } namespace=""/>
+ <xs:import schemaLocation={importSchemaLocation} namespace=""/>
<xs:element name="fake" type="xs:string" dfdl:lengthKind="delimited"/>
<xs:element name="fake2" type="tns:fakeCT"/>
<xs:complexType name="fakeCT">
@@ -114,7 +120,8 @@ class TestExternalVariables {
</xs:choice>
</xs:group>,
theTargetNS,
- hasDefaultNamespace = hasDefaultNamespace)
+ hasDefaultNamespace = hasDefaultNamespace,
+ )
sch
}
@@ -135,7 +142,8 @@ class TestExternalVariables {
<xs:sequence/>
</xs:choice>
</xs:group>,
- "")
+ "",
+ )
sch
}
@@ -145,15 +153,19 @@ class TestExternalVariables {
topLevelAnnotations,
<xs:element name="fake" type="xs:string" dfdl:lengthKind="delimited"
dfdl:inputValueCalc="{ $ex:var1 }" />,
- theTargetNS)
+ theTargetNS,
+ )
sch
}
def checkResult(vmap: VariableMap, keyToFind: String, expectedValue: String) = {
import scala.util.{ Success, Failure }
- val tri = QName.refQNameFromExtendedSyntax(keyToFind).map { _.toGlobalQName }.map { qn => vmap.find(qn) }
+ val tri = QName.refQNameFromExtendedSyntax(keyToFind).map { _.toGlobalQName }.map { qn =>
+ vmap.find(qn)
+ }
tri match {
- case Failure(th) => fail("The syntax '" + keyToFind + "' did not parse. Got " + Misc.getSomeMessage(th).get)
+ case Failure(th) =>
+ fail("The syntax '" + keyToFind + "' did not parse. Got " + Misc.getSomeMessage(th).get)
case Success(None) => fail("Did not find " + keyToFind + " in the VariableMap.")
case Success(Some(variab)) => {
// Found var1 but is the value correct?
@@ -177,7 +189,8 @@ class TestExternalVariables {
<dfdl:defineVariable name="var2" type="xs:string" external="true" defaultValue="default2"/>
}
val sch_no_ns = generateTestSchemaNoTarget(tla_no_ns)
- val source_no_ns = UnitTestSchemaSource(sch_no_ns, "test_figures_out_namespace_success_no_ns")
+ val source_no_ns =
+ UnitTestSchemaSource(sch_no_ns, "test_figures_out_namespace_success_no_ns")
val tla = {
<dfdl:format ref="tns:GeneralFormat"/>
@@ -186,7 +199,11 @@ class TestExternalVariables {
}
source_no_ns.uriForLoading.toString
- val sch = generateTestSchemaWithTarget(tla, XMLUtils.EXAMPLE_NAMESPACE, source_no_ns.uriForLoading.toString)
+ val sch = generateTestSchemaWithTarget(
+ tla,
+ XMLUtils.EXAMPLE_NAMESPACE,
+ source_no_ns.uriForLoading.toString,
+ )
val source = UnitTestSchemaSource(sch, "test_figures_out_namespace_success")
source.uriForLoading.toString
@@ -194,7 +211,8 @@ class TestExternalVariables {
val vars = Map(
("{http://example.com}var1", "value1"), // Namespace defined
("{}var2", "value2"), // NoNamespace
- ("var3", "value3")) // Figure out the namespace
+ ("var3", "value3"),
+ ) // Figure out the namespace
val variables = ExternalVariablesLoader.mapToBindings(vars)
@@ -236,12 +254,17 @@ class TestExternalVariables {
<dfdl:defineVariable name="var1" type="xs:string" external="true" defaultValue="default1"/>
<dfdl:defineVariable name="var2" type="xs:string" external="true" defaultValue="default2.1"/>
}
- val sch = generateTestSchemaWithTarget(tla, XMLUtils.EXAMPLE_NAMESPACE, source_no_ns.uriForLoading.toString)
+ val sch = generateTestSchemaWithTarget(
+ tla,
+ XMLUtils.EXAMPLE_NAMESPACE,
+ source_no_ns.uriForLoading.toString,
+ )
val source = UnitTestSchemaSource(sch, "test_no_namespace_success")
val vars = Map(
("{http://example.com}var1", "value1"), // Namespace defined
- ("{}var2", "value2")) // NoNamespace
+ ("{}var2", "value2"),
+ ) // NoNamespace
val variables = ExternalVariablesLoader.mapToBindings(vars)
@@ -275,23 +298,27 @@ class TestExternalVariables {
<dfdl:defineVariable name="var3" type="xs:string" external="true" defaultValue="default3.2"/>
}
val sch_no_ns = generateTestSchemaNoTarget(tla_no_ns)
- val source_no_ns = UnitTestSchemaSource(sch_no_ns, "test_figures_out_namespace_failure_no_ns")
+ val source_no_ns =
+ UnitTestSchemaSource(sch_no_ns, "test_figures_out_namespace_failure_no_ns")
val tla = {
<dfdl:format ref="tns:GeneralFormat"/>
<dfdl:defineVariable name="var1" type="xs:string" external="true" defaultValue="default1"/>
<dfdl:defineVariable name="var3" type="xs:string" external="true" defaultValue="default3.1"/>
}
- val sch = generateTestSchemaWithTarget(tla, XMLUtils.EXAMPLE_NAMESPACE, source_no_ns.uriForLoading.toString,
- hasDefaultNamespace = false)
+ val sch = generateTestSchemaWithTarget(
+ tla,
+ XMLUtils.EXAMPLE_NAMESPACE,
+ source_no_ns.uriForLoading.toString,
+ hasDefaultNamespace = false,
+ )
val source = UnitTestSchemaSource(sch, "test_figures_out_namespace_failure")
val vars = Map(
("{http://example.com}var1", "value1"), // Namespace defined
("{}var2", "value2"), // NoNamespace
- ("var3", "value3")) // Figure out the namespace
-
-
+ ("var3", "value3"),
+ ) // Figure out the namespace
val c = Compiler(validateDFDLSchemas = false)
val pf = c.compileSource(source)
@@ -333,7 +360,9 @@ class TestExternalVariables {
val dp2 = pf.onPath("/").withExternalVariables(variables)
val outputter = new ScalaXMLInfosetOutputter()
- val input = InputSourceDataInputStream(Channels.newInputStream(Misc.stringToReadableByteChannel("")))
+ val input = InputSourceDataInputStream(
+ Channels.newInputStream(Misc.stringToReadableByteChannel("")),
+ )
val res1 = dp1.parse(input, outputter)
assertTrue(outputter.getResult.toString.contains("default1"))
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInputValueCalc.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInputValueCalc.scala
index 8450326e6..f06205181 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInputValueCalc.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInputValueCalc.scala
@@ -17,11 +17,11 @@
package org.apache.daffodil.core.dsom
-import org.apache.daffodil.core.util._
+import scala.xml.Node
+import org.apache.daffodil.core.util._
import org.apache.daffodil.lib.util._
-import org.junit.Test
-import scala.xml.Node
+
import org.junit.Test
class TestInputValueCalc {
@@ -31,7 +31,8 @@ class TestInputValueCalc {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="data" type="xs:string" dfdl:inputValueCalc="{ xs:string(42) }" />)
+ <xs:element name="data" type="xs:string" dfdl:inputValueCalc="{ xs:string(42) }" />,
+ )
val (_, actual) = TestUtils.testString(testSchema, "")
val expected: Node = <data>42</data>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -49,7 +50,8 @@ class TestInputValueCalc {
<xs:element name="e2" type="xs:string" dfdl:inputValueCalc="{ ../tns:e1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(testSchema, "A")
val expected: Node = <data><e1>A</e1><e2>A</e2></data>
@@ -68,7 +70,8 @@ class TestInputValueCalc {
<xs:element name="e2" type="xs:int" dfdl:inputValueCalc="{ ../tns:e1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val (_, actual) = TestUtils.testString(testSchema, "8")
val expected: Node = <data><e1>8</e1><e2>8</e2></data>
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInteriorAlignmentElimination.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInteriorAlignmentElimination.scala
index 32201f427..ee99a1924 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInteriorAlignmentElimination.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestInteriorAlignmentElimination.scala
@@ -18,10 +18,9 @@
package org.apache.daffodil.core.dsom
import org.apache.daffodil.core.util._
-
-import org.junit.Test;
-import org.apache.daffodil.lib.xml.XMLUtils
import org.apache.daffodil.lib.util._
+import org.apache.daffodil.lib.xml.XMLUtils
+
import org.junit.Test
class TestInteriorAlignmentElimination {
@@ -93,11 +92,13 @@ class TestInteriorAlignmentElimination {
</xs:sequence>
</xs:complexType>
</xs:element>,
- elementFormDefault = "unqualified")
+ elementFormDefault = "unqualified",
+ )
//
// in the below hex string, it is the 6666 that is the alignment fill.
//
- val (_, actual) = TestUtils.testBinary(testSchema, "00000102000000030405666600000007", areTracing = false)
+ val (_, actual) =
+ TestUtils.testBinary(testSchema, "00000102000000030405666600000007", areTracing = false)
val expected =
<ex:r>
<int3>1</int3>
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestIsScannable.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestIsScannable.scala
index 6f8f841b5..cb8b227a0 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestIsScannable.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestIsScannable.scala
@@ -17,14 +17,12 @@
package org.apache.daffodil.core.dsom
-import org.apache.daffodil.runtime1.dsom._
-
-import org.junit.Test
import org.apache.daffodil.core.compiler._
-
+import org.apache.daffodil.lib.util.SchemaUtils
import org.apache.daffodil.lib.xml.XMLUtils
+import org.apache.daffodil.runtime1.dsom._
+
import org.junit.Assert._
-import org.apache.daffodil.lib.util.SchemaUtils
import org.junit.Test
class TestIsScannable {
@@ -38,7 +36,6 @@ class TestIsScannable {
val sc = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" encoding="utf-8"/>,
-
<xs:element name="list">
<xs:complexType>
<xs:sequence dfdl:separator="">
@@ -52,7 +49,8 @@ class TestIsScannable {
<xs:element ref="ex:w"/>
<xs:element name="x" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
val sset = Compiler().compileNode(sc).sset
@@ -69,7 +67,6 @@ class TestIsScannable {
val sc = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat"/>,
-
<xs:element name="list">
<xs:complexType>
<xs:sequence dfdl:separator="">
@@ -83,7 +80,8 @@ class TestIsScannable {
<xs:element ref="ex:w"/>
<xs:element name="x" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
val sset = Compiler().compileNode(sc).sset
@@ -117,7 +115,8 @@ class TestIsScannable {
<xs:element ref="ex:w"/>
<xs:element name="x" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
val sset = Compiler().compileNode(sc).sset
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes.scala
index 01917b06f..5e95f6931 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes.scala
@@ -17,9 +17,10 @@
package org.apache.daffodil.core.dsom
+import org.apache.daffodil.lib.util._
import org.apache.daffodil.lib.xml.XMLUtils
+
import org.junit.Assert._
-import org.apache.daffodil.lib.util._
import org.junit.Test
class TestMiddleEndAttributes {
@@ -39,7 +40,8 @@ class TestMiddleEndAttributes {
<xs:element name="s2" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -65,7 +67,8 @@ class TestMiddleEndAttributes {
<xs:element name="s2" type="xs:string" minOccurs="0" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -94,7 +97,8 @@ class TestMiddleEndAttributes {
<xs:element name="s5" type="xs:string" minOccurs="0" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -126,7 +130,8 @@ class TestMiddleEndAttributes {
</xs:choice>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -152,9 +157,7 @@ class TestMiddleEndAttributes {
@Test def testNearestEnclosingSequenceElementRef(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
-
<dfdl:format ref="tns:GeneralFormat" representation="text" occursCountKind="parsed" lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" separator="" ignoreCase="no" initiatedContent="no"/>,
-
<xs:element name="e1" dfdl:lengthKind="explicit" dfdl:length="{ 1 }"/>
<xs:element name="e2" dfdl:lengthKind="implicit">
<xs:complexType>
@@ -162,7 +165,8 @@ class TestMiddleEndAttributes {
<xs:element ref="e1"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -183,7 +187,6 @@ class TestMiddleEndAttributes {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
-
<xs:element name="doc">
<xs:complexType>
<xs:sequence dfdl:sequenceKind="ordered">
@@ -203,7 +206,8 @@ class TestMiddleEndAttributes {
<xs:element name="f" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes2.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes2.scala
index 6b1a77e1c..a698f29a0 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes2.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes2.scala
@@ -17,18 +17,17 @@
package org.apache.daffodil.core.dsom
+import org.apache.daffodil.core.util.TestUtils
import org.apache.daffodil.lib.util.SchemaUtils
+
import org.junit.Test
-import org.apache.daffodil.core.util.TestUtils
class TestMiddleEndAttributes2 {
@Test def testNestedSequencePrefixSep() = {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
-
<dfdl:format ref="tns:GeneralFormat" lengthKind="delimited" encoding="US-ASCII"/>,
-
<xs:element name="e1">
<xs:complexType>
<xs:sequence dfdl:separator="/" dfdl:separatorPosition="prefix">
@@ -37,7 +36,8 @@ class TestMiddleEndAttributes2 {
</xs:sequence>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes3.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes3.scala
index b45fc1853..6b60a73b0 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes3.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestMiddleEndAttributes3.scala
@@ -18,17 +18,16 @@
package org.apache.daffodil.core.dsom
import org.apache.daffodil.lib.util.SchemaUtils
-import org.junit.Test
+
import org.junit.Assert._
+import org.junit.Test
class TestMiddleEndAttributes3 {
@Test def testNextParentElements() = {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
-
<dfdl:format ref="tns:GeneralFormat" lengthKind="delimited" encoding="US-ASCII"/>,
-
<xs:group name="IPSrcGrp">
<xs:sequence>
<xs:element name="byte1" type="xs:int" dfdl:outputValueCalc="{ ../IPSrc }"/>
@@ -48,7 +47,8 @@ class TestMiddleEndAttributes3 {
<xs:element name="TransportLayer" type="xs:byte" dfdl:lengthKind="explicit" dfdl:lengthUnits="bytes" dfdl:length="{ ../PayloadLength }"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
@@ -72,9 +72,7 @@ class TestMiddleEndAttributes3 {
@Test def testNextParentElements2() = {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
-
<dfdl:format ref="tns:GeneralFormat" lengthKind="delimited" encoding="US-ASCII"/>,
-
<xs:group name="IPSrcGrp">
<xs:sequence>
<xs:element name="byte1" type="xs:int" dfdl:outputValueCalc="{ ../IPSrc }"/>
@@ -98,7 +96,8 @@ class TestMiddleEndAttributes3 {
</xs:choice>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val sset = SchemaSet(testSchema)
val Seq(sch) = sset.schemas
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPolymorphicUpwardRelativeExpressions.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPolymorphicUpwardRelativeExpressions.scala
index 1fae20d6d..c8e51c4fe 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPolymorphicUpwardRelativeExpressions.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPolymorphicUpwardRelativeExpressions.scala
@@ -18,12 +18,11 @@
package org.apache.daffodil.core.dsom
import org.apache.daffodil.core.util._
-
-import org.junit.Test
-import org.apache.daffodil.lib.Implicits._;
+import org.apache.daffodil.lib.Implicits._
+import org.apache.daffodil.lib.util._
import org.apache.daffodil.lib.xml.XMLUtils
+
import org.junit.Assert._
-import org.apache.daffodil.lib.util._
import org.junit.Test
class TestPolymorphicUpwardRelativeExpressions {
@@ -139,7 +138,8 @@ class TestPolymorphicUpwardRelativeExpressions {
</xs:sequence>
</xs:complexType>
</xs:element>,
- elementFormDefault = "unqualified")
+ elementFormDefault = "unqualified",
+ )
val e = intercept[Exception] {
TestUtils.testString(testSchema, "e2;1961-02-01;6;", areTracing = false)
}
@@ -249,7 +249,8 @@ class TestPolymorphicUpwardRelativeExpressions {
</xs:sequence>
</xs:complexType>
</xs:element>,
- elementFormDefault = "unqualified")
+ elementFormDefault = "unqualified",
+ )
val (_, actual) = TestUtils.testString(testSchema, "e2;5;6;", areTracing = false)
val expected =
<ex:r>
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPropertyScoping.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPropertyScoping.scala
index 8ab982d1a..372d165ca 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPropertyScoping.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestPropertyScoping.scala
@@ -17,12 +17,13 @@
package org.apache.daffodil.core.dsom
+import scala.xml.Node
+
+import org.apache.daffodil.core.util.Fakes
import org.apache.daffodil.core.util._
-import scala.xml.Node
-import org.junit.Test
import org.junit.Assert._
-import org.apache.daffodil.core.util.Fakes
+import org.junit.Test
class HasProps(xml: Node) extends DFDLFormatAnnotation(xml, Fakes.fakeElem)
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestRefMap.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestRefMap.scala
index e5a42f1fe..509ad93b9 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestRefMap.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestRefMap.scala
@@ -20,6 +20,7 @@ package org.apache.daffodil.core.dsom
import org.apache.daffodil.core.compiler._
import org.apache.daffodil.lib.util._
import org.apache.daffodil.lib.xml.XMLUtils
+
import org.junit.Assert._
import org.junit.Test
@@ -32,9 +33,10 @@ class TestRefMap {
@Test def testRefMapEmpty(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>)
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -49,14 +51,15 @@ class TestRefMap {
@Test def testRefMapComplex1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:sequence>
<xs:element name="e" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:complexType>)
+ </xs:complexType>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -74,9 +77,9 @@ class TestRefMap {
@Test def testRefMapGroupRefSeq1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:group ref="ex:g"/>
</xs:complexType>
@@ -84,7 +87,8 @@ class TestRefMap {
<xs:sequence>
<xs:element name="e" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
- </xs:group>)
+ </xs:group>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -108,9 +112,9 @@ class TestRefMap {
@Test def testRefMapGroupRefChoice1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:group ref="ex:g"/>
</xs:complexType>
@@ -119,7 +123,8 @@ class TestRefMap {
<xs:element name="e" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
<xs:element name="f" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -143,9 +148,9 @@ class TestRefMap {
@Test def testRefMapGroupRefNest1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:group ref="ex:g"/>
</xs:complexType>
@@ -165,7 +170,8 @@ class TestRefMap {
<xs:element name="e1" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit" dfdl:outputValueCalc="{ 0 }"/>
<xs:element name="f1" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:choice>
- </xs:group>)
+ </xs:group>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -189,9 +195,9 @@ class TestRefMap {
@Test def testRefMapNonExplosion1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:sequence>
<xs:group ref="ex:g"/>
@@ -212,7 +218,8 @@ class TestRefMap {
<xs:element name="f1" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -238,9 +245,9 @@ class TestRefMap {
@Test def testRefMapExplosion2(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:sequence>
<xs:group ref="ex:g"/>
@@ -269,7 +276,8 @@ class TestRefMap {
<xs:element name="f1" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -289,8 +297,8 @@ class TestRefMap {
@Test def testRefMapExplosion3(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
<xs:element name="r">
<xs:complexType>
<xs:sequence>
@@ -322,7 +330,8 @@ class TestRefMap {
<xs:element name="f1" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -342,8 +351,8 @@ class TestRefMap {
@Test def testRefMapExplosion4(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
<xs:element name="e5">
<xs:complexType>
<xs:sequence>
@@ -383,7 +392,8 @@ class TestRefMap {
<xs:element name="f0" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -403,8 +413,8 @@ class TestRefMap {
@Test def testRefMapExplosion5(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
<xs:element name="e6">
<xs:complexType>
<xs:sequence>
@@ -452,7 +462,8 @@ class TestRefMap {
<xs:element name="f0" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -472,8 +483,8 @@ class TestRefMap {
@Test def testRefMapExplosion6(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
<xs:element name="e7">
<xs:complexType>
<xs:sequence>
@@ -529,7 +540,8 @@ class TestRefMap {
<xs:element name="f0" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -549,8 +561,8 @@ class TestRefMap {
@Test def testRefMapExplosion7(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat"/>,
<xs:element name="e8">
<xs:complexType>
<xs:sequence>
@@ -614,7 +626,8 @@ class TestRefMap {
<xs:element name="f0" type="xs:int" dfdl:length="1" dfdl:lengthKind="explicit"/>
</xs:sequence>
</xs:complexType>
- </xs:element>)
+ </xs:element>,
+ )
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
val root = sset.root
@@ -644,9 +657,9 @@ class TestRefMap {
*/
@Test def testUnusedGroup1(): Unit = {
val testSchema = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
- <xs:element name="r" type="ex:ct"/>
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
+ <xs:element name="r" type="ex:ct"/>
<xs:complexType name="ct">
<xs:group ref="ex:g"/>
</xs:complexType>
@@ -663,7 +676,7 @@ class TestRefMap {
</xs:sequence>
</xs:group>,
useDefaultNamespace = false,
- elementFormDefault = "unqualified"
+ elementFormDefault = "unqualified",
)
val compiler = Compiler()
val sset = compiler.compileNode(testSchema).sset
@@ -689,10 +702,9 @@ class TestRefMap {
assertEquals(1, e_enclElems.length)
}
-
lazy val testRootPathsSchema1 = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
//
// note that the first element below will be the root element.
// it doesn't use any of the rest of the schema
@@ -706,16 +718,16 @@ class TestRefMap {
// element h. Since h is not the root, we will only check, and detect this
// if compileAllTopLevels is true.
//
- <xs:element name="r" type="xs:int"/>
+ <xs:element name="r" type="xs:int"/>
<xs:element name="notRoot" type="tns:ct"/>
- ++
- restOfXML,
+ ++
+ restOfXML,
useDefaultNamespace = false,
- elementFormDefault = "unqualified"
+ elementFormDefault = "unqualified",
)
- lazy val restOfXML = (
- <xs:element name="h"><!-- uses the substructure, but expressions are past root-->
+ lazy val restOfXML =
+ (<xs:element name="h"><!-- uses the substructure, but expressions are past root-->
<xs:complexType>
<xs:sequence>
<!-- The group g contains elements with paths that are past the root for
@@ -724,11 +736,11 @@ class TestRefMap {
</xs:sequence>
</xs:complexType>
</xs:element>
- ++
+ ++
restOfXML2)
lazy val restOfXML2 =
- <xs:complexType name="ct">
+ <xs:complexType name="ct">
<xs:sequence>
<xs:element name="rr">
<xs:complexType>
@@ -795,12 +807,14 @@ class TestRefMap {
assertTrue(isError)
val msgs = pf.getDiagnostics.map(_.getMessage()).mkString("\n")
assertTrue(isError)
- assertTrue(msgs.toLowerCase.contains("Relative path '../../rr/f' past root element".toLowerCase))
+ assertTrue(
+ msgs.toLowerCase.contains("Relative path '../../rr/f' past root element".toLowerCase),
+ )
}
lazy val testRootPathsSchema2 = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
//
// note that the first element below will be the root element.
//
@@ -812,11 +826,11 @@ class TestRefMap {
// we don't report errors about these meaningless paths, as we only
// generate code for the root.
//
- <xs:element name="r" type="tns:ct"/>
- ++
- restOfXML,
- useDefaultNamespace = false,
- elementFormDefault = "unqualified"
+ <xs:element name="r" type="tns:ct"/>
+ ++
+ restOfXML,
+ useDefaultNamespace = false,
+ elementFormDefault = "unqualified",
)
/**
@@ -837,8 +851,8 @@ class TestRefMap {
}
lazy val testRootPathsSchema3 = SchemaUtils.dfdlTestSchema(
- <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
+ <xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
+ <dfdl:format ref="tns:GeneralFormat" lengthKind="delimited"/>,
//
// note that the first element below will be the root element.
//
@@ -852,9 +866,9 @@ class TestRefMap {
//
// But, h is checked. The meaningless part of it is detected.
//
- <xs:element name="r" type="tns:ct"/>
- ++
- <xs:element name="h"><!-- uses the substructure, but expressions are past root-->
+ <xs:element name="r" type="tns:ct"/>
+ ++
+ <xs:element name="h"><!-- uses the substructure, but expressions are past root-->
<xs:complexType>
<xs:sequence>
<!-- The group g contains elements with paths that are past the root for
@@ -865,9 +879,9 @@ class TestRefMap {
</xs:complexType>
</xs:element>
++
- restOfXML2,
- useDefaultNamespace = false,
- elementFormDefault = "unqualified"
+ restOfXML2,
+ useDefaultNamespace = false,
+ elementFormDefault = "unqualified",
)
/**
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
index 2e951f6c9..a56bba099 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/TestSimpleTypeUnions.scala
@@ -17,19 +17,18 @@
package org.apache.daffodil.core.dsom
-import org.apache.daffodil.runtime1.dsom._
-
import org.apache.daffodil.core.util._
-
-import org.apache.daffodil.lib.xml.XMLUtils
-import org.junit.Assert._
import org.apache.daffodil.lib.util._
+import org.apache.daffodil.lib.xml.XMLUtils
import org.apache.daffodil.runtime1.dpath.NodeInfo._
-import org.junit.Test
-import org.apache.daffodil.runtime1.infoset.DISimple
+import org.apache.daffodil.runtime1.dsom._
import org.apache.daffodil.runtime1.infoset.DIDocument
+import org.apache.daffodil.runtime1.infoset.DISimple
import org.apache.daffodil.runtime1.processors.parsers.PState
+import org.junit.Assert._
+import org.junit.Test
+
class TestSimpleTypeUnions {
val xsd = XMLUtils.XSD_NAMESPACE
val dfdl = XMLUtils.DFDL_NAMESPACE
@@ -39,7 +38,6 @@ class TestSimpleTypeUnions {
val testSchema1 = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="GeneralFormat"/>,
-
<xs:simpleType name="int1Type">
<xs:restriction base="xs:int">
<xs:minInclusive value="1"/>
@@ -66,7 +64,8 @@ class TestSimpleTypeUnions {
<dfdl:assert test="{ fn:true() or /ex:e1 eq 0 }" />
</xs:appinfo>
</xs:annotation>
- </xs:element>)
+ </xs:element>,
+ )
@Test def testUnion01(): Unit = {
@@ -101,7 +100,12 @@ class TestSimpleTypeUnions {
@Test def testUnionFirstUnionMemberOk(): Unit = {
val (result, actual) = TestUtils.testString(testSchema1, "1")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("int1Type", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -111,7 +115,12 @@ class TestSimpleTypeUnions {
@Test def testUnionSecondUnionMemberOk(): Unit = {
val (result, actual) = TestUtils.testString(testSchema1, "2")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("int2Type", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -121,7 +130,12 @@ class TestSimpleTypeUnions {
@Test def testUnionNoUnionMemberOK(): Unit = {
val (result, _) = TestUtils.testString(testSchema1, "3")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val Some(dv: java.lang.Integer) = Some(i.dataValue.getInt)
assertEquals(3, dv.intValue())
assertTrue(i.unionMemberRuntimeData.isEmpty)
@@ -147,7 +161,6 @@ class TestSimpleTypeUnions {
val testSchema2 = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="GeneralFormat"/>,
-
<xs:simpleType name="int19Type">
<xs:restriction base="xs:int">
<xs:minInclusive value="1"/>
@@ -205,11 +218,17 @@ class TestSimpleTypeUnions {
<dfdl:assert test="{ fn:true() or /ex:e1 eq 0 }" />
</xs:appinfo>
</xs:annotation>
- </xs:element>)
+ </xs:element>,
+ )
@Test def testUnionNot3(): Unit = {
val (result, _) = TestUtils.testString(testSchema2, "3")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val Some(dv: java.lang.Integer) = Some(i.dataValue.getInt)
assertEquals(3, dv.intValue())
assertTrue(i.unionMemberRuntimeData.isEmpty)
@@ -234,7 +253,12 @@ class TestSimpleTypeUnions {
@Test def testUnionNot3_01(): Unit = {
val (result, actual) = TestUtils.testString(testSchema2, "1")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("int12Type", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -244,7 +268,12 @@ class TestSimpleTypeUnions {
@Test def testUnionNot3_02(): Unit = {
val (result, actual) = TestUtils.testString(testSchema2, "2")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("int12Type", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -254,9 +283,17 @@ class TestSimpleTypeUnions {
@Test def testUnionNot3_03(): Unit = {
val (result, actual) = TestUtils.testString(testSchema2, "-1")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
- assertEquals("ex:negIntType", umstrd.diagnosticDebugName) // anonymous simple type gets this name from base.
+ assertEquals(
+ "ex:negIntType",
+ umstrd.diagnosticDebugName,
+ ) // anonymous simple type gets this name from base.
assertTrue(i.valid.get)
val expected = <e1>-1</e1>
TestUtils.assertEqualsXMLElements(expected, actual)
@@ -265,7 +302,6 @@ class TestSimpleTypeUnions {
val testSchema3 = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="GeneralFormat"/>,
-
<xs:simpleType name="fooXbar">
<xs:restriction base="xs:string">
<xs:pattern value="foo\w*bar"/>
@@ -307,11 +343,17 @@ class TestSimpleTypeUnions {
<dfdl:assert test="{ fn:true() or /ex:e1 eq '' }" />
</xs:appinfo>
</xs:annotation>
- </xs:element>)
+ </xs:element>,
+ )
@Test def testRestrictionOnUnion_01(): Unit = {
val (result, actual) = TestUtils.testString(testSchema3, "foo3bar")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("ex:foo3or4bar", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -321,7 +363,12 @@ class TestSimpleTypeUnions {
@Test def testRestrictionOnUnion_02(): Unit = {
val (result, actual) = TestUtils.testString(testSchema3, "foo1bar")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("foo1or2bar", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -331,7 +378,12 @@ class TestSimpleTypeUnions {
@Test def testRestrictionOnUnion_03(): Unit = {
val (result, actual) = TestUtils.testString(testSchema3, "foo2bar")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val umstrd = i.unionMemberRuntimeData.get
assertEquals("foo1or2bar", umstrd.diagnosticDebugName)
assertTrue(i.valid.get)
@@ -341,7 +393,12 @@ class TestSimpleTypeUnions {
@Test def testRestrictionOnUnionFail_01(): Unit = {
val (result, _) = TestUtils.testString(testSchema3, "foo4bar")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val Some(dv: String) = Some(i.dataValue.getString)
assertEquals("foo4bar", dv)
assertTrue(i.unionMemberRuntimeData.isEmpty)
@@ -370,7 +427,12 @@ class TestSimpleTypeUnions {
*/
@Test def testRestrictionOnUnionFail_02(): Unit = {
val (result, _) = TestUtils.testString(testSchema3, "notfoo1bar")
- val i = result.resultState.asInstanceOf[PState].infoset.asInstanceOf[DIDocument].contents(0).asInstanceOf[DISimple]
+ val i = result.resultState
+ .asInstanceOf[PState]
+ .infoset
+ .asInstanceOf[DIDocument]
+ .contents(0)
+ .asInstanceOf[DISimple]
val Some(dv: String) = Some(i.dataValue.getString)
assertEquals("notfoo1bar", dv)
assertTrue(i.unionMemberRuntimeData.isEmpty)
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/BasicWalker.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/BasicWalker.scala
index 72b8ca1ab..8d2d1a515 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/BasicWalker.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/BasicWalker.scala
@@ -19,7 +19,11 @@ package org.apache.daffodil.core.dsom.walker
import scala.collection.mutable.ArrayBuffer
-class BasicWalker(ignoreTypeWrappers: Boolean = false, onlyElements: Boolean = false, ignoreEndEvents: Boolean = true) extends AbstractDSOMWalker {
+class BasicWalker(
+ ignoreTypeWrappers: Boolean = false,
+ onlyElements: Boolean = false,
+ ignoreEndEvents: Boolean = true,
+) extends AbstractDSOMWalker {
var nodeArr: ArrayBuffer[AnyRef] = ArrayBuffer()
@@ -33,13 +37,16 @@ class BasicWalker(ignoreTypeWrappers: Boolean = false, onlyElements: Boolean = f
override protected def onWalkBegin(root: RootView): Unit = addViewElement(root)
- override protected def onWalkEnd(root: RootView): Unit = if (!ignoreEndEvents) addViewElement(root)
+ override protected def onWalkEnd(root: RootView): Unit =
+ if (!ignoreEndEvents) addViewElement(root)
override def onTermBegin(termElement: TermView): Unit = addViewElement(termElement)
- override def onTermEnd(termElement: TermView): Unit = if (!ignoreEndEvents) addViewElement(termElement)
+ override def onTermEnd(termElement: TermView): Unit =
+ if (!ignoreEndEvents) addViewElement(termElement)
override def onTypeBegin(typeElement: TypeView): Unit = addViewElement(typeElement)
- override def onTypeEnd(typeElement: TypeView): Unit = if (!ignoreEndEvents) addViewElement(typeElement)
+ override def onTypeEnd(typeElement: TypeView): Unit =
+ if (!ignoreEndEvents) addViewElement(typeElement)
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/TestDSOMWalker.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/TestDSOMWalker.scala
index 7e03e7834..ae9de30b9 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/TestDSOMWalker.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/dsom/walker/TestDSOMWalker.scala
@@ -17,12 +17,12 @@
package org.apache.daffodil.core.dsom.walker
+import org.apache.daffodil.core.compiler.{ Compiler, ProcessorFactory }
+import org.apache.daffodil.lib.util._
import org.apache.daffodil.runtime1.dsom.walker._
-import org.apache.daffodil.lib.util._
-import org.apache.daffodil.core.compiler.{ Compiler, ProcessorFactory }
-import org.junit.Test
import org.junit.Assert._
+import org.junit.Test
class TestDSOMWalker {
@@ -44,33 +44,94 @@ class TestDSOMWalker {
</xs:element>
<xs:group name="testGroup">
<xs:sequence />
- </xs:group>
+ </xs:group>,
)
val pf: ProcessorFactory = Compiler().compileNode(testSchema)
- assertEquals(s"This basic Schema: $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}", false, pf.isError)
+ assertEquals(
+ s"This basic Schema: $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}",
+ false,
+ pf.isError,
+ )
val walker: BasicWalker = new BasicWalker(ignoreEndEvents = false)
walker.walkFromRoot(pf.rootView)
val nodeStack: List[AnyRef] = walker.nodeArr.toList
assertEquals(s"Node Stack $nodeStack should have 16 elements", 16, nodeStack.size)
- assertTrue("Should have received a start event for the overall traversal", nodeStack.head.isInstanceOf[RootView])
+ assertTrue(
+ "Should have received a start event for the overall traversal",
+ nodeStack.head.isInstanceOf[RootView],
+ )
assertTrue("The Root element was not of type RootView", nodeStack(1).isInstanceOf[RootView])
- assertEquals("The root element should be named 'PersonData'", "PersonData", nodeStack(1).asInstanceOf[RootView].name)
- assertTrue("The root element should contain a complexType wrapper child", nodeStack(2).isInstanceOf[ComplexTypeView])
- assertTrue("The complexType element should contain a Sequence child", nodeStack(3).isInstanceOf[SequenceView])
- assertTrue("The Sequence element should contain a Choice child", nodeStack(4).isInstanceOf[ChoiceView])
- assertTrue("The Choice element should contain an Element child", nodeStack(5).isInstanceOf[ElementBaseView])
- assertEquals("The Element child should be named 'age'", "age", nodeStack(5).asInstanceOf[ElementBaseView].name)
- assertEquals("The Element child should be a simple type", true, nodeStack(5).asInstanceOf[ElementBaseView].isSimpleType)
- assertTrue("The 'age' element should have a SimpleTypeView", nodeStack(6).isInstanceOf[SimpleTypeView])
- assertTrue("Should have received an end event for the Simple Type", nodeStack(7).isInstanceOf[SimpleTypeView])
- assertTrue("Should have received an end event for the 'age' element", nodeStack(8).isInstanceOf[ElementBaseView])
- assertTrue("Should have received an end event for the Choice element", nodeStack(9).isInstanceOf[ChoiceView])
- assertTrue("The Sequence element should contain a second child that is a GroupRef", nodeStack(10).isInstanceOf[GroupRefView])
- assertTrue("Should have received an end event for the GroupRef element", nodeStack(11).isInstanceOf[GroupRefView])
- assertTrue("Should have received an end event for the Sequence element", nodeStack(12).isInstanceOf[SequenceView])
- assertTrue("Should have received an end event for the complexType wrapper element", nodeStack(13).isInstanceOf[ComplexTypeView])
- assertTrue("Should have received an end event for the Root element", nodeStack(14).isInstanceOf[RootView])
- assertTrue("Should have received an end event for the overall traversal", nodeStack(15).isInstanceOf[RootView])
+ assertEquals(
+ "The root element should be named 'PersonData'",
+ "PersonData",
+ nodeStack(1).asInstanceOf[RootView].name,
+ )
+ assertTrue(
+ "The root element should contain a complexType wrapper child",
+ nodeStack(2).isInstanceOf[ComplexTypeView],
+ )
+ assertTrue(
+ "The complexType element should contain a Sequence child",
+ nodeStack(3).isInstanceOf[SequenceView],
+ )
+ assertTrue(
+ "The Sequence element should contain a Choice child",
+ nodeStack(4).isInstanceOf[ChoiceView],
+ )
+ assertTrue(
+ "The Choice element should contain an Element child",
+ nodeStack(5).isInstanceOf[ElementBaseView],
+ )
+ assertEquals(
+ "The Element child should be named 'age'",
+ "age",
+ nodeStack(5).asInstanceOf[ElementBaseView].name,
+ )
+ assertEquals(
+ "The Element child should be a simple type",
+ true,
+ nodeStack(5).asInstanceOf[ElementBaseView].isSimpleType,
+ )
+ assertTrue(
+ "The 'age' element should have a SimpleTypeView",
+ nodeStack(6).isInstanceOf[SimpleTypeView],
+ )
+ assertTrue(
+ "Should have received an end event for the Simple Type",
+ nodeStack(7).isInstanceOf[SimpleTypeView],
+ )
+ assertTrue(
+ "Should have received an end event for the 'age' element",
+ nodeStack(8).isInstanceOf[ElementBaseView],
+ )
+ assertTrue(
+ "Should have received an end event for the Choice element",
+ nodeStack(9).isInstanceOf[ChoiceView],
+ )
+ assertTrue(
+ "The Sequence element should contain a second child that is a GroupRef",
+ nodeStack(10).isInstanceOf[GroupRefView],
+ )
+ assertTrue(
+ "Should have received an end event for the GroupRef element",
+ nodeStack(11).isInstanceOf[GroupRefView],
+ )
+ assertTrue(
+ "Should have received an end event for the Sequence element",
+ nodeStack(12).isInstanceOf[SequenceView],
+ )
+ assertTrue(
+ "Should have received an end event for the complexType wrapper element",
+ nodeStack(13).isInstanceOf[ComplexTypeView],
+ )
+ assertTrue(
+ "Should have received an end event for the Root element",
+ nodeStack(14).isInstanceOf[RootView],
+ )
+ assertTrue(
+ "Should have received an end event for the overall traversal",
+ nodeStack(15).isInstanceOf[RootView],
+ )
}
private def getSuffix(ordinal: Int): String = {
@@ -115,38 +176,68 @@ class TestDSOMWalker {
dfdl:lengthKind="explicit" dfdl:length="8"/>
</xs:sequence>
</xs:complexType>
- </xs:element>
+ </xs:element>,
)
val pf: ProcessorFactory = Compiler().compileNode(testSchema)
- assertEquals(s"This basic Schema $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}", false, pf.isError)
+ assertEquals(
+ s"This basic Schema $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}",
+ false,
+ pf.isError,
+ )
val walker: BasicWalker = new BasicWalker(false, true)
walker.walkFromRoot(pf.rootView)
val simpleTypes: List[Class[_ <: PrimTypeView]] = List(
- classOf[StringView], classOf[BooleanView], classOf[ByteView], classOf[ShortView], classOf[IntView],
- classOf[LongView], classOf[UnsignedByteView], classOf[UnsignedShortView], classOf[UnsignedIntView], classOf[UnsignedLongView],
- classOf[NonNegativeIntegerView], classOf[IntegerView], classOf[FloatView], classOf[DoubleView], classOf[DecimalView],
- classOf[HexBinaryView], classOf[AnyURIView], classOf[DateTimeView], classOf[DateView], classOf[TimeView]
+ classOf[StringView],
+ classOf[BooleanView],
+ classOf[ByteView],
+ classOf[ShortView],
+ classOf[IntView],
+ classOf[LongView],
+ classOf[UnsignedByteView],
+ classOf[UnsignedShortView],
+ classOf[UnsignedIntView],
+ classOf[UnsignedLongView],
+ classOf[NonNegativeIntegerView],
+ classOf[IntegerView],
+ classOf[FloatView],
+ classOf[DoubleView],
+ classOf[DecimalView],
+ classOf[HexBinaryView],
+ classOf[AnyURIView],
+ classOf[DateTimeView],
+ classOf[DateView],
+ classOf[TimeView],
)
val nodeStack: List[AnyRef] = walker.nodeArr.toList
- assertEquals(s"Node Stack $nodeStack did not have the expected number of elements", 2 * simpleTypes.size + 3, nodeStack.size)
+ assertEquals(
+ s"Node Stack $nodeStack did not have the expected number of elements",
+ 2 * simpleTypes.size + 3,
+ nodeStack.size,
+ )
for (index <- 1 to simpleTypes.size) {
val elementIndex = 2 * index + 1
val simpleTypeIndex = 2 * index + 2
- assertTrue(s"The $elementIndex${getSuffix(elementIndex)} element in the stack should be an Element", nodeStack(elementIndex).isInstanceOf[ElementBaseView])
+ assertTrue(
+ s"The $elementIndex${getSuffix(elementIndex)} element in the stack should be an Element",
+ nodeStack(elementIndex).isInstanceOf[ElementBaseView],
+ )
val className: String = simpleTypes(index - 1).getSimpleName
val withoutView: String = className.substring(0, className.length - 4)
val fieldName: String = withoutView.charAt(0).toLower + withoutView.substring(1) + "Field"
assertEquals(
- s"The $elementIndex${getSuffix(elementIndex)} element in the stack should be named '$fieldName'", fieldName,
- nodeStack(elementIndex).asInstanceOf[ElementBaseView].name
+ s"The $elementIndex${getSuffix(elementIndex)} element in the stack should be named '$fieldName'",
+ fieldName,
+ nodeStack(elementIndex).asInstanceOf[ElementBaseView].name,
)
assertTrue(
s"The $simpleTypeIndex${getSuffix(simpleTypeIndex)} element in the stack should be a Simple type",
- nodeStack(simpleTypeIndex).isInstanceOf[SimpleTypeView]
+ nodeStack(simpleTypeIndex).isInstanceOf[SimpleTypeView],
)
assertTrue(
s"The $simpleTypeIndex${getSuffix(simpleTypeIndex)} element in the stack should be of type '$className'",
- simpleTypes(index - 1).isInstance(nodeStack(simpleTypeIndex).asInstanceOf[SimpleTypeView].primType)
+ simpleTypes(index - 1).isInstance(
+ nodeStack(simpleTypeIndex).asInstanceOf[SimpleTypeView].primType,
+ ),
)
}
}
@@ -163,17 +254,36 @@ class TestDSOMWalker {
<xs:element name="data" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
- </xs:element>
+ </xs:element>,
)
val pf: ProcessorFactory = Compiler().compileNode(testSchema)
- assertEquals(s"This basic Schema: $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}", false, pf.isError)
+ assertEquals(
+ s"This basic Schema: $testSchema should compile; here are some diagnostics: ${pf.getDiagnostics}",
+ false,
+ pf.isError,
+ )
val walker: BasicWalker = new BasicWalker(true, true)
walker.walkFromRoot(pf.rootView)
val nodeStack: List[AnyRef] = walker.nodeArr.toList
- assertEquals(s"Node Stack $nodeStack did not have the expected number of elements", 3, nodeStack.size)
- assertTrue("The 3rd element in the stack should be an Element", nodeStack(2).isInstanceOf[ElementBaseView])
- assertEquals("The 3rd element in the stack should be named 'data'", "data", nodeStack(2).asInstanceOf[ElementBaseView].name)
- assertEquals("The 'data' element should be optional", true, nodeStack(2).asInstanceOf[ElementBaseView].isOptional)
+ assertEquals(
+ s"Node Stack $nodeStack did not have the expected number of elements",
+ 3,
+ nodeStack.size,
+ )
+ assertTrue(
+ "The 3rd element in the stack should be an Element",
+ nodeStack(2).isInstanceOf[ElementBaseView],
+ )
+ assertEquals(
+ "The 3rd element in the stack should be named 'data'",
+ "data",
+ nodeStack(2).asInstanceOf[ElementBaseView].name,
+ )
+ assertEquals(
+ "The 'data' element should be optional",
+ true,
+ nodeStack(2).asInstanceOf[ElementBaseView].isOptional,
+ )
}
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/externalvars/TestExternalVariables.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/externalvars/TestExternalVariables.scala
index 4fdb33c4a..7dca7aebe 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/externalvars/TestExternalVariables.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/externalvars/TestExternalVariables.scala
@@ -17,13 +17,16 @@
package org.apache.daffodil.core.externalvars
+import org.apache.daffodil.lib.Implicits._
+
import org.junit.Assert._
-import org.junit.Test
-import org.apache.daffodil.lib.Implicits._; object INoWarn2 { ImplicitsSuppressUnusedImportWarning() }
-import org.junit.Test
-import org.apache.daffodil.lib.xml._
+import org.junit.Test; object INoWarn2 { ImplicitsSuppressUnusedImportWarning() }
import scala.util.Success
+import org.apache.daffodil.lib.xml._
+
+import org.junit.Test
+
class TestExternalVariables {
@Test def testQNameForIndividualVars() = {
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestDFDLReaders.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestDFDLReaders.scala
index 31cb6cf10..3722b181d 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestDFDLReaders.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestDFDLReaders.scala
@@ -23,7 +23,7 @@ class TestDFDLReaders {
// @Test
// def test1() {
- // val r : Reader[Char] = dr.drop(3)
+ // val r : Reader[Char] = dr.drop(3)
// }
}
diff --git a/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestPrimitives.scala b/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestPrimitives.scala
index 9b81fc897..7b96c0de0 100644
--- a/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestPrimitives.scala
+++ b/daffodil-core/src/test/scala/org/apache/daffodil/core/general/TestPrimitives.scala
@@ -20,8 +20,9 @@ package org.apache.daffodil.core.general
import scala.xml._
import org.apache.daffodil.core.util.TestUtils
-import org.junit.Test
-import org.apache.daffodil.lib.Implicits._; object INoWarn9 { ImplicitsSuppressUnusedImportWarning() }
+import org.apache.daffodil.lib.Implicits._
+
+import org.junit.Test; object INoWarn9 { ImplicitsSuppressUnusedImportWarning() }
import org.apache.daffodil.lib.util.SchemaUtils
class TestPrimitives {
@@ -30,9 +31,9 @@ class TestPrimitives {
val sch = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
<dfdl:format ref="tns:GeneralFormat" representation="text" lengthUnits="bytes" encoding="US-ASCII" terminator="" separator="" ignoreCase="no"/>,
-
<xs:element name="e1" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="{ 4 }" dfdl:initiator="abcd">
- </xs:element>)
... 31604 lines suppressed ...