use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method equalsToConsidersProtocols.
@Test
public void equalsToConsidersProtocols() throws Exception {
TlsSettings tlsSettings1 = new TlsSettings.Builder().protocols(List.of("TLSv1", "TLSv1.1")).build();
TlsSettings tlsSettings2 = new TlsSettings.Builder().build();
assertThat(tlsSettings1.equals(tlsSettings2), is(false));
tlsSettings1 = new TlsSettings.Builder().protocols(List.of("TLSv1", "TLSv1.1")).build();
tlsSettings2 = new TlsSettings.Builder().protocols(List.of("TLSv1", "TLSv1.1")).build();
assertThat(tlsSettings1.equals(tlsSettings2), is(true));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method equalsToConsidersCipherSuites.
@Test
public void equalsToConsidersCipherSuites() throws Exception {
TlsSettings tlsSettings1 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
TlsSettings tlsSettings2 = new TlsSettings.Builder().build();
assertThat(tlsSettings1.equals(tlsSettings2), is(false));
tlsSettings1 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
tlsSettings2 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
assertThat(tlsSettings1.equals(tlsSettings2), is(true));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method serialisesAllAttributes.
@Test
public void serialisesAllAttributes() throws Exception {
TlsSettings tlsSettings = new TlsSettings.Builder().trustAllCerts(true).sslProvider("JDK").trustStorePassword("bar").protocols(List.of("TLSv1.2")).cipherSuites(List.of("TLS_RSA_WITH_AES_128_CBC_SHA")).sendSni(false).sniHost("some.sni.host").build();
String result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(tlsSettings);
assertThat(result, containsString("\"trustAllCerts\" : true"));
assertThat(result, containsString("\"sslProvider\" : \"JDK\""));
assertThat(result, containsString("\"addlCerts\" : [ ]"));
// trustStorePath is platform dependent - thus match only until just before the root path:
assertThat(result, containsString("\"trustStorePath\" : \""));
assertThat(result, containsString("\"trustStorePassword\" : \"bar"));
assertThat(result, containsString("TLS_RSA_WITH_AES_128_CBC_SHA"));
assertThat(result, containsString("\"sendSni\" : " + tlsSettings.sendSni()));
assertThat(result, containsString("\"sniHost\" : \"" + tlsSettings.sniHost().orElse("") + "\""));
}
use of com.hotels.styx.api.extension.service.TlsSettings in project styx by ExpediaGroup.
the class TlsSettingsTest method hashCodeConsidersCipherSuites.
@Test
public void hashCodeConsidersCipherSuites() throws Exception {
TlsSettings tlsSettings1 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
TlsSettings tlsSettings2 = new TlsSettings.Builder().build();
assertThat(tlsSettings1.hashCode() == tlsSettings2.hashCode(), is(false));
tlsSettings1 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
tlsSettings2 = new TlsSettings.Builder().cipherSuites(List.of("x", "y")).build();
assertThat(tlsSettings1.hashCode() == tlsSettings2.hashCode(), is(true));
}
Aggregations