• [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run test

    From Volkmar W. Pogatzki@21:1/5 to All on Thu Sep 28 07:20:01 2023
    The etestng function is presently limited to running test classes and
    has no option for running testng.xml files. Using testng.xml in an
    ebuild requires manual coding in src_test().

    This change adds a switch to the etestng function which allows running
    default src_test() with either testng.xml files or test classes.

    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    ---
    eclass/java-utils-2.eclass | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
    index c1f42408e462..3fe64e1c317d 100644
    --- a/eclass/java-utils-2.eclass
    +++ b/eclass/java-utils-2.eclass
    @@ -1886,7 +1886,7 @@ ejunit4() {
    # @CODE
    # $1 - -cp or -classpath
    # $2 - the classpath passed to it
    -# $@ - test classes for testng to run.
    +# $@ - test classes or testng.xml for testng to run.
    # @CODE
    etestng() {
    debug-print-function ${FUNCNAME} $*
    @@ -1910,6 +1910,7 @@ etestng() {
    -cp ${cp}
    -Djava.io.tmpdir="${T}"
    -Djava.awt.headless=true
    + -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}"
    ${JAVA_TEST_EXTRA_ARGS[@]}
    ${runner}
    ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
    @@ -1922,7 +1923,11 @@ etestng() {
    )
    fi

    - args+=( -testclass ${tests} )
    + if [[ "${test%.xml}" == "${test}" ]]; then
    + args+=( -testclass ${tests} )
    + else
    + args+=( ${tests%,} )
    + fi

    debug-print "java ${args[@]}"
  • From Volkmar W. Pogatzki@21:1/5 to All on Thu Sep 28 07:20:01 2023
    This change depends on the correlating change on the
    java-pkg-simple.eclass.

    For testing dev-java/testng before having it installed it is not
    possible to use java-pkg_getjars. This change adds a condition so
    that this case uses the freshly compiled testng.jar.

    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    ---
    eclass/java-utils-2.eclass | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
    index 3fe64e1c317d..133dde59cebd 100644
    --- a/eclass/java-utils-2.eclass
    +++ b/eclass/java-utils-2.eclass
    @@ -1892,7 +1892,11 @@ etestng() {
    debug-print-function ${FUNCNAME} $*

    local runner=org.testng.TestNG
    - local cp=$(java-pkg_getjars --with-dependencies testng)
    + if [[ ${PN} != testng ]]; then
    + local cp=$(java-pkg_getjars --with-dependencies testng)
    + else
    + local cp=testng.jar
    + fi
    local tests

    if [[ ${1} = -cp || ${1} = -classpath ]]; then
    --
    2.41.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Volkmar W. Pogatzki@21:1/5 to All on Thu Sep 28 07:20:01 2023
    Presently, when using testng in JAVA_TESTING_FRAMEWORKS, it gets added
    to test dependencies. Emerging dev-java/testng with USE=test would lead
    to a reverse dependency on itself.

    This change allows emerging / testing testng with the ebuild specifying JAVA_TESTING_FRAMEWORKS="testng" without such reverse dependency.

    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    ---
    eclass/java-pkg-simple.eclass | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)

    diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass index abac18ca03f8..0ca0914aeee0 100644
    --- a/eclass/java-pkg-simple.eclass
    +++ b/eclass/java-pkg-simple.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2004-2022 Gentoo Authors
    +# Copyright 2004-2023 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: java-pkg-simple.eclass
    @@ -47,7 +47,8 @@ if has test ${JAVA_PKG_IUSE}; then
    test_deps+=" amd64? ( dev-util/pkgdiff
    dev-util/japi-compliance-checker )";;
    testng)
    - test_deps+=" dev-java/testng:0";;
    + [[ ${PN} != testng ]] && \
    + test_deps+=" dev-java/testng:0";;
    esac
    done
    [[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
    --
    2.41.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Volkmar W. Pogatzki@21:1/5 to All on Thu Sep 28 07:20:01 2023
    - switches slot of dependency assertj-core 2 -> 3
    - removes test restriction
    - moves "test" from IUSE to JAVA_PKG_IUSE
    - sets the "-verbose 3" option to get the PASSED/FAILED information
    - uses older version of jcommander 0 -> 1.64
    - uses the DOCS array instead of dodoc
    - uses JAVA_RESOURCE_DIRS instead of java-pkg_addres which allows
    removing src_compile()
    - chops long lines
    - adds MAVEN_ID so that java-ebuilder can find it

    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>

    dev-java/testng: fixup

    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    ---
    dev-java/testng/Manifest | 5 ++
    dev-java/testng/metadata.xml | 2 +-
    dev-java/testng/testng-6.11.ebuild | 100 +++++++++++++++++++++++++++++
    3 files changed, 106 insertions(+), 1 deletion(-)
    create mode 100644 dev-java/testng/testng-6.11.ebuild

    diff --git a/dev-java/testng/Manifest b/dev-java/testng/Manifest
    index 310f28a1c68c..aaf68f18ad4d 100644
    --- a/dev-java/testng/Manifest
    +++ b/dev-java/testng/Manifest
    @@ -1 +1,6 @@
    +DIST apache-groovy-binary-2.4.21.zip 37467992 BLAKE2B e0f925bad53f0f8a7012f0bea420ec3e5986118cc23cd677a11f619284754eacc15c3012cf780063fef574053781bba924a86e5fa2ac284d86f349ad18173704 SHA512
    e2f73405d7521b99e3ce5622cffcc505bbc039ccb1c35696fc895d648a9325937a136cf97a229f7ac1b90b63ad8603881350c4d41e514ad45233fb333d76d510
    +DIST groovy-all-2.4.7.jar 7015434 BLAKE2B 23d22ddd78229c485ed9384169acee154258644249b856661e17d1d0efb5518e32473a26962b5d657a09b41d490813ed76254820ffdf39e83869209617b66c2d SHA512
    4c26ff9f7137c0506c95f7ba1d4228ce57e16d87b77dd1d1143902