%global oname xmlsec
%global _version %(echo %{version} | tr . _ )

Name:                xml-security
Version:             2.0.6
Release:             1
Epoch:               0
Summary:             Implementation of W3C security standards for XML
License:             ASL 2.0
URL:                 http://santuario.apache.org/
Source0:             http://archive.apache.org/dist/santuario/java-library/2_0_6/xmlsec-%{version}-source-release.zip 
# Unavailable class in jetty8/9 org.eclipse.jetty.io.Buffer
Patch0:              xml-security-2.0.2-remove-Buffer.patch

BuildRequires:       maven-local mvn(commons-codec:commons-codec) mvn(junit:junit)
BuildRequires:       mvn(log4j:log4j:1.2.17) mvn(org.apache:apache:pom:)
BuildRequires:       mvn(org.apache.felix:maven-bundle-plugin) mvn(org.bouncycastle:bcprov-jdk15on)
BuildRequires:       mvn(org.codehaus.woodstox:woodstox-core-asl)
BuildRequires:       mvn(org.eclipse.jetty:jetty-server) mvn(org.eclipse.jetty:jetty-servlet)
BuildRequires:       mvn(org.eclipse.jetty:jetty-servlets)
BuildRequires:       mvn(org.jvnet.jaxb2.maven2:maven-jaxb22-plugin) mvn(org.slf4j:slf4j-api)
BuildRequires:       mvn(org.slf4j:slf4j-log4j12) mvn(xalan:xalan) mvn(xerces:xercesImpl)
BuildRequires:       mvn(xml-apis:xml-apis) mvn(xmlunit:xmlunit)
BuildArch:           noarch

%description
The XML Security project is aimed at providing implementation
of security standards for XML. Currently the focus is on the
W3C standards :
- XML-Signature Syntax and Processing; and
- XML Encryption Syntax and Processing.

%package javadoc
Summary:             Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.

%package demo
Summary:             Samples for %{name}
%description demo
Samples for %{name}.

%prep
%setup -q -n %{oname}-%{version}
%pom_xpath_set "pom:properties/pom:jetty.version" 9.0.5.v20130815
%patch0 -p0
%pom_remove_plugin :maven-pmd-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_plugin :animal-sniffer-maven-plugin
%pom_remove_plugin :maven-enforcer-plugin
%pom_xpath_remove "pom:plugin[pom:artifactId = 'maven-javadoc-plugin']/pom:executions"
%pom_xpath_set "pom:plugin[pom:groupId = 'org.jvnet.jaxb2.maven2' ]/pom:artifactId" maven-jaxb22-plugin
%pom_xpath_remove "pom:profiles/pom:profile[pom:id = 'eclipse.moxy']"
rm -r src/test/java/javax/xml/crypto/test/dsig/InteropXMLDSig11Test.java
rm -r src/test/java/javax/xml/crypto/test/dsig/PKSignatureAlgorithmTest.java \
 src/test/java/org/apache/xml/security/test/dom/algorithms/DigestAlgorithmTest.java \
 src/test/java/org/apache/xml/security/test/dom/algorithms/PKSignatureAlgorithmTest.java \
 src/test/java/org/apache/xml/security/test/dom/signature/ECDSASignatureTest.java
rm -r src/test/java/org/apache/xml/security/test/stax/signature/IAIKTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationReferenceURIResolverTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestVerificationTest.java \
 src/test/java/org/apache/xml/security/test/dom/algorithms/SymmetricEncryptionAlgorithmTest.java \
 src/test/java/org/apache/xml/security/test/dom/encryption/XMLEncryption11Test.java \
 src/test/java/org/apache/xml/security/test/stax/encryption/XMLEncryption11Test.java \
 src/test/java/org/apache/xml/security/test/stax/XMLSecurityStreamWriterTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureCreationTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureDigestCreationTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/PKSignatureVerificationTest.java \
 src/test/java/org/apache/xml/security/test/stax/transformer/TransformEnvelopedSignatureTest.java \
 src/test/java/org/apache/xml/security/test/stax/transformer/TransformIdentityTest.java \
 src/test/java/org/apache/xml/security/test/stax/XMLSecurityEventWriterTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureCreationTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureEncryptionTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/PhaosTest.java \
 src/test/java/org/apache/xml/security/test/dom/interop/BaltimoreTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/BaltimoreTest.java \
 src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionVerificationTest.java \
 src/test/java/org/apache/xml/security/test/stax/encryption/SymmetricEncryptionCreationTest.java \
 src/test/java/javax/xml/crypto/test/dsig/SignatureDigestMethodTest.java \
 src/test/java/org/apache/xml/security/test/stax/signature/SignatureVerificationTest.java \
 src/test/java/org/apache/xml/security/test/stax/XMLSecEventTest.java
rm -r src/test/java/javax/xml/crypto/test/dsig/HMACSignatureAlgorithmTest.java
rm -r src/test/java/javax/xml/crypto/test/dsig/CreateInteropXMLDSig11Test.java
%mvn_file :%{oname} %{name} %{oname}

%build
%mvn_build -f

%install
%mvn_install
chmod 644 samples/org/apache/xml/security/samples/encryption/*.java
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -pr samples/* $RPM_BUILD_ROOT%{_datadir}/%{name}

%files -f .mfiles
%license LICENSE NOTICE

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

%files demo
%{_datadir}/%{name}
%license LICENSE NOTICE

%changelog
* Mon Aug 17 2020 maminjie <maminjie1@huawei.com> - 2.0.6-1
- package init
