mirror of https://github.com/apache/poi.git
Do not fail TestSignatureInfo when the current JDK does not have all the necessary setup
Let's gracefully handle some expected failures with some versions of the JDK to not have flaky/failing test for users who just want to recompile POI themselves. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896598 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3e66ca24b2
commit
6de48ada57
|
@ -43,6 +43,7 @@ import java.net.MalformedURLException;
|
|||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
|
@ -823,7 +824,14 @@ class TestSignatureInfo {
|
|||
assertNotNull(pkg);
|
||||
|
||||
DummyKeystore ks = new DummyKeystore("test");
|
||||
KeyCertPair certPair = ks.addEntryFromPEM(testdata.getFile(pemFile), "test");
|
||||
final KeyCertPair certPair;
|
||||
try {
|
||||
certPair = ks.addEntryFromPEM(testdata.getFile(pemFile), "test");
|
||||
} catch (KeyStoreException e) {
|
||||
// some JDKs do not have the proper setup, let's avoid strange test-failures due to this
|
||||
assumeTrue(e.getMessage().startsWith("unrecognized algorithm name: PBEWithSHA1AndDESede"));
|
||||
throw e;
|
||||
}
|
||||
|
||||
SignatureConfig config = new SignatureConfig();
|
||||
config.setKey(certPair.getKey());
|
||||
|
@ -870,7 +878,14 @@ class TestSignatureInfo {
|
|||
@Test
|
||||
void createXAdES_T_65623() throws Exception {
|
||||
DummyKeystore ks = new DummyKeystore(STORE_PASS);
|
||||
KeyCertPair certPair = ks.createDummyKey();
|
||||
final KeyCertPair certPair;
|
||||
try {
|
||||
certPair = ks.createDummyKey();
|
||||
} catch (KeyStoreException e) {
|
||||
// some JDKs do not have the proper setup, let's avoid strange test-failures due to this
|
||||
assumeTrue(e.getMessage().startsWith("unrecognized algorithm name: PBEWithSHA1AndDESede"));
|
||||
throw e;
|
||||
}
|
||||
|
||||
UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream();
|
||||
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
||||
|
@ -1050,7 +1065,14 @@ class TestSignatureInfo {
|
|||
@Test
|
||||
void commitmentType65672() throws Exception {
|
||||
DummyKeystore ks = new DummyKeystore(STORE_PASS);
|
||||
KeyCertPair certPair = ks.createDummyKey();
|
||||
final KeyCertPair certPair;
|
||||
try {
|
||||
certPair = ks.createDummyKey();
|
||||
} catch (KeyStoreException e) {
|
||||
// some JDKs do not have the proper setup, let's avoid strange test-failures due to this
|
||||
assumeTrue(e.getMessage().startsWith("unrecognized algorithm name: PBEWithSHA1AndDESede"));
|
||||
throw e;
|
||||
}
|
||||
|
||||
UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream();
|
||||
try (XSSFWorkbook wb = new XSSFWorkbook()) {
|
||||
|
@ -1086,7 +1108,7 @@ class TestSignatureInfo {
|
|||
|
||||
private SignatureConfig prepareConfig(String pfxInput) throws Exception {
|
||||
DummyKeystore ks = (pfxInput == null) ? new DummyKeystore(STORE_PASS) : new DummyKeystore(pfxInput, STORE_PASS);
|
||||
KeyCertPair certPair = ks.createDummyKey();;
|
||||
KeyCertPair certPair = ks.createDummyKey();
|
||||
|
||||
SignatureConfig signatureConfig = new SignatureConfig();
|
||||
signatureConfig.setKey(certPair.getKey());
|
||||
|
|
Loading…
Reference in New Issue