This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git


The following commit(s) were added to refs/heads/master by this push:
     new 7fac84a  Move built-in-formats.xsd to test and the backwards 
compatibility added for it
7fac84a is described below

commit 7fac84af9e9c27f3a9959bb17f86c9f05f18d728
Author: Steve Lawrence <slawre...@apache.org>
AuthorDate: Thu Feb 8 14:44:44 2018 -0500

    Move built-in-formats.xsd to test and the backwards compatibility added for 
it
    
    A handful of schemas use built-in-formats.xsd as a method to get a
    default set of DFDL properties. This used to be in the
    edu/illinois/ncsa/daffodil namespace, but was moved to
    org/apache/daffodil with the move to Apache incubation. This move would
    have broken schemas, so code was added to provide backwards
    compatability. This code essentially replaced instances of
    edu/illinois/ncsa with org/apache/daffodil, but that could break things
    if actual schema files were in edu/illinois/ncsa, which is legit and
    does happen.
    
    However, built-in-formats.xsd is intended to only be used for testing
    and not actual schemas. The GeneralPurposeFormat.xsd from IBM is
    provided for this purpose and should be used instead. So move
    built-in-format.xsd to src/test/resources and remove the broken
    backwards compatibility hack. Also update sbt subproject dependencies so
    test projects depend on the core "test" so that built-in-formats.xsd is
    on the test classpath. Also update CLI test infrastructure to modify
    DAFFODIL_CLASSPATH to include the daffodil-lib test resource directory
    for the same reason.
    
    DAFFODIL-1897
---
 build.sbt                                          |  8 ++---
 daffodil-cli/src/test/resources/clitests.tdml      | 35 ----------------------
 .../test/scala/org/apache/daffodil/CLI/Util.scala  |  8 +++--
 .../daffodil/performance/TestCLIPerformance.scala  |  5 ----
 .../apache/daffodil/saving/TestCLISaveParser.scala | 31 +++++++++++--------
 .../scala/org/apache/daffodil/dsom/IIBase.scala    | 12 +-------
 .../org/apache/daffodil/xsd/built-in-formats.xsd   |  0
 7 files changed, 30 insertions(+), 69 deletions(-)

diff --git a/build.sbt b/build.sbt
index d61bf90..7682694 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 81fcb07..0000000
--- 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 e678ab3..c2b497f 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 c3ed1d5..9d27b26 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 d327aaa..5fbe3cf 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 68dbaf7..76b138e 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

-- 
To stop receiving notification emails like this one, please contact
slawre...@apache.org.

Reply via email to