%bcond_with bootstrap

Name:           testng
Version:        7.8.0
Release:        2
Summary:        Java-based testing framework
License:        Apache-2.0
URL:            http://testng.org/

# ./generate-tarball.sh
Source0:        %{name}-%{version}.tar.gz
# Allows building with maven instead of gradle
Source1:        https://repo1.maven.org/maven2/org/testng/testng/%{version}/testng-%{version}.pom
# Remove bundled binaries to make sure we don't ship anything forbidden
Source2:        generate-tarball.sh

Patch0:         0001-Avoid-accidental-javascript-in-javadoc.patch
Patch1:         0002-Replace-bundled-jquery-with-CDN-link.patch
BuildArch:      noarch


%if %{with bootstrap}
BuildRequires:  javapackages-bootstrap
%else
BuildRequires:  maven-local
BuildRequires:  mvn(com.beust:jcommander)
BuildRequires:  mvn(com.google.inject:guice)
BuildRequires:  mvn(com.google.code.findbugs:jsr305)
BuildRequires:  mvn(junit:junit)
BuildRequires:  mvn(org.apache.ant:ant)
BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:  mvn(org.yaml:snakeyaml)
%endif

%description
TestNG is a testing framework inspired from JUnit and NUnit but introducing
some new functionality that make it more powerful and easier to use, such as:
  * Annotations.
  * Run your tests in arbitrarily big thread pools with various policies
    available (all methods in their own thread, one thread per test class, etc...).
  * Test that your code is multithread safe.
  * Flexible test configuration.
  * Support for data-driven testing (with @DataProvider).
  * Support for parameters.
  * Powerful execution model (no more TestSuite).
  * Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
  * Embeds BeanShell for further flexibility.
  * Default JDK functions for runtime and logging (no dependencies).
  * Dependent methods for application server testing.

%package javadoc
Summary:        API documentation for %{name}

%description javadoc
This package contains the API documentation for %{name}.

%prep
%autosetup -n %{name}-%{version} -p1
cp %{SOURCE1} pom.xml
rm -r testng-test-osgi
find . -mindepth 2 -name 'src' -type d -exec cp -r -t . {} +
find ! -path '*/test/*' -name '*.jar' -print -delete
find -name '*.class' -delete
%pom_remove_dep org.webjars:jquery
cp -p ./src/main/java/*.dtd.html ./src/main/resources/.

%mvn_file : %{name}
# jdk15 classifier is used by some other packages
%mvn_alias : :::jdk15:

%build
%mvn_build -f -- -Dmaven.compiler.release=11 

%install
%mvn_install

%files -f .mfiles
%doc CHANGES.txt README.md
%license LICENSE.txt

%files javadoc -f .mfiles-javadoc
%license LICENSE.txt

%changelog
* Tue Sep 01 2026 Ge Wang <wang__ge@126.com> - 7.8.0-2
- Add buildrequire snakeyaml

* Thu Feb 05 2026 xu_ping <707078654@qq.com> - 7.8.0-1
- Update to version 7.8.0

* Fri Nov 29 2024 Ge Wang <wang__ge@126.com> - 7.5.1-1
- Update to version 7.5.1

* Mon Dec 04 2023 yaoxin <yao_xin001@hoperun.com> - 6.14.3-7
- Fix CVE-2022-4065 and change Source0

* Fri Dec 06 2019 openEuler Buildteam <buildteam@openeuler.org> - 6.14.3-6
- Package init