#Basic Information
Name:           testng
Version:        6.14.3
Release:        7
Summary:        Java-based testing framework
License:        Apache-2.0
URL:            http://testng.org/
Source0:        https://github.com/testng-team/testng/archive/%{version}/%{name}-%{version}.tar.gz
Source1:        pom.xml
Patch0:         0001-Avoid-accidental-javascript-in-javadoc.patch
Patch1:         0002-Replace-bundled-jquery-with-CDN-link.patch
# https://github.com/cbeust/testng/commit/9150736cd2c123a6a3b60e6193630859f9f0422b
Patch2:         CVE-2022-4065.patch
BuildArch:      noarch

#Dependency
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-extras.beanshell:bsh)
BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:  mvn(org.sonatype.oss:oss-parent:pom:)
BuildRequires:  mvn(org.yaml:snakeyaml)

%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}.

#Build sections
%prep
%autosetup -p1

cp %{SOURCE1} .

# remove any bundled libs, but not test resources
find ! -path "*/test/*" -name *.jar -print -delete
find -name *.class -delete

# CLEAN TARBALL
rm -rf */gradle* */kobalt*
rm -rf */src/main/resources/org/testng/jquery-*.js

# these are unnecessary
%pom_remove_plugin :maven-gpg-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_plugin :maven-javadoc-plugin

sed -i -e 's/DEV-SNAPSHOT/%{version}/' src/main/java/org/testng/internal/Version.java

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

%install
%mvn_install

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

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

%changelog
* 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

