[canl-java/epel7: 2/2] Fix test that fails when using OpenJDK 1.8 (patch from upstream git)

Mattias Ellert ellert at fedoraproject.org
Thu Jun 12 15:18:57 UTC 2014


commit e0e91b0045d7feca2e03d2794bf0157e09fa3c10
Author: Mattias Ellert <mattias.ellert at fysast.uu.se>
Date:   Thu Jun 12 15:51:30 2014 +0200

    Fix test that fails when using OpenJDK 1.8 (patch from upstream git)

 canl-java-sha224-test.patch |   50 +++++++++++++++++++++++++++++++++++++++++++
 canl-java.spec              |   13 +++++++++-
 2 files changed, 61 insertions(+), 2 deletions(-)
---
diff --git a/canl-java-sha224-test.patch b/canl-java-sha224-test.patch
new file mode 100644
index 0000000..dfdf9bb
--- /dev/null
+++ b/canl-java-sha224-test.patch
@@ -0,0 +1,50 @@
+diff --git a/src/test/java/eu/emi/security/authn/x509/proxy/ProxyGenerationTest.java b/src/test/java/eu/emi/security/authn/x509/proxy/ProxyGenerationTest.java
+index 242ce75..35307d8 100644
+--- a/src/test/java/eu/emi/security/authn/x509/proxy/ProxyGenerationTest.java
++++ b/src/test/java/eu/emi/security/authn/x509/proxy/ProxyGenerationTest.java
+@@ -13,12 +13,13 @@ import java.security.cert.X509Certificate;
+ import java.security.interfaces.RSAPublicKey;
+ import java.util.Collections;
+ import java.util.Date;
++import java.util.HashSet;
++import java.util.Set;
+ import java.util.concurrent.TimeUnit;
+ 
+ import javax.security.auth.x500.X500Principal;
+ 
+ import junit.framework.Assert;
+-
+ import static org.junit.Assert.*;
+ 
+ import org.bouncycastle.asn1.x500.X500Name;
+@@ -366,13 +367,13 @@ public class ProxyGenerationTest
+ 	{
+ 		System.out.println("Running func:cli-srv-sha2 functional test");
+ 
+-		testSha2Proxy("1.2.840.113549.1.1.14", "keystore-sha224.pem");
+-		testSha2Proxy("SHA256withRSA", "keystore-sha256.pem");
+-		testSha2Proxy("SHA384withRSA", "keystore-sha384.pem");
+-		testSha2Proxy("SHA512withRSA", "keystore-sha512.pem");
++		testSha2Proxy("keystore-sha224.pem", "1.2.840.113549.1.1.14", "SHA224withRSA");
++		testSha2Proxy("keystore-sha256.pem", "SHA256withRSA");
++		testSha2Proxy("keystore-sha384.pem", "SHA384withRSA");
++		testSha2Proxy("keystore-sha512.pem", "SHA512withRSA");
+ 	}	
+ 
+-	private void testSha2Proxy(String algName, String fileName) throws Exception
++	private void testSha2Proxy(String fileName, String... algName) throws Exception
+ 	{
+ 		X509Credential credential = new PEMCredential("src/test/resources/test-pems/"+fileName,
+ 				"qwerty".toCharArray());
+@@ -384,7 +385,10 @@ public class ProxyGenerationTest
+ 		
+ 		ProxyCertificate proxy1 = ProxyGenerator.generate(param, privateKey);
+ 		X509Certificate proxy = proxy1.getCertificateChain()[0];
+-		assertEquals(algName, proxy.getSigAlgName());
++		
++		Set<String> validNames = new HashSet<String>();
++		Collections.addAll(validNames, algName);
++		assertTrue(proxy.getSigAlgName(), validNames.contains(proxy.getSigAlgName()));
+ 		
+ 		X509CertChainValidator v = new DirectoryCertChainValidator(
+ 				Collections.singletonList("src/test/resources/rollover/openssl-trustdir/77ab7b18.0"), 
diff --git a/canl-java.spec b/canl-java.spec
index 42dd374..4abac44 100644
--- a/canl-java.spec
+++ b/canl-java.spec
@@ -1,6 +1,6 @@
 Name:		canl-java
 Version:	2.1.0
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	EMI Common Authentication library - bindings for Java
 
 #		The main parts of the code are BSD
@@ -13,6 +13,9 @@ URL:		https://github.com/eu-emi/%{name}/
 Source0:	https://github.com/eu-emi/%{name}/archive/canl-%{version}.tar.gz
 #		Disable tests that require network connections
 Patch0:		%{name}-test.patch
+#		Fix for failing test when using OpenJDK 1.8
+#		Patch from upstream git diff 61fd45f..5644961
+Patch1:		%{name}-sha224-test.patch
 BuildArch:	noarch
 BuildRequires:	maven-local
 BuildRequires:	java-devel >= 1:1.6
@@ -20,7 +23,6 @@ BuildRequires:	mvn(commons-io:commons-io)
 BuildRequires:	mvn(junit:junit)
 BuildRequires:	mvn(org.bouncycastle:bcpkix-jdk15on)
 BuildRequires:	mvn(org.bouncycastle:bcprov-jdk15on)
-BuildRequires:	mvn(org.sonatype.oss:oss-parent)
 
 %description
 This is the Java part of the EMI caNl -- the Common Authentication Library.
@@ -34,6 +36,7 @@ Javadoc documentation for EMI caNl.
 %prep
 %setup -q -n %{name}-canl-%{version}
 %patch0 -p1
+%patch1 -p1
 
 # Remove maven-wagon-webdav-jackrabbit dependency
 %pom_xpath_remove pom:build/pom:extensions
@@ -41,6 +44,9 @@ Javadoc documentation for EMI caNl.
 # GPG signing requires a GPG key
 %pom_remove_plugin org.apache.maven.plugins:maven-gpg-plugin
 
+# Avoid build dependency bloat
+%pom_remove_parent
+
 %build
 %mvn_build
 
@@ -55,6 +61,9 @@ Javadoc documentation for EMI caNl.
 %doc LICENSE.txt
 
 %changelog
+* Wed Jun 11 2014 Mattias Ellert <mattias.ellert at fysast.uu.se> - 2.1.0-3
+- Fix test that fails when using OpenJDK 1.8 (patch from upstream git)
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.1.0-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list