Package org.apache.ambari.server.controller

Examples of org.apache.ambari.server.controller.ConfigurationRequest


      Map<String, String> configs = new HashMap<String, String>();
      configs.put(NAMENODE_PORT_V1, "localhost:${ambari.dfs.datanode.http.port}");
      configs.put(DATANODE_PORT, "localhost:70075");
      configs.put("ambari.dfs.datanode.http.port", "70070");
     
      ConfigurationRequest cr = new ConfigurationRequest(clusterName,
        "hdfs-site", "version1", configs);
      ClusterRequest crequest = new ClusterRequest(null, clusterName, null, null);
      crequest.setDesiredConfig(cr);
      controller.updateClusters(Collections.singleton(crequest), new HashMap<String,String>());
     
    } else {
      Map<String, String> configs = new HashMap<String, String>();
      configs.put(NAMENODE_PORT_V2, "localhost:70071");
      configs.put(DATANODE_PORT, "localhost:70075");

      ConfigurationRequest cr = new ConfigurationRequest(clusterName,
        "hdfs-site", "version2", configs);
     
      ClusterRequest crequest = new ClusterRequest(null, clusterName, null, null);
      crequest.setDesiredConfig(cr);
      controller.updateClusters(Collections.singleton(crequest), new HashMap<String,String>());
View Full Code Here


    Map<String, String> yarnConfigs = new HashMap<String, String>();
    yarnConfigs.put(RESOURCEMANAGER_PORT, "8088");
    yarnConfigs.put(NODEMANAGER_PORT, "8042");

    ConfigurationRequest cr1 = new ConfigurationRequest(clusterName,
      "hdfs-site", "versionN", configs);

    ClusterRequest crReq = new ClusterRequest(null, clusterName, null, null);
    crReq.setDesiredConfig(cr1);
    controller.updateClusters(Collections.singleton(crReq), null);
    Cluster cluster = clusters.getCluster(clusterName);
    Assert.assertEquals("versionN", cluster.getDesiredConfigByType("hdfs-site")
      .getVersionTag());

    ConfigurationRequest cr2 = new ConfigurationRequest(clusterName,
      "yarn-site", "versionN", yarnConfigs);
    crReq.setDesiredConfig(cr2);
    controller.updateClusters(Collections.singleton(crReq), null);

    Assert.assertEquals("versionN", cluster.getDesiredConfigByType("yarn-site")
View Full Code Here

    Assert.assertEquals("8088", providerModule.getPort("c1", "RESOURCEMANAGER"));

    Map<String, String> yarnConfigs = new HashMap<String, String>();
    yarnConfigs.put(RESOURCEMANAGER_PORT, "localhost:50030");
    yarnConfigs.put(NODEMANAGER_PORT, "localhost:11111");
    ConfigurationRequest cr2 = new ConfigurationRequest("c1",
      "yarn-site", "versionN+1", yarnConfigs);

    ClusterRequest crReq = new ClusterRequest(null, "c1", null, null);
    crReq.setDesiredConfig(cr2);
    controller.updateClusters(Collections.singleton(crReq), null);
View Full Code Here

    ClusterRequest ucr2 = updateClusterRequest2.iterator().next();
    ClusterRequest ucr3 = updateClusterRequest3.iterator().next();
    assertEquals("c1", ucr1.getClusterName());
    assertEquals("c1", ucr2.getClusterName());
    assertEquals("c1", ucr3.getClusterName());
    ConfigurationRequest cr1 = ucr1.getDesiredConfig();
    ConfigurationRequest cr2 = ucr2.getDesiredConfig();
    ConfigurationRequest cr3 = ucr3.getDesiredConfig();
    assertEquals("1", cr1.getVersionTag());
    assertEquals("1", cr2.getVersionTag());
    assertEquals("1", cr3.getVersionTag());
    Map<String, ConfigurationRequest> mapConfigRequests = new HashMap<String, ConfigurationRequest>();
    mapConfigRequests.put(cr1.getType(), cr1);
    mapConfigRequests.put(cr2.getType(), cr2);
    mapConfigRequests.put(cr3.getType(), cr3);
    assertEquals(3, mapConfigRequests.size());
    ConfigurationRequest globalConfigRequest = mapConfigRequests.get("global");
    assertEquals(5, globalConfigRequest.getProperties().size());
    assertEquals("hadoop", globalConfigRequest.getProperties().get("user_group"));
    assertEquals("ambari-qa", globalConfigRequest.getProperties().get("smokeuser"));
    assertEquals("default@REPLACEME.NOWHERE", globalConfigRequest.getProperties().get("nagios_contact"));
    assertEquals("admin", globalConfigRequest.getProperties().get("nagios_web_password"));
    assertEquals("oozie", globalConfigRequest.getProperties().get("oozie_user"));
    ConfigurationRequest hdfsConfigRequest = mapConfigRequests.get("hdfs-site");
    assertEquals(1, hdfsConfigRequest.getProperties().size());
    assertEquals("value2", hdfsConfigRequest.getProperties().get("property2"));
    ConfigurationRequest coreConfigRequest = mapConfigRequests.get("core-site");
    assertEquals(5, coreConfigRequest.getProperties().size());
    assertEquals("value2", coreConfigRequest.getProperties().get("property1"));
    assertEquals("value3", coreConfigRequest.getProperties().get("property3"));
    assertEquals("*", coreConfigRequest.getProperties().get("hadoop.proxyuser.oozie.hosts"));
    assertEquals("users", coreConfigRequest.getProperties().get("hadoop.proxyuser.oozie.groups"));
    assertEquals("new.property.value", coreConfigRequest.getProperties().get("new.property"));
    assertNull(updateClusterPropertyMapCapture.getValue());
    assertNull(updateClusterPropertyMapCapture2.getValue());
    assertNull(updateClusterPropertyMapCapture3.getValue());

    Request serviceRequest = serviceRequestCapture.getValue();
View Full Code Here

        (String) properties.get(CLUSTER_NAME_PROPERTY_ID),
        (String) properties.get(CLUSTER_VERSION_PROPERTY_ID),
        null);

   
    ConfigurationRequest configRequest = getConfigurationRequest("Clusters", properties);
   
    if (null != configRequest)
      cr.setDesiredConfig(configRequest);
   
    return cr;
View Full Code Here

        if (PropertyHelper.getPropertyCategory(entry.getKey()).equals("properties") && null != entry.getValue()) {
          configMap.put(PropertyHelper.getPropertyName(entry.getKey()), entry.getValue().toString());
        }
      }

      final ConfigurationRequest configRequest = new ConfigurationRequest(cluster, type, tag, configMap);

      createResources(new Command<Void>() {
        @Override
        public Void invoke() throws AmbariException {
          getManagementController().createConfiguration(configRequest);
View Full Code Here

      return resources;
     
    } else {
      // TODO : handle multiple requests
      final ConfigurationRequest configRequest = getRequest(map);
     
      Set<ConfigurationResponse> responses = getResources(new Command<Set<ConfigurationResponse>>() {
        @Override
        public Set<ConfigurationResponse> invoke() throws AmbariException {
          return getManagementController().getConfigurations(Collections.singleton(configRequest));
View Full Code Here

  private ConfigurationRequest getRequest(Map<String, Object> properties) {
    String type = (String) properties.get(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);

    String tag = (String) properties.get(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);

    return new ConfigurationRequest(
        (String) properties.get(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID),
        type, tag, new HashMap<String, String>());
  }
View Full Code Here

        if (propertyCategory != null && propertyCategory.equals("properties") && null != entry.getValue()) {
          configMap.put(PropertyHelper.getPropertyName(entry.getKey()), entry.getValue().toString());
        }
      }

      final ConfigurationRequest configRequest = new ConfigurationRequest(cluster, type, tag, configMap);

      createResources(new Command<Void>() {
        @Override
        public Void invoke() throws AmbariException {
          getManagementController().createConfiguration(configRequest);
View Full Code Here

   */
  private ConfigurationRequest getRequest(Map<String, Object> properties) {
    String type = (String) properties.get(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
    String tag  = (String) properties.get(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);

    return new ConfigurationRequest(
        (String) properties.get(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID),
        type, tag, new HashMap<String, String>());
  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.ConfigurationRequest

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.