use of com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response in project cloudbreak by hortonworks.
the class RedbeamsDbCertificateProviderTest method getRelatedSslCertsWhenTheClusterSdxAndRdsConfiguredButItsSslConfigIsNullShouldReturnWithEmptyResult.
@Test
void getRelatedSslCertsWhenTheClusterSdxAndRdsConfiguredButItsSslConfigIsNullShouldReturnWithEmptyResult() {
String dbServerCrn = "adbservercrn";
Cluster cluster = TestUtil.cluster();
cluster.setDatabaseServerCrn(dbServerCrn);
Stack stack = cluster.getStack();
stack.setCluster(cluster);
stack.setType(StackType.DATALAKE);
when(dbServerConfigurer.isRemoteDatabaseNeeded(cluster)).thenReturn(Boolean.TRUE);
when(dbServerConfigurer.getDatabaseServer(dbServerCrn)).thenReturn(new DatabaseServerV4Response());
Set<String> actual = underTest.getRelatedSslCerts(stack, cluster);
assertThat(actual).isEmpty();
}
use of com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response in project cloudbreak by hortonworks.
the class DatabaseServerConfigToDatabaseServerV4ResponseConverterTest method testConversionOfSslConfigWhenDbStackAbsentAndNoHostOrPort.
@Test
void testConversionOfSslConfigWhenDbStackAbsentAndNoHostOrPort() {
DatabaseServerConfig server = new DatabaseServerConfig();
server.setResourceCrn(TestData.getTestCrn(RESOURCE_TYPE_DATABASE_SERVER, RESOURCE_ID));
server.setDatabaseVendor(DatabaseVendor.POSTGRES);
DatabaseServerV4Response response = converter.convert(server);
assertThat(response).isNotNull();
assertThat(response.getSslConfig()).isNotNull();
assertThat(response.getSslConfig().getSslMode()).isEqualTo(SslMode.DISABLED);
assertThat(response.getStatus()).isEqualTo(Status.UNKNOWN);
}
use of com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response in project cloudbreak by hortonworks.
the class DatabaseServerConfigToDatabaseServerV4ResponseConverterTest method testConversionWhenUserManaged.
@Test
public void testConversionWhenUserManaged() {
DatabaseServerConfig server = new DatabaseServerConfig();
server.setId(1L);
server.setResourceCrn(TestData.getTestCrn(RESOURCE_TYPE_DATABASE_SERVER, RESOURCE_ID));
server.setName(RESOURCE_ID);
server.setDescription("mine not yours");
server.setHost(HOST);
server.setPort(PORT);
server.setDatabaseVendor(DatabaseVendor.POSTGRES);
initializeSecrets(server);
server.setCreationDate(System.currentTimeMillis());
server.setEnvironmentId(ENVIRONMENT_ID);
server.setResourceStatus(ResourceStatus.USER_MANAGED);
when(stringToSecretResponseConverter.convert(anyString())).thenReturn(new SecretResponse());
DatabaseServerV4Response response = converter.convert(server);
verify(stringToSecretResponseConverter, times(2)).convert(anyString());
assertThat(response).isNotNull();
assertThat(response.getResourceStatus()).isEqualTo(server.getResourceStatus());
assertThat(response.getStatus()).isEqualTo(Status.AVAILABLE);
assertThat(response.getStatusReason()).isNull();
}
use of com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response in project cloudbreak by hortonworks.
the class DatabaseServerConfigToDatabaseServerV4ResponseConverterTest method testConversionOfSslConfigWhenDbStackPresentAndCertificateTypeNone.
@Test
void testConversionOfSslConfigWhenDbStackPresentAndCertificateTypeNone() {
DatabaseServerConfig server = new DatabaseServerConfig();
server.setResourceCrn(TestData.getTestCrn(RESOURCE_TYPE_DATABASE_SERVER, RESOURCE_ID));
server.setDatabaseVendor(DatabaseVendor.POSTGRES);
DBStack dbStack = new DBStack();
dbStack.setSslConfig(new SslConfig());
initDBStackStatus(dbStack);
server.setDbStack(dbStack);
DatabaseServerV4Response response = converter.convert(server);
assertThat(response).isNotNull();
SslConfigV4Response sslConfigV4Response = response.getSslConfig();
assertThat(sslConfigV4Response).isNotNull();
assertThat(sslConfigV4Response.getSslMode()).isEqualTo(SslMode.DISABLED);
assertThat(sslConfigV4Response.getSslCertificateType()).isEqualTo(SslCertificateType.NONE);
assertThat(response.getStatus()).isEqualTo(dbStack.getStatus());
}
use of com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.responses.DatabaseServerV4Response in project cloudbreak by hortonworks.
the class DatabaseServerConfigToDatabaseServerV4ResponseConverterTest method testConversionOfSslConfigWhenDbStackPresentButSslConfigAbsent.
@Test
void testConversionOfSslConfigWhenDbStackPresentButSslConfigAbsent() {
DatabaseServerConfig server = new DatabaseServerConfig();
server.setResourceCrn(TestData.getTestCrn(RESOURCE_TYPE_DATABASE_SERVER, RESOURCE_ID));
server.setDatabaseVendor(DatabaseVendor.POSTGRES);
DBStack dbStack = new DBStack();
initDBStackStatus(dbStack);
server.setDbStack(dbStack);
DatabaseServerV4Response response = converter.convert(server);
assertThat(response).isNotNull();
assertThat(response.getSslConfig()).isNotNull();
assertThat(response.getSslConfig().getSslMode()).isEqualTo(SslMode.DISABLED);
assertThat(response.getStatus()).isEqualTo(dbStack.getStatus());
}
Aggregations