@Test public void testAdviseConfigurationWhenConfigurationRecommendHasInvalidResponse() throws StackAdvisorException, ConfigurationTopologyException { Map<String, Map<String, String>> props = createProps(); Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); expect(clusterTopology.getConfiguration()).andReturn(configuration).anyTimes(); expect(clusterTopology.isClusterKerberosEnabled()).andReturn(false).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getVersion()).andReturn("2.3").anyTimes(); expect(stack.getName()).andReturn("HDP").anyTimes(); expect(blueprint.getServices()).andReturn(Arrays.asList("HDFS", "YARN", "HIVE")).anyTimes(); expect(blueprint.getHostGroups()).andReturn(createHostGroupMap()).anyTimes(); expect(hostGroup.getComponentNames()).andReturn(Arrays.asList("comp1", "comp2")).anyTimes(); expect(stackAdvisorHelper.recommend(anyObject(StackAdvisorRequest.class))).andReturn(new RecommendationResponse()); expect(configuration.getFullProperties()).andReturn(props); replay(clusterTopology, blueprint, stack, hostGroup, configuration, stackAdvisorHelper); try { underTest.adviseConfiguration(clusterTopology, props); fail("Invalid state"); } catch (ConfigurationTopologyException e) { assertEquals(StackAdvisorBlueprintProcessor.INVALID_RESPONSE, e.getMessage()); } }
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
StackAdvisorBlueprintProcessor { public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } } }
StackAdvisorBlueprintProcessor { public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }  }
StackAdvisorBlueprintProcessor { public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }  static void init(StackAdvisorHelper instance); void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations); }
StackAdvisorBlueprintProcessor { public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, existingConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }  static void init(StackAdvisorHelper instance); void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> existingConfigurations);  }