am 183efbb4: am 4629f94a: am e0350a80: am afd7d947: Merge "JarFile: make test chain 3 long" into jb-dev
* commit '183efbb4572a940999c601e4407037c1339b8934':
JarFile: make test chain 3 long
diff --git a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
index cd8c172..80ec0f3 100644
--- a/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
+++ b/luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
@@ -30,6 +30,7 @@
import java.net.URL;
import java.security.Permission;
import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Vector;
@@ -621,25 +622,36 @@
public void testJarFile_Signed_ValidChain_NoCheck() throws Exception {
Certificate[] certs = getSignedJarCerts(VALID_CHAIN_JAR, false);
assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 2, certs.length);
+ assertEquals(Arrays.deepToString(certs), 3, certs.length);
+ assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
+ assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
}
public void testJarFile_Signed_ValidChain_Check() throws Exception {
Certificate[] certs = getSignedJarCerts(VALID_CHAIN_JAR, true);
assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 2, certs.length);
+ assertEquals(Arrays.deepToString(certs), 3, certs.length);
+ assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
+ assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
}
public void testJarFile_Signed_InvalidChain_NoCheck() throws Exception {
Certificate[] certs = getSignedJarCerts(INVALID_CHAIN_JAR, false);
assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 2, certs.length);
+ assertEquals(Arrays.deepToString(certs), 3, certs.length);
+ assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
+ assertEquals("CN=root1", ((X509Certificate) certs[2]).getSubjectDN().toString());
}
public void testJarFile_Signed_InvalidChain_Check() throws Exception {
Certificate[] certs = getSignedJarCerts(INVALID_CHAIN_JAR, true);
assertNotNull(certs);
- assertEquals(Arrays.deepToString(certs), 1, certs.length);
+ assertEquals(Arrays.deepToString(certs), 2, certs.length);
+ assertEquals("CN=fake-chain", ((X509Certificate) certs[0]).getSubjectDN().toString());
+ assertEquals("CN=intermediate1", ((X509Certificate) certs[1]).getSubjectDN().toString());
}
/*
diff --git a/support/src/test/java/tests/resources/hyts_signed_invalidChain.jar b/support/src/test/java/tests/resources/hyts_signed_invalidChain.jar
index 2472dae..23d7ae8 100644
--- a/support/src/test/java/tests/resources/hyts_signed_invalidChain.jar
+++ b/support/src/test/java/tests/resources/hyts_signed_invalidChain.jar
Binary files differ
diff --git a/support/src/test/java/tests/resources/hyts_signed_validChain.jar b/support/src/test/java/tests/resources/hyts_signed_validChain.jar
index 67f3e87..d1f4c56 100644
--- a/support/src/test/java/tests/resources/hyts_signed_validChain.jar
+++ b/support/src/test/java/tests/resources/hyts_signed_validChain.jar
Binary files differ