From 8112e3f200c4802462a98dcb5ddd49f34f20d906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Thu, 11 Apr 2024 10:56:14 -0300 Subject: [PATCH 1/8] (@W-15110550): remove migrator command --- README.md | 1 - .../org/mule/weave/native/NativeCliTest.scala | 17 -------- native-cli/build.gradle | 1 - .../main/java/org/mule/weave/cli/DWCLI.java | 2 - .../org/mule/weave/cli/pico/PicoMigrate.java | 41 ------------------- .../cli/commands/MigrateDW1Command.scala | 29 ------------- 6 files changed, 91 deletions(-) delete mode 100644 native-cli/src/main/java/org/mule/weave/cli/pico/PicoMigrate.java delete mode 100644 native-cli/src/main/scala/org/mule/weave/dwnative/cli/commands/MigrateDW1Command.scala diff --git a/README.md b/README.md index f60e2dd..018178c 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,6 @@ Commands: wizard Wizard actions. add Adds a new Wizard to your network of trusted wizards. validate Validate if a script is valid or not. - migrate Translates a DW1 script into a DW2 script. spell Runs the specified Spell. create Creates a new spell with the given name. list List all available spells. diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliTest.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliTest.scala index 1e9e48f..ec46ca1 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliTest.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliTest.scala @@ -24,23 +24,6 @@ class NativeCliTest extends AnyFreeSpec DEFAULT_DW_CLI_HOME.mkdirs() } - "it should execute simple migration correctly" in { - val stream: URL = getClass.getClassLoader.getResource("dw1/SimpleFile.dw1") - val file = new File(stream.toURI) - val (_, output, _) = NativeCliITTestRunner(Array("migrate", file.getAbsolutePath)).execute() - output.trim shouldBe - """ - |%dw 2.0 - |var arr = ["foo"] - |--- - |{ - | a: [0, 1, 2] contains [1, 2], - | b: sum(1 to 1000), - | c: sizeOf(("123")) - |} - |""".stripMargin.trim - } - "it should execute simple case correctly" in { val (_, output, _) = NativeCliITTestRunner(Array("run", "1 to 10")).execute() output shouldBe "[\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10\n]" diff --git a/native-cli/build.gradle b/native-cli/build.gradle index 974f8fc..cda7db2 100644 --- a/native-cli/build.gradle +++ b/native-cli/build.gradle @@ -30,7 +30,6 @@ dependencies { implementation group: 'org.mule.weave', name: 'xmlschema-module', version: weaveVersion implementation group: 'org.mule.weave', name: 'http-module', version: ioVersion implementation group: 'org.mule.weave', name: 'process-module', version: ioVersion - implementation group: 'org.mule.weave', name: 'migrant', version: '2.6.0-SNAPSHOT' implementation(group: 'org.mule.weave', name: 'http-netty-module', version: ioVersion) { exclude group: 'org.slf4j' } diff --git a/native-cli/src/main/java/org/mule/weave/cli/DWCLI.java b/native-cli/src/main/java/org/mule/weave/cli/DWCLI.java index 48e4896..ee3bd42 100644 --- a/native-cli/src/main/java/org/mule/weave/cli/DWCLI.java +++ b/native-cli/src/main/java/org/mule/weave/cli/DWCLI.java @@ -7,7 +7,6 @@ import org.mule.weave.cli.pico.PicoRepl; import org.mule.weave.cli.pico.PicoRunScript; import org.mule.weave.cli.pico.PicoRunSpell; -import org.mule.weave.cli.pico.PicoMigrate; import org.mule.weave.cli.pico.PicoUpdateSpells; import org.mule.weave.cli.pico.PicoValidateScript; import org.mule.weave.cli.pico.PicoVersionProvider; @@ -48,7 +47,6 @@ public void run(String[] args, Console console) { PicoRunScript.class, PicoWizard.class, PicoValidateScript.class, - PicoMigrate.class, PicoRunSpell.class, CommandLine.HelpCommand.class, PicoRepl.class diff --git a/native-cli/src/main/java/org/mule/weave/cli/pico/PicoMigrate.java b/native-cli/src/main/java/org/mule/weave/cli/pico/PicoMigrate.java deleted file mode 100644 index 41029bb..0000000 --- a/native-cli/src/main/java/org/mule/weave/cli/pico/PicoMigrate.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.mule.weave.cli.pico; - -import org.mule.weave.dwnative.cli.Console; -import org.mule.weave.dwnative.cli.DefaultConsole$; -import org.mule.weave.dwnative.cli.commands.MigrateDW1Command; -import picocli.CommandLine; - -import java.io.File; -import java.util.concurrent.Callable; - - -//PicCli wrapper -@CommandLine.Command( - name = "migrate", - description = "Translates a DW1 script into a DW2 script." -) -public class PicoMigrate implements Callable { - - Console console; - - @CommandLine.Parameters( - index = "0", - arity = "1", - description = "The path to the dw1 file." - ) - private File dw1File = null; - - public PicoMigrate() { - this(DefaultConsole$.MODULE$); - } - - public PicoMigrate(Console console) { - this.console = console; - } - - @Override - public Integer call() throws Exception { - MigrateDW1Command migrateDW1Command = new MigrateDW1Command(dw1File.getAbsolutePath(), console); - return migrateDW1Command.exec(); - } -} diff --git a/native-cli/src/main/scala/org/mule/weave/dwnative/cli/commands/MigrateDW1Command.scala b/native-cli/src/main/scala/org/mule/weave/dwnative/cli/commands/MigrateDW1Command.scala deleted file mode 100644 index 19a2076..0000000 --- a/native-cli/src/main/scala/org/mule/weave/dwnative/cli/commands/MigrateDW1Command.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.mule.weave.dwnative.cli.commands - -import org.mule.weave.dwnative.cli.Console -import org.mule.weave.v2.V2LangMigrant - -import java.io.File -import java.nio.charset.StandardCharsets -import scala.io.Source - -class MigrateDW1Command(val oldScriptPath: String, console: Console) extends WeaveCommand { - - def exec(): Int = { - var statusCode = ExitCodes.SUCCESS - val oldScriptFile = new File(oldScriptPath) - if (!oldScriptFile.exists()) { - console.error(s"Unable to find dw1 script to migrate") - statusCode = ExitCodes.FAILURE - } else { - val source = Source.fromFile(oldScriptFile, StandardCharsets.UTF_8.name()) - try { - val str = V2LangMigrant.migrateToV2(source.mkString) - console.out.write(str.getBytes(StandardCharsets.UTF_8)) - } finally { - source.close() - } - } - statusCode - } -} From 6ba0460e33ea25ec264822a61c5345f2e54a377d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Tue, 16 Apr 2024 17:06:31 -0300 Subject: [PATCH 2/8] ignore test with imported module --- .../test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index 9fefd95..749fd59 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -366,6 +366,7 @@ class NativeCliRuntimeIT extends AnyFunSpec "import-lib-with-alias", "import-named-lib", "import-star", + "lazy_metadata_definition", "module-singleton", "multipart-write-binary", "read-binary-files", From 0fe7c3810808ab6c42966d5412b716e5d07c5507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Tue, 16 Apr 2024 17:30:34 -0300 Subject: [PATCH 3/8] ignore test --- .../test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index 749fd59..eea4695 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -398,6 +398,7 @@ class NativeCliRuntimeIT extends AnyFunSpec Array("update-op") ++ // Take too long time Array("array-concat") ++ + Array("big_intersection") ++ Array("sql_date_mapping") ++ Array("runtime_run") From 7d0eec32c2c793043be5b7184d2f139cf4f2cf87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Tue, 16 Apr 2024 17:46:06 -0300 Subject: [PATCH 4/8] bump dw version --- .github/workflows/main.yml | 2 +- gradle.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af69fa2..62e0b8e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ env: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" - OSX_LINUX_WINDOWS: + BUILD: strategy: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] diff --git a/gradle.properties b/gradle.properties index d0c654d..b13d568 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -weaveVersion=2.7.0-SNAPSHOT -weaveTestSuiteVersion=2.7.0-SNAPSHOT +weaveVersion=2.8.0-SNAPSHOT +weaveTestSuiteVersion=2.8.0-SNAPSHOT nativeVersion=100.100.100 scalaVersion=2.12.15 ioVersion=1.0.0-SNAPSHOT From 42e37602053d2256b61202e30127ec1125b8533e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Tue, 16 Apr 2024 18:17:08 -0300 Subject: [PATCH 5/8] optimize ci --- .github/workflows/main.yml | 6 +++--- .../scala/org/mule/weave/native/NativeCliRuntimeIT.scala | 8 +++++--- native-cli/build.gradle | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62e0b8e..e24f11c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,16 +54,16 @@ jobs: #Run regression tests - name: Run regression test 2.7 run: | - ./gradlew --stacktrace -PweaveTestSuiteVersion=2.7.0-SNAPSHOT native-cli-integration-tests:test + ./gradlew --stacktrace -PweaveTestSuiteVersion=2.7.0-SNAPSHOT -DweaveSuiteVersion=2.7.0-SNAPSHOT native-cli-integration-tests:test shell: bash #Run regression tests - name: Run regression test 2.6 run: | - ./gradlew --stacktrace -PweaveTestSuiteVersion=2.6.1 native-cli-integration-tests:test + ./gradlew --stacktrace -PweaveTestSuiteVersion=2.6.1 -DweaveSuiteVersion=2.6.1 native-cli-integration-tests:test shell: bash - name: Run regression test 2.4 run: | - ./gradlew --stacktrace -PweaveTestSuiteVersion=2.4.0-HF-SNAPSHOT native-cli-integration-tests:test + ./gradlew --stacktrace -PweaveTestSuiteVersion=2.4.0-HF-SNAPSHOT -DweaveSuiteVersion=2.4.0-HF-SNAPSHOT native-cli-integration-tests:test shell: bash # Generate distro diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index eea4695..14d99dc 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -58,11 +58,11 @@ class NativeCliRuntimeIT extends AnyFunSpec private val INPUT_FILE_PATTERN = Pattern.compile("in[0-9]+\\.[a-zA-Z]+") private val OUTPUT_FILE_PATTERN = Pattern.compile("out\\.[a-zA-Z]+") - private val versionString: String = DataWeaveVersion(ComponentVersion.weaveSuiteVersion).toString() + private val versionString: String = DataWeaveVersion(System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion)).toString() val testSuites = Seq( - TestSuite("master", loadTestZipFile(s"weave-suites/runtime-${ComponentVersion.weaveSuiteVersion}-test.zip")), - TestSuite("yaml", loadTestZipFile(s"weave-suites/yaml-module-${ComponentVersion.weaveSuiteVersion}-test.zip")) + TestSuite("master", loadTestZipFile(s"weave-suites/runtime-$versionString-test.zip")), + TestSuite("yaml", loadTestZipFile(s"weave-suites/yaml-module-$versionString-test.zip")) ) private def loadTestZipFile(testSuiteExample: String): File = { @@ -72,6 +72,8 @@ class NativeCliRuntimeIT extends AnyFunSpec zipFile } + println(s"********************** Running suite with DW suite version: $versionString **********************") + testSuites.foreach { testSuite => { val wd = Files.createTempDirectory(testSuite.name).toFile diff --git a/native-cli/build.gradle b/native-cli/build.gradle index cda7db2..1acc6c2 100644 --- a/native-cli/build.gradle +++ b/native-cli/build.gradle @@ -63,7 +63,6 @@ task genVersions() { outputPrinter.println("object ComponentVersion {") outputPrinter.println("\tval weaveVersion = \"" + weaveVersion + "\"") outputPrinter.println("\tval nativeVersion = \"" + nativeVersion + "\"") - outputPrinter.println("\tval weaveSuiteVersion = \"" + weaveTestSuiteVersion + "\"") outputPrinter.println("}") outputPrinter.close() } From 6c56a8a83e6ae2d54bee885577a9368f49df707c Mon Sep 17 00:00:00 2001 From: mlischetti Date: Tue, 16 Apr 2024 18:57:39 -0300 Subject: [PATCH 6/8] Add logging --- .../scala/org/mule/weave/native/NativeCliRuntimeIT.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index 14d99dc..8563c6b 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -58,7 +58,11 @@ class NativeCliRuntimeIT extends AnyFunSpec private val INPUT_FILE_PATTERN = Pattern.compile("in[0-9]+\\.[a-zA-Z]+") private val OUTPUT_FILE_PATTERN = Pattern.compile("out\\.[a-zA-Z]+") - private val versionString: String = DataWeaveVersion(System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion)).toString() + private val weaveSuiteVersion = System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion) + + private val versionString: String = DataWeaveVersion(weaveSuiteVersion).toString() + + println(s"********************** Running suite with DW suite version: $versionString **********************") val testSuites = Seq( TestSuite("master", loadTestZipFile(s"weave-suites/runtime-$versionString-test.zip")), @@ -72,7 +76,7 @@ class NativeCliRuntimeIT extends AnyFunSpec zipFile } - println(s"********************** Running suite with DW suite version: $versionString **********************") + testSuites.foreach { testSuite => { From fa511efa4d92b1a6d8de364306d9c30b9536e922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Radunsky?= Date: Tue, 16 Apr 2024 19:06:44 -0300 Subject: [PATCH 7/8] fix version string --- .../org/mule/weave/native/NativeCliRuntimeIT.scala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index 8563c6b..7968e6c 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -58,15 +58,12 @@ class NativeCliRuntimeIT extends AnyFunSpec private val INPUT_FILE_PATTERN = Pattern.compile("in[0-9]+\\.[a-zA-Z]+") private val OUTPUT_FILE_PATTERN = Pattern.compile("out\\.[a-zA-Z]+") - private val weaveSuiteVersion = System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion) - - private val versionString: String = DataWeaveVersion(weaveSuiteVersion).toString() - - println(s"********************** Running suite with DW suite version: $versionString **********************") + private val weaveVersion = System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion) + private val versionString: String = DataWeaveVersion(weaveVersion).toString() val testSuites = Seq( - TestSuite("master", loadTestZipFile(s"weave-suites/runtime-$versionString-test.zip")), - TestSuite("yaml", loadTestZipFile(s"weave-suites/yaml-module-$versionString-test.zip")) + TestSuite("master", loadTestZipFile(s"weave-suites/runtime-$weaveVersion-test.zip")), + TestSuite("yaml", loadTestZipFile(s"weave-suites/yaml-module-$weaveVersion-test.zip")) ) private def loadTestZipFile(testSuiteExample: String): File = { @@ -76,8 +73,6 @@ class NativeCliRuntimeIT extends AnyFunSpec zipFile } - - testSuites.foreach { testSuite => { val wd = Files.createTempDirectory(testSuite.name).toFile From ff8babe1a8c8a0284a53299faded2df39035bc2a Mon Sep 17 00:00:00 2001 From: mlischetti Date: Wed, 17 Apr 2024 10:30:37 -0300 Subject: [PATCH 8/8] Ignore some tests --- native-cli-integration-tests/build.gradle | 8 +++++++- .../org/mule/weave/native/NativeCliRuntimeIT.scala | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/native-cli-integration-tests/build.gradle b/native-cli-integration-tests/build.gradle index e3ac12c..72907a6 100644 --- a/native-cli-integration-tests/build.gradle +++ b/native-cli-integration-tests/build.gradle @@ -41,4 +41,10 @@ task downloadTestSuites(type: Copy) { downloadTestSuites.dependsOn(cleanTestSuites) test.dependsOn(downloadTestSuites) -test.dependsOn(":native-cli:nativeCompile") \ No newline at end of file +test.dependsOn(":native-cli:nativeCompile") + +test { + if (System.getProperty("weaveSuiteVersion") != null) { + systemProperty "weaveSuiteVersion", System.getProperty("weaveSuiteVersion") + } +} \ No newline at end of file diff --git a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala index 7968e6c..8311cf9 100644 --- a/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala +++ b/native-cli-integration-tests/src/test/scala/org/mule/weave/native/NativeCliRuntimeIT.scala @@ -59,6 +59,7 @@ class NativeCliRuntimeIT extends AnyFunSpec private val OUTPUT_FILE_PATTERN = Pattern.compile("out\\.[a-zA-Z]+") private val weaveVersion = System.getProperty("weaveSuiteVersion", ComponentVersion.weaveVersion) + println(s"****** Running with weaveSuiteVersion: $weaveVersion *******") private val versionString: String = DataWeaveVersion(weaveVersion).toString() val testSuites = Seq( @@ -429,12 +430,17 @@ class NativeCliRuntimeIT extends AnyFunSpec Array("as-operator", "type-equality" ) ++ - Array("xml_doctype", "stringutils_unwrap") + Array("xml_doctype", "stringutils_unwrap", "weave_ast_module") } else if (versionString == "2.5") { baseArray ++ Array("xml_doctype", "stringutils_unwrap") - } - else { + } else if (versionString == "2.6") { + baseArray ++ + Array("weave_ast_module") + } else if (versionString == "2.7") { + baseArray ++ + Array("weave_ast_module") + } else { baseArray } testToIgnore