Search in sources :

Example 1 with SslConfig

use of com.sequenceiq.redbeams.domain.stack.SslConfig in project cloudbreak by hortonworks.

the class DatabaseServerSslCertificatePrescriptionServiceTest method createSslConfig.

private SslConfig createSslConfig(SslCertificateType sslCertificateType, String sslCertificateActiveCloudProviderIdentifier) {
    SslConfig sslConfig = new SslConfig();
    sslConfig.setSslCertificateType(sslCertificateType);
    sslConfig.setSslCertificateActiveCloudProviderIdentifier(sslCertificateActiveCloudProviderIdentifier);
    return sslConfig;
}
Also used : SslConfig(com.sequenceiq.redbeams.domain.stack.SslConfig)

Example 2 with SslConfig

use of com.sequenceiq.redbeams.domain.stack.SslConfig in project cloudbreak by hortonworks.

the class DatabaseServerSslCertificateSyncServiceTest method createSslConfig.

private SslConfig createSslConfig(SslCertificateType sslCertificateType, String sslCertificateActiveCloudProviderIdentifier) {
    SslConfig sslConfig = new SslConfig();
    sslConfig.setSslCertificateType(sslCertificateType);
    sslConfig.setSslCertificateActiveCloudProviderIdentifier(sslCertificateActiveCloudProviderIdentifier);
    return sslConfig;
}
Also used : SslConfig(com.sequenceiq.redbeams.domain.stack.SslConfig)

Example 3 with SslConfig

use of com.sequenceiq.redbeams.domain.stack.SslConfig in project cloudbreak by hortonworks.

the class DBStackToDatabaseStackConverterTest method testConversionWithSslCertificateCloudProviderOwned.

@Test
void testConversionWithSslCertificateCloudProviderOwned() {
    DatabaseServer server = new DatabaseServer();
    server.setDatabaseVendor(DatabaseVendor.POSTGRES);
    dbStack.setDatabaseServer(server);
    SslConfig sslConfig = new SslConfig();
    sslConfig.setSslCertificateType(SslCertificateType.CLOUD_PROVIDER_OWNED);
    dbStack.setSslConfig(sslConfig);
    DatabaseStack convertedStack = underTest.convert(dbStack);
    assertThat(convertedStack.getDatabaseServer().isUseSslEnforcement()).isTrue();
}
Also used : SslConfig(com.sequenceiq.redbeams.domain.stack.SslConfig) DatabaseStack(com.sequenceiq.cloudbreak.cloud.model.DatabaseStack) DatabaseServer(com.sequenceiq.redbeams.domain.stack.DatabaseServer) Test(org.junit.jupiter.api.Test)

Example 4 with SslConfig

use of com.sequenceiq.redbeams.domain.stack.SslConfig in project cloudbreak by hortonworks.

the class AllocateDatabaseServerV4RequestToDBStackConverterTest method conversionTestWhenSslDisabled.

@ParameterizedTest(name = "{0}")
@MethodSource("conversionTestWhenSslDisabledDataProvider")
void conversionTestWhenSslDisabled(String testCaseName, boolean fieldSslEnabled, SslConfigV4Request sslConfigV4Request) {
    setupMinimalValid(sslConfigV4Request, AWS_CLOUD_PLATFORM);
    ReflectionTestUtils.setField(underTest, FIELD_SSL_ENABLED, fieldSslEnabled);
    DBStack dbStack = underTest.convert(allocateRequest, OWNER_CRN);
    SslConfig sslConfig = dbStack.getSslConfig();
    assertThat(sslConfig).isNotNull();
    Set<String> sslCertificates = sslConfig.getSslCertificates();
    assertThat(sslCertificates).isNotNull();
    assertThat(sslCertificates).isEmpty();
    assertThat(sslConfig.getSslCertificateType()).isEqualTo(SslCertificateType.NONE);
}
Also used : SslConfig(com.sequenceiq.redbeams.domain.stack.SslConfig) DBStack(com.sequenceiq.redbeams.domain.stack.DBStack) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 5 with SslConfig

use of com.sequenceiq.redbeams.domain.stack.SslConfig in project cloudbreak by hortonworks.

the class AllocateDatabaseServerV4RequestToDBStackConverterTest method verifySsl.

private void verifySsl(DBStack dbStack, Set<String> sslCertificatesExpected, String cloudProviderIdentifierExpected) {
    SslConfig sslConfig = dbStack.getSslConfig();
    assertThat(sslConfig).isNotNull();
    Set<String> sslCertificates = sslConfig.getSslCertificates();
    assertThat(sslCertificates).isNotNull();
    assertThat(sslCertificates).isEqualTo(sslCertificatesExpected);
    assertThat(sslConfig.getSslCertificateType()).isEqualTo(SslCertificateType.CLOUD_PROVIDER_OWNED);
    assertThat(sslConfig.getSslCertificateActiveVersion()).isEqualTo(MAX_VERSION);
    assertThat(sslConfig.getSslCertificateActiveCloudProviderIdentifier()).isEqualTo(cloudProviderIdentifierExpected);
}
Also used : SslConfig(com.sequenceiq.redbeams.domain.stack.SslConfig) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString)

Aggregations

SslConfig (com.sequenceiq.redbeams.domain.stack.SslConfig)16 DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)6 Test (org.junit.jupiter.api.Test)5 DatabaseServerV4Response (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response)4 SslConfigV4Response (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.SslConfigV4Response)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 DatabaseStack (com.sequenceiq.cloudbreak.cloud.model.DatabaseStack)3 DatabaseServerConfig (com.sequenceiq.redbeams.domain.DatabaseServerConfig)3 DatabaseServer (com.sequenceiq.redbeams.domain.stack.DatabaseServer)3 SslCertificateEntry (com.sequenceiq.redbeams.configuration.SslCertificateEntry)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)1 CloudDatabaseServerSslCertificate (com.sequenceiq.cloudbreak.cloud.model.database.CloudDatabaseServerSslCertificate)1 Objects (java.util.Objects)1 Set (java.util.Set)1