You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2018/02/12 13:11:40 UTC

[GitHub] stevedlawrence closed pull request #38: Move built-in-formats.xsd to test and the backwards compatibility added for it

stevedlawrence closed pull request #38: Move built-in-formats.xsd to test and the backwards compatibility added for it
URL: https://github.com/apache/incubator-daffodil/pull/38
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/build.sbt b/build.sbt
index d61bf9079..76826948f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -54,11 +54,11 @@ lazy val core             = Project("daffodil-core", file("daffodil-core")).conf
                               .settings(commonSettings)
 
 lazy val japi             = Project("daffodil-japi", file("daffodil-japi")).configs(TestDebug)
-                              .dependsOn(core)
+                              .dependsOn(core, core % "test->test")
                               .settings(commonSettings)
 
 lazy val sapi             = Project("daffodil-sapi", file("daffodil-sapi")).configs(TestDebug)
-                              .dependsOn(core)
+                              .dependsOn(core, core % "test->test")
                               .settings(commonSettings)
 
 lazy val tdml             = Project("daffodil-tdml", file("daffodil-tdml")).configs(TestDebug)
@@ -75,11 +75,11 @@ lazy val test             = Project("daffodil-test", file("daffodil-test")).conf
                               .settings(commonSettings, nopublish)
 
 lazy val testIBM1         = Project("daffodil-test-ibm1", file("daffodil-test-ibm1")).configs(TestDebug)
-                              .dependsOn(tdml)
+                              .dependsOn(tdml, core % "test->test")
                               .settings(commonSettings, nopublish)
 
 lazy val tutorials        = Project("daffodil-tutorials", file("tutorials")).configs(TestDebug)
-                              .dependsOn(tdml)
+                              .dependsOn(tdml, core % "test->test")
                               .settings(commonSettings, nopublish)
 
 lazy val testStdLayout    = Project("daffodil-test-stdLayout", file("test-stdLayout")).configs(TestDebug)
diff --git a/daffodil-cli/src/test/resources/clitests.tdml b/daffodil-cli/src/test/resources/clitests.tdml
deleted file mode 100644
index 81fcb074d..000000000
--- a/daffodil-cli/src/test/resources/clitests.tdml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-
-<testSuite suiteName="clitests"
-  xmlns="http://www.ibm.com/xmlns/dfdl/testData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData">
-
-
-  <tdml:parserTestCase name="test_3395_CLI_Performance_5_Threads_50_Times" root="Item2" model="org/apache/daffodil/CLI/cli_schema.dfdl.xsd">
-    <tdml:document>
-      <tdml:documentPart type="file">org/apache/daffodil/CLI/input/input5.txt</tdml:documentPart>
-    </tdml:document>
-    <tdml:infoset>
-      <tdml:dfdlInfoset>
-        <Item2><e3>HAT</e3><e4>400</e4></Item2>
-      </tdml:dfdlInfoset>
-    </tdml:infoset>
-  </tdml:parserTestCase>
-  
-</testSuite>
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/CLI/Util.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/CLI/Util.scala
index e678ab310..c2b497fcc 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/CLI/Util.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/CLI/Util.scala
@@ -84,7 +84,9 @@ object Util {
   }
 
   def getShell(cmd: String, spawnCmd: String, expectErr: Boolean = false, envp: Map[String, String] = Map.empty[String, String], timeout: Long): Expect = {
-    val newEnv = System.getenv().asScala ++ envp
+    // combine existing environment with envp and daffodil-lib test resources (needed for built-in-formats.xsd)
+    val newEnv = System.getenv().asScala ++ envp + (("DAFFODIL_CLASSPATH", daffodilPath("daffodil-lib/src/test/resources/")))
+
     val envAsArray = newEnv.toArray.map { case (k, v) => k + "=" + v }
     val process = Runtime.getRuntime().exec(spawnCmd, envAsArray)
     val inputStream = if (expectErr) {
@@ -111,7 +113,9 @@ object Util {
   // The inputStream will be at index 0
   // The errorStream will be at index 1
   def getShellWithErrors(cmd: String, spawnCmd: String, envp: Map[String, String] = Map.empty[String, String], timeout: Long): Expect = {
-    val newEnv = System.getenv().asScala ++ envp
+    // combine existing environment with envp and daffodil-lib test resources (needed for built-in-formats.xsd)
+    val newEnv = System.getenv().asScala ++ envp + (("DAFFODIL_CLASSPATH", daffodilPath("daffodil-lib/src/test/resources/")))
+
     val envAsArray = newEnv.toArray.map { case (k, v) => k + "=" + v }
     val process = Runtime.getRuntime().exec(spawnCmd, envAsArray)
     val shell = new ExpectBuilder()
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/performance/TestCLIPerformance.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/performance/TestCLIPerformance.scala
index c3ed1d5e0..9d27b26a6 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/performance/TestCLIPerformance.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/performance/TestCLIPerformance.scala
@@ -24,7 +24,6 @@ import net.sf.expectit.ExpectIOException
 import net.sf.expectit.matcher.Matchers.contains
 import net.sf.expectit.matcher.Matchers.eof
 import net.sf.expectit.matcher.Matchers.anyString
-import org.apache.daffodil.tdml.Runner
 
 class TestCLIPerformance {
 
@@ -106,10 +105,6 @@ class TestCLIPerformance {
     }
   }
 
-  val runner = Runner("/", "clitests.tdml")
-
-  @Test def test_3395_CLI_Performance_5_Threads_50_Times_tdml() { runner.runOneTest("test_3395_CLI_Performance_5_Threads_50_Times") }
-
   @Test def test_3395_CLI_Performance_5_Threads_50_Times() {
     val schemaFile = Util.daffodilPath("daffodil-cli/src/test/resources/org/apache/daffodil/CLI/cli_schema.dfdl.xsd")
     val inputFile = Util.daffodilPath("daffodil-cli/src/test/resources/org/apache/daffodil/CLI/input/input5.txt")
diff --git a/daffodil-cli/src/test/scala/org/apache/daffodil/saving/TestCLISaveParser.scala b/daffodil-cli/src/test/scala/org/apache/daffodil/saving/TestCLISaveParser.scala
index d327aaa29..5fbe3cf4f 100644
--- a/daffodil-cli/src/test/scala/org/apache/daffodil/saving/TestCLISaveParser.scala
+++ b/daffodil-cli/src/test/scala/org/apache/daffodil/saving/TestCLISaveParser.scala
@@ -21,12 +21,10 @@ import junit.framework.Assert._
 import org.junit.Test
 import org.junit.Before
 import org.junit.After
-import scala.sys.process._
 import org.apache.daffodil.CLI.Util
 import java.io.File
 import net.sf.expectit.matcher.Matchers.contains
 import net.sf.expectit.matcher.Matchers.eof
-import scala.language.postfixOps
 
 class TestCLISaveParser {
 
@@ -50,7 +48,8 @@ class TestCLISaveParser {
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("echo 0,1,2| %s parse --parser %s", Util.binPath, savedParserFile.getName())
       shell.sendLine(cmd)
@@ -101,7 +100,9 @@ class TestCLISaveParser {
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r row2 -c %s %s", Util.binPath, testSchemaFile, testConfigFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r row2 -c %s %s", Util.binPath, testSchemaFile, testConfigFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
+
       val cmd = String.format("echo 0,1,2| %s parse --parser %s", Util.binPath, savedParserFile.getName())
       shell.sendLine(cmd)
       shell.expect(contains(output12))
@@ -122,7 +123,8 @@ class TestCLISaveParser {
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r {target}matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r {target}matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("%s parse --parser %s %s", Util.binPath, savedParserFile.getName(), testInputFile)
       shell.sendLine(cmd)
@@ -136,13 +138,13 @@ class TestCLISaveParser {
   }
 
   @Test def test_3021_CLI_Saving_SaveParser_path() {
-
     val schemaFile = Util.daffodilPath("daffodil-test/src/test/resources/org/apache/daffodil/section06/entities/charClassEntities.dfdl.xsd")
     val testSchemaFile = if (Util.isWindows) Util.cmdConvert(schemaFile) else schemaFile
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r matrix -p / %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r matrix -p / %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("echo 0,1,2| %s parse --parser %s", Util.binPath, savedParserFile.getName())
       shell.sendLine(cmd)
@@ -221,7 +223,8 @@ class TestCLISaveParser {
     val shell = Util.startNoConvert("")
 
     try {
-      String.format("%s save-parser -s %s -r {}matrix -p / %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r {}matrix -p / %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("echo 0,1,2| %s parse --parser %s", Util.binPath, savedParserFile.getName())
       shell.sendLine(cmd)
@@ -243,7 +246,8 @@ class TestCLISaveParser {
     val shell = Util.start("", true)
 
     try {
-      String.format("%s save-parser -s %s -r {target}matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r {target}matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("%s parse --parser %s --validate %s", Util.binPath, savedParserFile.getName(), testInputFile)
       shell.sendLine(cmd)
@@ -371,7 +375,8 @@ class TestCLISaveParser {
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r matrix %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("%s unparse --parser %s %s", Util.binPath, savedParserFile.getName(), testInputFile)
       shell.sendLine(cmd)
@@ -393,7 +398,8 @@ class TestCLISaveParser {
     val shell = Util.start("")
 
     try {
-      String.format("%s save-parser -s %s -r e1 %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r e1 %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("%s unparse --parser %s %s", Util.binPath, savedParserFile.getName(), testInputFile)
       shell.sendLine(cmd)
@@ -415,7 +421,8 @@ class TestCLISaveParser {
     val shell = Util.start("", true)
 
     try {
-      String.format("%s save-parser -s %s -r e1 -T parseUnparsePolicy=parseOnly %s", Util.binPath, testSchemaFile, savedParserFile.getName()) !
+      val saveCmd = String.format("%s save-parser -s %s -r e1 -T parseUnparsePolicy=parseOnly %s", Util.binPath, testSchemaFile, savedParserFile.getName())
+      shell.sendLine(saveCmd)
 
       val cmd = String.format("%s unparse --parser %s %s", Util.binPath, savedParserFile.getName(), testInputFile)
       shell.sendLine(cmd)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
index 68dbaf7aa..76b138e68 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
@@ -165,17 +165,7 @@ abstract class IIBase( final override val xml: Node, xsdArg: XMLSchemaDocument,
     res
   }.value
 
-  final lazy val schemaLocationProperty = {
-    val prop = getAttributeOption("schemaLocation")
-    prop.map { text =>
-      if (text.contains("edu/illinois/ncsa/daffodil")) {
-        SDW("schemaLocation property uses deprecated edu/illinois/ncsa/daffodil path instead of org/apache/daffodil. Converting to new path.")
-        text.replace("edu/illinois/ncsa/daffodil", "org/apache/daffodil")
-      } else {
-        text
-      }
-    }
-  }
+  final lazy val schemaLocationProperty = getAttributeOption("schemaLocation")
 
   protected final def isValidURI(uri: String): Boolean = {
     try { new URI(uri) } catch { case ex: URISyntaxException => return false }
diff --git a/daffodil-lib/src/main/resources/org/apache/daffodil/xsd/built-in-formats.xsd b/daffodil-lib/src/test/resources/org/apache/daffodil/xsd/built-in-formats.xsd
similarity index 100%
rename from daffodil-lib/src/main/resources/org/apache/daffodil/xsd/built-in-formats.xsd
rename to daffodil-lib/src/test/resources/org/apache/daffodil/xsd/built-in-formats.xsd


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services