@Test public void testWaitForTopologyResolvedStateWithEmptyUpdatedSet() throws Exception { replayAll(); context.waitForConfigurationResolution(CLUSTER_NAME, Collections.<String>emptySet()); }
public void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes) throws AmbariException { Cluster cluster = getController().getClusters().getCluster(clusterName); boolean shouldWaitForResolution = true; while (shouldWaitForResolution) { int numOfRequestsStillRequiringResolution = 0; for (String actualConfigType : updatedConfigTypes) { DesiredConfig actualConfig = cluster.getDesiredConfigs().get(actualConfigType); if (!actualConfig.getTag().equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) { LOG.info("Config type " + actualConfigType + " not resolved yet, Blueprint deployment will wait until configuration update is completed"); numOfRequestsStillRequiringResolution++; } else { LOG.info("Config type " + actualConfigType + " is resolved in the cluster config."); } } if (numOfRequestsStillRequiringResolution == 0) { LOG.info("All required configuration types are in the " + TopologyManager.TOPOLOGY_RESOLVED_TAG + " state. Blueprint deployment can now continue."); shouldWaitForResolution = false; } else { LOG.info("Waiting for " + numOfRequestsStillRequiringResolution + " configuration types to be resolved before Blueprint deployment can continue"); try { Thread.sleep(100); } catch (InterruptedException e) { LOG.warn("sleep interrupted"); } } } }
AmbariContext { public void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes) throws AmbariException { Cluster cluster = getController().getClusters().getCluster(clusterName); boolean shouldWaitForResolution = true; while (shouldWaitForResolution) { int numOfRequestsStillRequiringResolution = 0; for (String actualConfigType : updatedConfigTypes) { DesiredConfig actualConfig = cluster.getDesiredConfigs().get(actualConfigType); if (!actualConfig.getTag().equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) { LOG.info("Config type " + actualConfigType + " not resolved yet, Blueprint deployment will wait until configuration update is completed"); numOfRequestsStillRequiringResolution++; } else { LOG.info("Config type " + actualConfigType + " is resolved in the cluster config."); } } if (numOfRequestsStillRequiringResolution == 0) { LOG.info("All required configuration types are in the " + TopologyManager.TOPOLOGY_RESOLVED_TAG + " state. Blueprint deployment can now continue."); shouldWaitForResolution = false; } else { LOG.info("Waiting for " + numOfRequestsStillRequiringResolution + " configuration types to be resolved before Blueprint deployment can continue"); try { Thread.sleep(100); } catch (InterruptedException e) { LOG.warn("sleep interrupted"); } } } } }
AmbariContext { public void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes) throws AmbariException { Cluster cluster = getController().getClusters().getCluster(clusterName); boolean shouldWaitForResolution = true; while (shouldWaitForResolution) { int numOfRequestsStillRequiringResolution = 0; for (String actualConfigType : updatedConfigTypes) { DesiredConfig actualConfig = cluster.getDesiredConfigs().get(actualConfigType); if (!actualConfig.getTag().equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) { LOG.info("Config type " + actualConfigType + " not resolved yet, Blueprint deployment will wait until configuration update is completed"); numOfRequestsStillRequiringResolution++; } else { LOG.info("Config type " + actualConfigType + " is resolved in the cluster config."); } } if (numOfRequestsStillRequiringResolution == 0) { LOG.info("All required configuration types are in the " + TopologyManager.TOPOLOGY_RESOLVED_TAG + " state. Blueprint deployment can now continue."); shouldWaitForResolution = false; } else { LOG.info("Waiting for " + numOfRequestsStillRequiringResolution + " configuration types to be resolved before Blueprint deployment can continue"); try { Thread.sleep(100); } catch (InterruptedException e) { LOG.warn("sleep interrupted"); } } } }  }
AmbariContext { public void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes) throws AmbariException { Cluster cluster = getController().getClusters().getCluster(clusterName); boolean shouldWaitForResolution = true; while (shouldWaitForResolution) { int numOfRequestsStillRequiringResolution = 0; for (String actualConfigType : updatedConfigTypes) { DesiredConfig actualConfig = cluster.getDesiredConfigs().get(actualConfigType); if (!actualConfig.getTag().equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) { LOG.info("Config type " + actualConfigType + " not resolved yet, Blueprint deployment will wait until configuration update is completed"); numOfRequestsStillRequiringResolution++; } else { LOG.info("Config type " + actualConfigType + " is resolved in the cluster config."); } } if (numOfRequestsStillRequiringResolution == 0) { LOG.info("All required configuration types are in the " + TopologyManager.TOPOLOGY_RESOLVED_TAG + " state. Blueprint deployment can now continue."); shouldWaitForResolution = false; } else { LOG.info("Waiting for " + numOfRequestsStillRequiringResolution + " configuration types to be resolved before Blueprint deployment can continue"); try { Thread.sleep(100); } catch (InterruptedException e) { LOG.warn("sleep interrupted"); } } } }  boolean isClusterKerberosEnabled(long clusterId); HostRoleCommand createAmbariTask(long requestId, long stageId, String component, String host,
                                          TaskType type, boolean skipFailure); HostRoleCommand createAmbariTask(long taskId, long requestId, long stageId,
                                          String component, String host, TaskType type, boolean skipFailure); HostRoleCommand getPhysicalTask(long id); Collection<HostRoleCommand> getPhysicalTasks(Collection<Long> ids); void createAmbariResources(ClusterTopology topology, String clusterName, SecurityType securityType, String repoVersion); void createAmbariClusterResource(String clusterName, String stackName, String stackVersion, SecurityType securityType, String repoVersion); void createAmbariServiceAndComponentResources(ClusterTopology topology, String clusterName); void createAmbariHostResources(long  clusterId, String hostName, Map<String, Collection<String>> components); Long getNextRequestId(); synchronized static AmbariManagementController getController(); synchronized static ClusterController getClusterController(); static void init(HostRoleCommandFactory factory); void registerHostWithConfigGroup(final String hostName, final ClusterTopology topology, final String groupName); RequestStatusResponse installHost(String hostName, String clusterName, Collection<String> skipInstallForComponents, Collection<String> dontSkipInstallForComponents, boolean skipFailure); RequestStatusResponse startHost(String hostName, String clusterName, Collection<String> installOnlyComponents, boolean skipFailure); void persistInstallStateForUI(String clusterName, String stackName, String stackVersion); List<ConfigurationRequest> createConfigurationRequests(Map<String, Object> clusterProperties); void setConfigurationOnCluster(final ClusterRequest clusterRequest); void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes); boolean isTopologyResolved(long clusterId); PersistedState getPersistedTopologyState(); boolean isHostRegisteredWithCluster(long clusterId, String host); long getClusterId(String clusterName); String getClusterName(long clusterId); }
AmbariContext { public void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes) throws AmbariException { Cluster cluster = getController().getClusters().getCluster(clusterName); boolean shouldWaitForResolution = true; while (shouldWaitForResolution) { int numOfRequestsStillRequiringResolution = 0; for (String actualConfigType : updatedConfigTypes) { DesiredConfig actualConfig = cluster.getDesiredConfigs().get(actualConfigType); if (!actualConfig.getTag().equals(TopologyManager.TOPOLOGY_RESOLVED_TAG)) { LOG.info("Config type " + actualConfigType + " not resolved yet, Blueprint deployment will wait until configuration update is completed"); numOfRequestsStillRequiringResolution++; } else { LOG.info("Config type " + actualConfigType + " is resolved in the cluster config."); } } if (numOfRequestsStillRequiringResolution == 0) { LOG.info("All required configuration types are in the " + TopologyManager.TOPOLOGY_RESOLVED_TAG + " state. Blueprint deployment can now continue."); shouldWaitForResolution = false; } else { LOG.info("Waiting for " + numOfRequestsStillRequiringResolution + " configuration types to be resolved before Blueprint deployment can continue"); try { Thread.sleep(100); } catch (InterruptedException e) { LOG.warn("sleep interrupted"); } } } }  boolean isClusterKerberosEnabled(long clusterId); HostRoleCommand createAmbariTask(long requestId, long stageId, String component, String host,
                                          TaskType type, boolean skipFailure); HostRoleCommand createAmbariTask(long taskId, long requestId, long stageId,
                                          String component, String host, TaskType type, boolean skipFailure); HostRoleCommand getPhysicalTask(long id); Collection<HostRoleCommand> getPhysicalTasks(Collection<Long> ids); void createAmbariResources(ClusterTopology topology, String clusterName, SecurityType securityType, String repoVersion); void createAmbariClusterResource(String clusterName, String stackName, String stackVersion, SecurityType securityType, String repoVersion); void createAmbariServiceAndComponentResources(ClusterTopology topology, String clusterName); void createAmbariHostResources(long  clusterId, String hostName, Map<String, Collection<String>> components); Long getNextRequestId(); synchronized static AmbariManagementController getController(); synchronized static ClusterController getClusterController(); static void init(HostRoleCommandFactory factory); void registerHostWithConfigGroup(final String hostName, final ClusterTopology topology, final String groupName); RequestStatusResponse installHost(String hostName, String clusterName, Collection<String> skipInstallForComponents, Collection<String> dontSkipInstallForComponents, boolean skipFailure); RequestStatusResponse startHost(String hostName, String clusterName, Collection<String> installOnlyComponents, boolean skipFailure); void persistInstallStateForUI(String clusterName, String stackName, String stackVersion); List<ConfigurationRequest> createConfigurationRequests(Map<String, Object> clusterProperties); void setConfigurationOnCluster(final ClusterRequest clusterRequest); void waitForConfigurationResolution(String clusterName, Set<String> updatedConfigTypes); boolean isTopologyResolved(long clusterId); PersistedState getPersistedTopologyState(); boolean isHostRegisteredWithCluster(long clusterId, String host); long getClusterId(String clusterName); String getClusterName(long clusterId);  }