mbeckerle commented on code in PR #1389:
URL: https://github.com/apache/daffodil/pull/1389#discussion_r1892360357


##########
daffodil-tdml-junit/src/main/scala/org/apache/daffodil/junit/tdml/TdmlSuite.scala:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.junit.tdml
+
+import java.io.File
+
+import org.apache.daffodil.tdml.Runner
+import org.apache.daffodil.tdml.TDMLTestNotCompatibleException
+
+import org.junit.AfterClass
+import org.junit.AssumptionViolatedException
+import org.junit.Rule
+import org.junit.rules.TestName
+
+/**
+ * Mixin for a JUnit test suite companion object
+ */
+trait TdmlSuite {
+
+  /**
+   * Resource path to the TDML file to use for this JUnit suite
+   */
+  val tdmlResource: String
+
+  /**
+   * Function to get the directory containing tdmlResource. Useful if 
createRunner is overridden
+   * to use the Runner(dir, file, ...) factory method
+   */
+  def tdmlDir: String = new File(tdmlResource).getParent()
+
+  /**
+   * Function to get basename of tdmlResource. Useful if createRunner is 
overridden to use the
+   * Runner(dir, file, ...) factory method
+   */
+  def tdmlFile: String = new File(tdmlResource).getName()
+
+  /**
+   * Default implementation to create a Runner using the tdmlResource. This 
function can be
+   * overridden if additional options need to be passed to the Runner factory 
object, for
+   * example to disable TDML validation. In most cases this should not be 
needed, since most
+   * parameters should not be changed by normal schema tests, or can be 
defined in the TDML
+   * file.
+   */
+  def createRunner(): Runner = Runner(tdmlResource)
+
+  /**
+   * Lazily build the runner when needed
+   */
+  final lazy val runner = createRunner()
+
+  /**
+   * Ensure all resources associated with the Runner (e.g. cached compiled 
schemas, parsed TDML
+   * XML) to be freed once the test suite has completed
+   */
+  @AfterClass
+  final def shutDown(): Unit = runner.reset
+}
+
+/**
+ * Mixin for a JUnit test suite companion class
+ */
+trait TdmlTests {

Review Comment:
   I vote for the '@ignore' annnotation. 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to