diff --git a/exaudfclient/base/javacontainer/test/BUILD b/exaudfclient/base/javacontainer/test/BUILD index 36fb36203..62f1ba4b0 100644 --- a/exaudfclient/base/javacontainer/test/BUILD +++ b/exaudfclient/base/javacontainer/test/BUILD @@ -28,7 +28,7 @@ cc_test( cc_test( name = "javacontainer-test-ctpg-parser", - srcs = JAVACONTAINER_TEST_SRCS + ["cpp/javacontainer_ctpg_test.cc"], + srcs = JAVACONTAINER_TEST_SRCS + ["cpp/javacontainer_extractor_v2_test.cc"], deps = [ "//base/javacontainer:javacontainer", "@googletest//:gtest_main", diff --git a/exaudfclient/base/javacontainer/test/cpp/javacontainer_ctpg_test.cc b/exaudfclient/base/javacontainer/test/cpp/javacontainer_extractor_v2_test.cc similarity index 91% rename from exaudfclient/base/javacontainer/test/cpp/javacontainer_ctpg_test.cc rename to exaudfclient/base/javacontainer/test/cpp/javacontainer_extractor_v2_test.cc index dcc67a201..ec615b637 100644 --- a/exaudfclient/base/javacontainer/test/cpp/javacontainer_ctpg_test.cc +++ b/exaudfclient/base/javacontainer/test/cpp/javacontainer_extractor_v2_test.cc @@ -110,19 +110,3 @@ TEST(JavaContainer, import_script_with_escaped_options) { "-XX:+UseSerialGC" }; EXPECT_EQ(vm.getJavaVMInternalStatus().m_jvmOptions, expectedJVMOptions); } - -TEST(JavaContainer, basic_jars_order_remains) { - const std::string script_code = "%jar base/javacontainer/test/test1.jar:base/javacontainer/test/abc.jar;"; - - EXPECT_THROW({ - try - { - JavaVMTest vm(script_code); - } - catch( const SWIGVMContainers::JavaVMach::exception& e ) - { - EXPECT_THAT( e.what(), MatchesRegex("^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$")); - throw; - } - }, SWIGVMContainers::JavaVMach::exception ); -} \ No newline at end of file diff --git a/exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc b/exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc index 3ea3a28ce..0d0e774b7 100644 --- a/exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc +++ b/exaudfclient/base/javacontainer/test/cpp/javacontainer_test.cc @@ -67,6 +67,35 @@ TEST(JavaContainer, basic_jar_with_white_spaces) { #endif } +TEST(JavaContainer, basic_jars_ordering) { + /* + * This test validates correct behavior of collecting the %jar options in Extractor V1/V2. + * Both jar files referenced in `script_code` do not exist. + * The JavaVM will throw an exception with the first JAR file it gets from Extractor. + * For extractor V21 Our assumption is that the exception will be for `base/javacontainer/test/abc.jar` + * as this is alphabetically the first JAR file. (re-ordering) + * For extractor V2: Our assumption is that the exception will be for `base/javacontainer/test/test1.jar` + * as this is the first JAR file. (no re-ordering) + */ + const std::string script_code = "%jar base/javacontainer/test/test1.jar:base/javacontainer/test/abc.jar;"; + +#ifndef USE_CTPG_PARSER + const char* regexExpectedException = "^.*Java VM cannot find 'base/javacontainer/test/abc\\.jar': No such file or directory$"; +#else + const char* regexExpectedException = "^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$"; +#endif + EXPECT_THROW({ + try + { + JavaVMTest vm(script_code); + } + catch( const SWIGVMContainers::JavaVMach::exception& e ) + { + EXPECT_THAT( e.what(), MatchesRegex("^.*Java VM cannot find 'base/javacontainer/test/test1\\.jar': No such file or directory$")); + throw; + } + }, SWIGVMContainers::JavaVMach::exception ); +} TEST(JavaContainer, basic_inline) { const std::string script_code = "import java.time.LocalDateTime;" diff --git a/exaudfclient/docs/java_script_options_parser.drawio b/exaudfclient/docs/java_script_options_parser.drawio new file mode 100644 index 000000000..251ff7bc8 --- /dev/null +++ b/exaudfclient/docs/java_script_options_parser.drawio @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/exaudfclient/docs/java_script_options_parser.drawio.png b/exaudfclient/docs/java_script_options_parser.drawio.png new file mode 100644 index 000000000..fc5e3cbc9 Binary files /dev/null and b/exaudfclient/docs/java_script_options_parser.drawio.png differ