CommonTrustedCertificateSource extends CommonCertificateSource { public void importAsTrusted(final CertificateSource certificateSource) { final List<CertificateToken> certTokenList = certificateSource.getCertificates(); for (final CertificateToken certToken : certTokenList) { addCertificate(certToken); } } CommonTrustedCertificateSource(); @Override CertificateSourceType getCertificateSourceType(); void importAsTrusted(final CertificateSource certificateSource); List<TrustProperties> getTrustServices(CertificateToken token); List<String> getAlternativeOCSPUrls(CertificateToken trustAnchor); List<String> getAlternativeCRLUrls(CertificateToken trustAnchor); @Override boolean isTrusted(CertificateToken certificateToken);  }
@Test public void importKeyStore() throws IOException { CommonTrustedCertificateSource ctcs = new CommonTrustedCertificateSource(); KeyStoreCertificateSource keyStore = new KeyStoreCertificateSource("src/test/resources/keystore.jks", "JKS", "dss-password"); ctcs.importAsTrusted(keyStore); List<CertificateToken> certificates = ctcs.getCertificates(); assertTrue(Utils.isCollectionNotEmpty(certificates)); for (CertificateToken certificateToken : certificates) { assertEquals(SignatureValidity.NOT_EVALUATED, certificateToken.getSignatureValidity()); } }