@Test void cancelledStateIsNull() throws JsonProcessingException { AttemptResult<Object> attemptResult = AttemptResults.justContinue(); when(clusterPollingCheckerService.checkClusterCancelledState(any(), anyBoolean())).thenReturn(attemptResult); AttemptResult<Object> result = underTest.obtainAttemptResult(cluster, DatabaseOperation.CREATION, "crn", true); assertThat(result.getState()).isEqualTo(attemptResult.getState()); }
AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable) throws JsonProcessingException { Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable)); if (result.isEmpty()) { checkArgument(cluster != null, "Cluster must not be null"); try { LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName()); DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn); LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus)); result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster)); } catch (NotFoundException e) { result = Optional.of(AttemptResults.finishWith(null)); } } return result.get(); }
DatabaseObtainerService { AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable) throws JsonProcessingException { Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable)); if (result.isEmpty()) { checkArgument(cluster != null, "Cluster must not be null"); try { LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName()); DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn); LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus)); result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster)); } catch (NotFoundException e) { result = Optional.of(AttemptResults.finishWith(null)); } } return result.get(); } }
DatabaseObtainerService { AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable) throws JsonProcessingException { Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable)); if (result.isEmpty()) { checkArgument(cluster != null, "Cluster must not be null"); try { LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName()); DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn); LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus)); result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster)); } catch (NotFoundException e) { result = Optional.of(AttemptResults.finishWith(null)); } } return result.get(); } DatabaseObtainerService(RedbeamsClientService redbeamsClient, ClusterPollingCheckerService clusterPollingCheckerService,
            DatabaseCriteriaResolver databaseCriteriaResolver); }
DatabaseObtainerService { AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable) throws JsonProcessingException { Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable)); if (result.isEmpty()) { checkArgument(cluster != null, "Cluster must not be null"); try { LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName()); DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn); LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus)); result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster)); } catch (NotFoundException e) { result = Optional.of(AttemptResults.finishWith(null)); } } return result.get(); } DatabaseObtainerService(RedbeamsClientService redbeamsClient, ClusterPollingCheckerService clusterPollingCheckerService,
            DatabaseCriteriaResolver databaseCriteriaResolver);  }
DatabaseObtainerService { AttemptResult<Object> obtainAttemptResult(Cluster cluster, DatabaseOperation databaseOperation, String databaseCrn, boolean cancellable) throws JsonProcessingException { Optional<AttemptResult<Object>> result = Optional.ofNullable(clusterPollingCheckerService.checkClusterCancelledState(cluster, cancellable)); if (result.isEmpty()) { checkArgument(cluster != null, "Cluster must not be null"); try { LOGGER.info("Creation polling redbeams for database status: '{}'", cluster.getName()); DatabaseServerV4Response rdsStatus = redbeamsClient.getByCrn(databaseCrn); LOGGER.info("Response from redbeams: {}", JsonUtil.writeValueAsString(rdsStatus)); result = Optional.of(databaseCriteriaResolver.resolveResultByCriteria(databaseOperation, rdsStatus, cluster)); } catch (NotFoundException e) { result = Optional.of(AttemptResults.finishWith(null)); } } return result.get(); } DatabaseObtainerService(RedbeamsClientService redbeamsClient, ClusterPollingCheckerService clusterPollingCheckerService,
            DatabaseCriteriaResolver databaseCriteriaResolver);   }