@Test void provisionDatabaseBadRequest() { when(redbeamsClient.create(any())).thenThrow(BadRequestException.class); assertThatThrownBy(() -> underTest.provisionDatabase(new Cluster(), DatabaseAvailabilityType.HA, environmentResponse)) .isInstanceOf(BadRequestException.class); }
public void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment) { LOGGER.info("Create external {} database server in environment {} for DataHub {}", externalDatabase.name(), environment.getName(), cluster.getName()); AllocateDatabaseServerV4Request request = getDatabaseRequest(environment, externalDatabase, cluster); String databaseCrn; try { databaseCrn = redbeamsClient.create(request).getResourceCrn(); updateClusterWithDatabaseServerCrn(cluster, databaseCrn); } catch (BadRequestException badRequestException) { LOGGER.error("Redbeams create request failed, bad request", badRequestException); throw badRequestException; } waitAndGetDatabase(cluster, databaseCrn, DatabaseOperation.CREATION, true); }
ExternalDatabaseService { public void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment) { LOGGER.info("Create external {} database server in environment {} for DataHub {}", externalDatabase.name(), environment.getName(), cluster.getName()); AllocateDatabaseServerV4Request request = getDatabaseRequest(environment, externalDatabase, cluster); String databaseCrn; try { databaseCrn = redbeamsClient.create(request).getResourceCrn(); updateClusterWithDatabaseServerCrn(cluster, databaseCrn); } catch (BadRequestException badRequestException) { LOGGER.error("Redbeams create request failed, bad request", badRequestException); throw badRequestException; } waitAndGetDatabase(cluster, databaseCrn, DatabaseOperation.CREATION, true); } }
ExternalDatabaseService { public void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment) { LOGGER.info("Create external {} database server in environment {} for DataHub {}", externalDatabase.name(), environment.getName(), cluster.getName()); AllocateDatabaseServerV4Request request = getDatabaseRequest(environment, externalDatabase, cluster); String databaseCrn; try { databaseCrn = redbeamsClient.create(request).getResourceCrn(); updateClusterWithDatabaseServerCrn(cluster, databaseCrn); } catch (BadRequestException badRequestException) { LOGGER.error("Redbeams create request failed, bad request", badRequestException); throw badRequestException; } waitAndGetDatabase(cluster, databaseCrn, DatabaseOperation.CREATION, true); } ExternalDatabaseService(RedbeamsClientService redbeamsClient, ClusterRepository clusterRepository,
            Map<CloudPlatform, DatabaseStackConfig> dbConfigs, Map<CloudPlatform, DatabaseServerParameterDecorator> parameterDecoratorMap,
            DatabaseObtainerService databaseObtainerService); }
ExternalDatabaseService { public void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment) { LOGGER.info("Create external {} database server in environment {} for DataHub {}", externalDatabase.name(), environment.getName(), cluster.getName()); AllocateDatabaseServerV4Request request = getDatabaseRequest(environment, externalDatabase, cluster); String databaseCrn; try { databaseCrn = redbeamsClient.create(request).getResourceCrn(); updateClusterWithDatabaseServerCrn(cluster, databaseCrn); } catch (BadRequestException badRequestException) { LOGGER.error("Redbeams create request failed, bad request", badRequestException); throw badRequestException; } waitAndGetDatabase(cluster, databaseCrn, DatabaseOperation.CREATION, true); } ExternalDatabaseService(RedbeamsClientService redbeamsClient, ClusterRepository clusterRepository,
            Map<CloudPlatform, DatabaseStackConfig> dbConfigs, Map<CloudPlatform, DatabaseServerParameterDecorator> parameterDecoratorMap,
            DatabaseObtainerService databaseObtainerService); void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment); void terminateDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment, boolean forced); }
ExternalDatabaseService { public void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment) { LOGGER.info("Create external {} database server in environment {} for DataHub {}", externalDatabase.name(), environment.getName(), cluster.getName()); AllocateDatabaseServerV4Request request = getDatabaseRequest(environment, externalDatabase, cluster); String databaseCrn; try { databaseCrn = redbeamsClient.create(request).getResourceCrn(); updateClusterWithDatabaseServerCrn(cluster, databaseCrn); } catch (BadRequestException badRequestException) { LOGGER.error("Redbeams create request failed, bad request", badRequestException); throw badRequestException; } waitAndGetDatabase(cluster, databaseCrn, DatabaseOperation.CREATION, true); } ExternalDatabaseService(RedbeamsClientService redbeamsClient, ClusterRepository clusterRepository,
            Map<CloudPlatform, DatabaseStackConfig> dbConfigs, Map<CloudPlatform, DatabaseServerParameterDecorator> parameterDecoratorMap,
            DatabaseObtainerService databaseObtainerService); void provisionDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment); void terminateDatabase(Cluster cluster, DatabaseAvailabilityType externalDatabase, DetailedEnvironmentResponse environment, boolean forced); static final int SLEEP_TIME_IN_SEC_FOR_DB_POLLING; static final int DURATION_IN_MINUTES_FOR_DB_POLLING; }