@Test void testPollRefreshWhenTimeout() { ApiCommand apiCommand = new ApiCommand(); when(clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh(any(), any(), any())).thenReturn(PollingResult.TIMEOUT); CloudbreakException actual = assertThrows(CloudbreakException.class, () -> underTest.pollRefresh(apiCommand)); assertEquals("Timeout while Cloudera Manager was refreshing services.", actual.getMessage()); }
@VisibleForTesting void pollRefresh(ApiCommand restartCommand) throws CloudbreakException { PollingResult hostTemplatePollingResult = clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh( stack, apiClient, restartCommand.getId()); if (isExited(hostTemplatePollingResult)) { throw new CancellationException("Cluster was terminated while waiting for service refresh"); } else if (isTimeout(hostTemplatePollingResult)) { throw new CloudbreakException("Timeout while Cloudera Manager was refreshing services."); } }
ClouderaManagerModificationService implements ClusterModificationService { @VisibleForTesting void pollRefresh(ApiCommand restartCommand) throws CloudbreakException { PollingResult hostTemplatePollingResult = clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh( stack, apiClient, restartCommand.getId()); if (isExited(hostTemplatePollingResult)) { throw new CancellationException("Cluster was terminated while waiting for service refresh"); } else if (isTimeout(hostTemplatePollingResult)) { throw new CloudbreakException("Timeout while Cloudera Manager was refreshing services."); } } }
ClouderaManagerModificationService implements ClusterModificationService { @VisibleForTesting void pollRefresh(ApiCommand restartCommand) throws CloudbreakException { PollingResult hostTemplatePollingResult = clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh( stack, apiClient, restartCommand.getId()); if (isExited(hostTemplatePollingResult)) { throw new CancellationException("Cluster was terminated while waiting for service refresh"); } else if (isTimeout(hostTemplatePollingResult)) { throw new CloudbreakException("Timeout while Cloudera Manager was refreshing services."); } } ClouderaManagerModificationService(Stack stack, HttpClientConfig clientConfig); }
ClouderaManagerModificationService implements ClusterModificationService { @VisibleForTesting void pollRefresh(ApiCommand restartCommand) throws CloudbreakException { PollingResult hostTemplatePollingResult = clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh( stack, apiClient, restartCommand.getId()); if (isExited(hostTemplatePollingResult)) { throw new CancellationException("Cluster was terminated while waiting for service refresh"); } else if (isTimeout(hostTemplatePollingResult)) { throw new CloudbreakException("Timeout while Cloudera Manager was refreshing services."); } } ClouderaManagerModificationService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> instanceMetaDatas); @Override void cleanupCluster(Telemetry telemetry); @Override void upgradeClusterRuntime(Set<ClusterComponent> components, boolean patchUpgrade); void restartStaleServices(MgmtServiceResourceApi mgmtServiceResourceApi, ClustersResourceApi clustersResourceApi); @Override void stopCluster(boolean disableKnoxAutorestart); @Override int startCluster(Set<InstanceMetaData> hostsInCluster); @Override Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); @Override String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); @Override Map<String, String> gatherInstalledParcels(String stackName); @Override void removeUnusedParcels(Set<ClusterComponent> usedParcelComponents); @Override void restartAll(); }
ClouderaManagerModificationService implements ClusterModificationService { @VisibleForTesting void pollRefresh(ApiCommand restartCommand) throws CloudbreakException { PollingResult hostTemplatePollingResult = clouderaManagerPollingServiceProvider.startPollingCmConfigurationRefresh( stack, apiClient, restartCommand.getId()); if (isExited(hostTemplatePollingResult)) { throw new CancellationException("Cluster was terminated while waiting for service refresh"); } else if (isTimeout(hostTemplatePollingResult)) { throw new CloudbreakException("Timeout while Cloudera Manager was refreshing services."); } } ClouderaManagerModificationService(Stack stack, HttpClientConfig clientConfig); @PostConstruct void initApiClient(); @Override List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> instanceMetaDatas); @Override void cleanupCluster(Telemetry telemetry); @Override void upgradeClusterRuntime(Set<ClusterComponent> components, boolean patchUpgrade); void restartStaleServices(MgmtServiceResourceApi mgmtServiceResourceApi, ClustersResourceApi clustersResourceApi); @Override void stopCluster(boolean disableKnoxAutorestart); @Override int startCluster(Set<InstanceMetaData> hostsInCluster); @Override Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); @Override String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); @Override Map<String, String> gatherInstalledParcels(String stackName); @Override void removeUnusedParcels(Set<ClusterComponent> usedParcelComponents); @Override void restartAll();  }