use of org.apache.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildClientOptionsBase.
@Test
public void testbuildClientOptionsBase() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseSTORE_PKCS12.
@Test
public void testbuildClientOptionsBaseSTORE_PKCS12() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
new MockUp<SSLOption>() {
@Mock
public String getTrustStoreType() {
return "PKCS12";
}
};
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildClientOptionsBaseFileNull.
@Test
public void testbuildClientOptionsBaseFileNull() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
option.setKeyStore(null);
option.setTrustStore(null);
option.setCrl(null);
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class TestVertxTLSBuilder method testbuildHttpClientOptions.
@Test
public void testbuildHttpClientOptions() {
SSLOption option = SSLOption.buildFromYaml("rest.consumer");
SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass());
HttpClientOptions serverOptions = new HttpClientOptions();
VertxTLSBuilder.buildHttpClientOptions(option, custom, serverOptions);
Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1);
Assert.assertEquals(serverOptions.isTrustAll(), true);
}
use of org.apache.servicecomb.foundation.ssl.SSLCustom in project java-chassis by ServiceComb.
the class VertxTLSBuilder method buildHttpClientOptions.
public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) {
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(sslKey);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
buildHttpClientOptions(sslOption, sslCustom, httpClientOptions);
}
Aggregations