Package org.apache.ambari.server.state

Examples of org.apache.ambari.server.state.ConfigHelper


  @Test
  public void testUpdateConfigGroup() throws Exception {
    AmbariManagementController managementController = createMock(AmbariManagementController.class);
    RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
    ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
    Clusters clusters = createNiceMock(Clusters.class);
    Cluster cluster = createNiceMock(Cluster.class);
    Host h1 = createNiceMock(Host.class);
    Host h2 = createNiceMock(Host.class);
    final ConfigGroup configGroup = createNiceMock(ConfigGroup.class);
    ConfigGroupResponse configGroupResponse = createNiceMock
      (ConfigGroupResponse.class);

    expect(managementController.getClusters()).andReturn(clusters).anyTimes();
    expect(managementController.getAuthName()).andReturn("admin").anyTimes();
    expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
    expect(clusters.getHost("h1")).andReturn(h1);
    expect(clusters.getHost("h2")).andReturn(h2);

    expect(configGroup.getName()).andReturn("test-1").anyTimes();
    expect(configGroup.getId()).andReturn(25L).anyTimes();
    expect(configGroup.getTag()).andReturn("tag-1").anyTimes();

    expect(configGroup.convertToResponse()).andReturn(configGroupResponse).anyTimes();
    expect(configGroupResponse.getClusterName()).andReturn("Cluster100").anyTimes();
    expect(configGroupResponse.getId()).andReturn(25L).anyTimes();

    expect(cluster.getConfigGroups()).andStubAnswer(new IAnswer<Map<Long, ConfigGroup>>() {
      @Override
      public Map<Long, ConfigGroup> answer() throws Throwable {
        Map<Long, ConfigGroup> configGroupMap = new HashMap<Long, ConfigGroup>();
        configGroupMap.put(configGroup.getId(), configGroup);
        return configGroupMap;
      }
    });
    expect(managementController.getConfigHelper()).andReturn(configHelper).once();
    configHelper.invalidateStaleConfigsCache();
    expectLastCall().once();

    replay(managementController, clusters, cluster,
      configGroup, response, configGroupResponse, configHelper);
View Full Code Here


        Long clusterId = hostRoleCommandDAO.findByPK(
            executionCommand.getTaskId()).getStage().getClusterId();

        try {
          Cluster cluster = clusters.getClusterById(clusterId);
          ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);

          Map<String, Map<String, String>> configProperties = configHelper
            .getEffectiveConfigProperties(cluster,
              executionCommand.getConfigurationTags());

          // Apply the configurations saved with the Execution Cmd on top of
          // derived configs - This will take care of all the hacks
          for (Map.Entry<String, Map<String, String>> entry : configProperties.entrySet()) {
            String type = entry.getKey();
            Map<String, String> allLevelMergedConfig = entry.getValue();

            if (executionCommand.getConfigurations().containsKey(type)) {
              Map<String, String> mergedConfig =
                configHelper.getMergedConfig(allLevelMergedConfig,
                  executionCommand.getConfigurations().get(type));
              executionCommand.getConfigurations().get(type).clear();
              executionCommand.getConfigurations().get(type).putAll(mergedConfig);

            } else {
View Full Code Here

        Long clusterId = hostRoleCommandDAO.findByPK(
            executionCommand.getTaskId()).getStage().getCluster().getClusterId();

        try {
          Cluster cluster = clusters.getClusterById(clusterId);
          ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);

          Map<String, Map<String, String>> configProperties = configHelper
            .getEffectiveConfigProperties(cluster,
              executionCommand.getConfigurationTags());

          // Apply the configurations saved with the Execution Cmd on top of
          // derived configs - This will take care of all the hacks
          for (Map.Entry<String, Map<String, String>> entry : configProperties.entrySet()) {
            String type = entry.getKey();
            Map<String, String> allLevelMergedConfig = entry.getValue();

            if (executionCommand.getConfigurations().containsKey(type)) {
              Map<String, String> mergedConfig =
                configHelper.getMergedConfig(allLevelMergedConfig,
                  executionCommand.getConfigurations().get(type));
              executionCommand.getConfigurations().get(type).clear();
              executionCommand.getConfigurations().get(type).putAll(mergedConfig);

            } else {
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.state.ConfigHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.