SSLCertificateLoader implements Serializable { public List<CertificateToken> getCertificates(final String urlString) throws DSSException { if (Protocol.isHttpUrl(urlString)) { Certificate[] httpGetCertificates = httpGetCertificates(urlString); return toCertificateTokens(httpGetCertificates); } throw new DSSException("DSS framework only supports HTTP(S) certificate extraction"); }  void setCommonsDataLoader(CommonsDataLoader commonsDataLoader); List<CertificateToken> getCertificates(final String urlString);  }
@Test public void test() throws Exception { String url = "https: SSLCertificateLoader sslCertificateDataLoader = new SSLCertificateLoader(); List<CertificateToken> certificateTokens = sslCertificateDataLoader.getCertificates(url); assertTrue(Utils.isCollectionNotEmpty(certificateTokens)); }
@Test public void wrongUrl() throws Exception { String url = "https: SSLCertificateLoader sslCertificateDataLoader = new SSLCertificateLoader(); DSSException exception = assertThrows(DSSException.class, () -> sslCertificateDataLoader.getCertificates(url)); assertTrue(exception.getMessage().contains("Unable to process GET call for url [https: }
@Test public void ldapUrl() throws Exception { String url = "ldap: SSLCertificateLoader sslCertificateDataLoader = new SSLCertificateLoader(); DSSException exception = assertThrows(DSSException.class, () -> sslCertificateDataLoader.getCertificates(url)); assertEquals("DSS framework only supports HTTP(S) certificate extraction", exception.getMessage()); }