@@ -21,19 +21,20 @@ import org.mule.weave.v2.parser.ast.header.directives.OutputDirective
2121import org .mule .weave .v2 .parser .ast .structure .StringNode
2222import org .mule .weave .v2 .sdk .ParsingContextFactory
2323import org .mule .weave .v2 .sdk .WeaveResourceFactory
24+ import org .mule .weave .v2 .utils .DataWeaveVersion
2425import org .mule .weave .v2 .utils .StringHelper .toStringTransformer
26+ import org .mule .weave .v2 .version .ComponentVersion
2527import org .scalatest .Assertion
2628import org .scalatest .FunSpec
2729import org .scalatest .Matchers
30+ import sun .net .www .protocol .file .FileURLConnection
2831
2932import java .io .ByteArrayInputStream
3033import java .io .File
3134import java .io .FileFilter
3235import java .io .FileInputStream
3336import java .io .IOException
3437import java .io .InputStream
35- import java .net .JarURLConnection
36- import java .nio .charset .Charset
3738import java .nio .charset .StandardCharsets
3839import java .nio .file .Files
3940import java .nio .file .Path
@@ -45,8 +46,6 @@ import javax.mail.util.ByteArrayDataSource
4546import scala .collection .JavaConverters ._
4647import scala .io .BufferedSource
4748import scala .io .Source
48- import scala .io .Source .fromFile
49- import scala .util .Try
5049
5150class NativeCliRuntimeIT extends FunSpec
5251 with Matchers
@@ -56,20 +55,19 @@ class NativeCliRuntimeIT extends FunSpec
5655
5756 private val TIMEOUT : (Int , TimeUnit ) = (30 , TimeUnit .SECONDS )
5857 private val INPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern .compile(" in[0-9]+-config\\ .properties" )
59- private val OUTPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern .compile(" out[0-9]+ -config\\ .properties" )
58+ private val OUTPUT_FILE_CONFIG_PROPERTY_PATTERN = Pattern .compile(" out[0-9]* -config\\ .properties" )
6059 private val INPUT_FILE_PATTERN = Pattern .compile(" in[0-9]+\\ .[a-zA-Z]+" )
6160 private val OUTPUT_FILE_PATTERN = Pattern .compile(" out\\ .[a-zA-Z]+" )
6261
63- val testSuites =
64- Seq (
65- TestSuite (" master" , loadTestZipFile(" access_raw_value" )),
66- TestSuite (" yaml" , loadTestZipFile(" comments" ))
62+ val testSuites = Seq (
63+ TestSuite (" master" , loadTestZipFile(s " weave-suites/runtime- ${ComponentVersion .weaveSuiteVersion}-test.zip " )),
64+ TestSuite (" yaml" , loadTestZipFile(s " weave-suites/yaml-module- ${ComponentVersion .weaveSuiteVersion}-test.zip " ))
6765 )
6866
6967 private def loadTestZipFile (testSuiteExample : String ): File = {
7068 val url = getResource(testSuiteExample)
71- val connection = url.openConnection.asInstanceOf [JarURLConnection ]
72- val zipFile = new File (connection.getJarFileURL .toURI)
69+ val connection = url.openConnection.asInstanceOf [FileURLConnection ]
70+ val zipFile = new File (connection.getURL .toURI)
7371 zipFile
7472 }
7573
@@ -209,6 +207,9 @@ class NativeCliRuntimeIT extends FunSpec
209207 throw ioe
210208 }
211209
210+ val languageLevel = DataWeaveVersion (ComponentVersion .weaveSuiteVersion).toString()
211+ args = args :+ " --language-level" :+ languageLevel
212+
212213 args = args :+ " -f"
213214 args = args :+ cliTransform.getAbsolutePath
214215
@@ -354,7 +355,7 @@ class NativeCliRuntimeIT extends FunSpec
354355
355356 override def ignoreTests (): Array [String ] = {
356357 // Encoding issues
357- Array (" csv-invalid-utf8" ) ++
358+ val baseArray = Array (" csv-invalid-utf8" ) ++
358359 // Fail in java11 because broken backwards
359360 Array (" coerciones_toString" , " date-coercion" ) ++
360361 // Use resources (dwl files) that is present in the Tests but not in Cli (e.g: org::mule::weave::v2::libs::)
@@ -382,6 +383,7 @@ class NativeCliRuntimeIT extends FunSpec
382383 " runtime_run_coercionException" ,
383384 " runtime_run_fibo" ,
384385 " runtime_run_null_java" ,
386+ " sql_date_mapping" ,
385387 " write-function-with-null"
386388 ) ++
387389 // Multipart Object has empty `parts` and expects at least one part
@@ -395,6 +397,36 @@ class NativeCliRuntimeIT extends FunSpec
395397 // Take too long time
396398 Array (" array-concat" ) ++
397399 Array (" runtime_run" )
400+
401+ if (DataWeaveVersion (ComponentVersion .weaveSuiteVersion).toString() == " 2.4" ) {
402+ baseArray ++
403+ // A change to json streaming in 2.5.0 breaks this test
404+ Array (" default_with_extended_null_type" ) ++
405+ // Change in validations in 2.5.0 breaks these tests
406+ Array (" logical-and" ,
407+ " logical-or"
408+ ) ++
409+ Array (" coerciones_toBinary" ) ++
410+ // 2.5.0 dwl now prints metadata breaking these tests
411+ Array (" dfl-inline-default-namespace" ,
412+ " dfl-inline-namespace" ,
413+ " dfl-maxCollectionSize" ,
414+ " dfl-overwrite-namespace" ,
415+ " multipart-base64-to-multipart" ,
416+ " xml-nill-multiple-attributes-nested" ,
417+ " xml-nill-multiple-attributes" ,
418+ " read_scalar_values"
419+ ) ++
420+ // A change of positions on dw::Core 2.5.0 breaks this test
421+ Array (
422+ " runtime_run_unhandled_compilation_exception"
423+ ) ++
424+ Array (" as-operator" ,
425+ " type-equality"
426+ )
427+ } else {
428+ baseArray
429+ }
398430 }
399431}
400432
0 commit comments