ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-5515. Caputre all Hive properties in the stack definition. (swagle)
Date Thu, 01 May 2014 00:36:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.0 05f2c36d4 -> a93332588


AMBARI-5515. Caputre all Hive properties in the stack definition. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a9333258
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a9333258
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a9333258

Branch: refs/heads/branch-1.6.0
Commit: a93332588413da0031b20aba81929e451f8c380c
Parents: 05f2c36
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Wed Apr 30 17:36:27 2014 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Wed Apr 30 17:36:27 2014 -0700

----------------------------------------------------------------------
 .../server/api/services/AmbariMetaInfo.java     | 38 ++++++++----
 .../server/api/util/StackExtensionHelper.java   | 24 +++++++-
 .../controller/StackConfigurationResponse.java  | 62 +++++++++++++++++++-
 .../internal/ClusterResourceProvider.java       | 28 ++++-----
 .../ambari/server/state/PropertyInfo.java       | 30 +++++++++-
 .../services/HIVE/configuration/global.xml      |  8 ++-
 .../services/HIVE/configuration/hive-site.xml   |  5 +-
 .../services/HIVE/configuration/global.xml      |  8 ++-
 .../services/HIVE/configuration/hive-site.xml   |  5 +-
 .../services/NAGIOS/configuration/global.xml    |  3 +-
 .../services/HIVE/configuration/hive-site.xml   |  7 ++-
 .../server/api/services/AmbariMetaInfoTest.java | 17 ++++++
 .../services/HIVE/configuration/hive-site.xml   |  3 +-
 13 files changed, 198 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 5fef43a..61e2954 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -55,6 +55,7 @@ import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.Stack;
+import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.stack.LatestRepoCallable;
 import org.apache.ambari.server.state.stack.MetricDefinition;
@@ -124,6 +125,9 @@ public class AmbariMetaInfo {
   private File customActionRoot;
   @Inject
   private MetainfoDAO metainfoDAO;
+  // Required properties by stack version
+  private final Map<StackId, Map<String, PropertyInfo>> requiredProperties =
+    new HashMap<StackId, Map<String, PropertyInfo>>();
 
   /**
    * Ambari Meta Info Object
@@ -161,10 +165,10 @@ public class AmbariMetaInfo {
   /**
    * Get component category
    *
-   * @param stackName
-   * @param version
-   * @param serviceName
-   * @param componentName
+   * @param stackName     stack name
+   * @param version       stack version
+   * @param serviceName   service name
+   * @param componentName component name
    * @return component component Info
    * @throws AmbariException
    */
@@ -185,10 +189,10 @@ public class AmbariMetaInfo {
   /**
    * Get components by service
    *
-   * @param stackName
-   * @param version
-   * @param serviceName
-   * @return
+   * @param stackName     stack name
+   * @param version       stack version
+   * @param serviceName   service name
+   * @return List of ComponentInfo objects
    * @throws AmbariException
    */
   public List<ComponentInfo> getComponentsByService(String stackName, String version,
String serviceName)
@@ -756,8 +760,7 @@ public class AmbariMetaInfo {
         + " should be a directory with stack"
         + ", stackRoot = " + stackRootAbsPath);
 
-    StackExtensionHelper stackExtensionHelper = new StackExtensionHelper
-      (stackRoot);
+    StackExtensionHelper stackExtensionHelper = new StackExtensionHelper(stackRoot);
     stackExtensionHelper.fillInfo();
 
     List<StackInfo> stacks = stackExtensionHelper.getAllAvailableStacks();
@@ -814,6 +817,10 @@ public class AmbariMetaInfo {
       // Resolve hooks folder
       String stackHooksToUse = stackExtensionHelper.resolveHooksFolder(stack);
       stack.setStackHooksFolder(stackHooksToUse);
+
+      // Set required config properties
+      requiredProperties.put(new StackId(stack.getName(), stack.getVersion()),
+        stackExtensionHelper.getAllRequiredPropertiesForStack(stack));
     }
 
     es.invokeAll(lookupList);
@@ -821,6 +828,15 @@ public class AmbariMetaInfo {
     es.shutdown();
   }
 
+  /**
+   * Get properties with require_input attribute set to true.
+   * @param stackName Name of the stack, e.g.: HDP
+   * @param stackVersion Version of the stack
+   * @return Map of config type to Properties
+   */
+  public Map<String, PropertyInfo> getRequiredPropertiesForStack(String stackName,
String stackVersion) {
+    return requiredProperties.get(new StackId(stackName, stackVersion));
+  }
 
   public String getServerVersion() {
     return serverVersion;
@@ -892,8 +908,6 @@ public class AmbariMetaInfo {
     return sb.toString();
   }
 
-
-
   /**
    * @param stackName the stack name
    * @param stackVersion the stack version

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
index 08a545f..89afb14 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
@@ -532,7 +532,12 @@ public class StackExtensionHelper {
 
   }
 
-
+  /**
+   * Get populated stackInfo for the stack definition at the provided path.
+   * @param stackVersionFolder Path to stack definition.
+   * @return StackInfo StackInfo object
+   * @throws JAXBException
+   */
   private StackInfo getStackInfo(File stackVersionFolder) throws JAXBException {
     StackInfo stackInfo = new StackInfo();
 
@@ -627,6 +632,23 @@ public class StackExtensionHelper {
     }
   }
 
+  /**
+   * Get all properties with require-input attribute set to true.
+   * @param stackInfo StackInfo object.
+   */
+  public Map<String, PropertyInfo> getAllRequiredPropertiesForStack(StackInfo stackInfo)
{
+    Map<String, PropertyInfo> requiredProperties = new HashMap<String, PropertyInfo>();
+    for (ServiceInfo serviceInfo : stackInfo.getServices()) {
+      List<PropertyInfo> properties = serviceInfo.getProperties();
+      for (PropertyInfo propertyInfo : properties) {
+        if (propertyInfo.isRequireInput()) {
+          requiredProperties.put(propertyInfo.getName(), propertyInfo);
+        }
+      }
+    }
+    return requiredProperties;
+  }
+
   
   public static <T> T unmarshal(Class<T> clz, File file) throws JAXBException
{
     Unmarshaller u = _jaxbContexts.get(clz).createUnmarshaller();

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
index e5cbdf7..c4baefb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
@@ -21,7 +21,13 @@ package org.apache.ambari.server.controller;
 
 public class StackConfigurationResponse {
 
-  
+  /**
+   * Stack configuration response.
+   * @param propertyName Property Key
+   * @param propertyValue Property Value
+   * @param propertyDescription Property Description
+   * @param type Configuration type
+   */
   public StackConfigurationResponse(String propertyName, String propertyValue, String propertyDescription,
String type) {
     setPropertyName(propertyName);
     setPropertyValue(propertyValue);
@@ -29,6 +35,26 @@ public class StackConfigurationResponse {
     setType(type);
   }
 
+  /**
+   * Stack configuration response with all properties.
+   * @param propertyName Property Key
+   * @param propertyValue Property Value
+   * @param propertyDescription Property Description
+   * @param type Configuration type
+   * @param isRequired Is required to be set
+   * @param propertyType Property Type
+   */
+  public StackConfigurationResponse(String propertyName, String propertyValue,
+                                    String propertyDescription, String type,
+                                    Boolean isRequired, String propertyType) {
+    setPropertyName(propertyName);
+    setPropertyValue(propertyValue);
+    setPropertyDescription(propertyDescription);
+    setType(type);
+    setRequired(isRequired);
+    setPropertyType(propertyType);
+  }
+
   private String stackName;
   private String stackVersion;
   private String serviceName;
@@ -36,6 +62,8 @@ public class StackConfigurationResponse {
   private String propertyValue;
   private String propertyDescription;
   private String type;
+  private Boolean isRequired;
+  private String propertyType;
 
   public String getStackName() {
     return stackName;
@@ -85,6 +113,10 @@ public class StackConfigurationResponse {
     this.propertyDescription = propertyDescription;
   }
 
+  /**
+   * Configuration type
+   * @return Configuration type (*-site.xml)
+   */
   public String getType() {
     return type;
   }
@@ -92,4 +124,32 @@ public class StackConfigurationResponse {
   public void setType(String type) {
     this.type = type;
   }
+
+  /**
+   * Is property a isRequired property
+   * @return True/False
+   */
+  public Boolean isRequired() {
+    return isRequired;
+  }
+
+  /**
+   * Set required attribute on this property.
+   * @param required True/False.
+   */
+  public void setRequired(Boolean required) {
+    this.isRequired = required;
+  }
+
+  /**
+   * Get type of property as set in the stack definition.
+   * @return Property type.
+   */
+  public String getPropertyType() {
+    return propertyType;
+  }
+
+  public void setPropertyType(String propertyType) {
+    this.propertyType = propertyType;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 7771b73..19bca09 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -17,14 +17,6 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import com.google.gson.Gson;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.StackAccessException;
@@ -60,6 +52,13 @@ import org.apache.ambari.server.orm.entities.HostGroupConfigEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigImpl;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Resource provider for cluster resources.
@@ -77,8 +76,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
 
 
   private static Set<String> pkPropertyIds =
-      new HashSet<String>(Arrays.asList(new String[]{
-          CLUSTER_ID_PROPERTY_ID}));
+      new HashSet<String>(Arrays.asList(new String[]{CLUSTER_ID_PROPERTY_ID}));
 
   /**
    * Data access object used to obtain blueprint entities.
@@ -822,6 +820,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
     // HIVE_SERVER
     propertyUpdaters.put("hive.metastore.uris", new SingleHostPropertyUpdater("HIVE_SERVER"));
     propertyUpdaters.put("hive_ambari_host", new SingleHostPropertyUpdater("HIVE_SERVER"));
+    propertyUpdaters.put("javax.jdo.option.ConnectionURL", new SingleHostPropertyUpdater("MYSQL_SERVER"));
 
     // OOZIE_SERVER
     propertyUpdaters.put("oozie.base.url", new SingleHostPropertyUpdater("OOZIE_SERVER"));
@@ -1110,14 +1109,14 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
      * @throws AmbariException an exception occurred getting configurations from the stack
definition
      */
     private void parseConfigurations(String service) throws AmbariException {
-      Map<String, Map<String, String>> mapServiceConfig =
-          new HashMap<String, Map<String, String>>();
+      Map<String, Map<String, String>> mapServiceConfig = new HashMap<String,
Map<String, String>>();
 
       serviceConfigurations.put(service, mapServiceConfig);
 
-      Set<StackConfigurationResponse> serviceConfigs = getManagementController().getStackConfigurations(
+      Set<StackConfigurationResponse> serviceConfigs =
+        getManagementController().getStackConfigurations(
           Collections.singleton(new StackConfigurationRequest(name, version, service, null)
-          ));
+        ));
 
       for (StackConfigurationResponse config : serviceConfigs) {
         String type = config.getType();
@@ -1130,6 +1129,7 @@ public class ClusterResourceProvider extends AbstractControllerResourceProvider
           mapTypeConfig = new HashMap<String, String>();
           mapServiceConfig.put(type, mapTypeConfig);
         }
+
         mapTypeConfig.put(config.getPropertyName(), config.getPropertyValue());
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
index acc5f4a..6257157 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
@@ -18,14 +18,19 @@
 
 package org.apache.ambari.server.state;
 
+
 import org.apache.ambari.server.controller.StackConfigurationResponse;
 
+import javax.xml.bind.annotation.XmlAttribute;
+
 public class PropertyInfo {
   private String name;
   private String value;
   private String description;
   private String filename;
   private boolean deleted;
+  private boolean requireInput;
+  private PropertyType type = PropertyType.DEFAULT;
 
   public String getName() {
     return name;
@@ -60,7 +65,8 @@ public class PropertyInfo {
   }
   
   public StackConfigurationResponse convertToResponse() {
-    return new StackConfigurationResponse(getName(), getValue(), getDescription() , getFilename());
+    return new StackConfigurationResponse(getName(), getValue(),
+      getDescription() , getFilename(), isRequireInput(), getType().name());
   }
 
   public boolean isDeleted() {
@@ -71,6 +77,23 @@ public class PropertyInfo {
     this.deleted = deleted;
   }
 
+  @XmlAttribute(name = "require-input")
+  public boolean isRequireInput() {
+    return requireInput;
+  }
+
+  public void setRequireInput(boolean requireInput) {
+    this.requireInput = requireInput;
+  }
+
+  public PropertyType getType() {
+    return type;
+  }
+
+  public void setType(PropertyType type) {
+    this.type = type;
+  }
+
   @Override
   public int hashCode() {
     final int prime = 31;
@@ -114,4 +137,9 @@ public class PropertyInfo {
       return false;
     return true;
   }
+
+  public enum PropertyType {
+    DEFAULT,
+    PASSWORD
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/global.xml
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/global.xml
index f3c274a..fa999fc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/global.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/global.xml
@@ -22,6 +22,11 @@
 
 <configuration>
   <property>
+    <name>hive_database_type</name>
+    <value>mysql</value>
+    <description>Default HIVE DB type.</description>
+  </property>
+  <property>
     <name>hive_database</name>
     <value>New MySQL Database</value>
     <description>
@@ -43,9 +48,10 @@
     <value>hive</value>
     <description>Database username to use to connect to the database.</description>
   </property>    
-  <property>
+  <property require-input="true">
     <name>hive_metastore_user_passwd</name>
     <value></value>
+    <type>PASSWORD</type>
     <description>Database password to use to connect to the database.</description>
   </property>    
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/hive-site.xml
index 3a6ed76..4a42ea4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HIVE/configuration/hive-site.xml
@@ -26,7 +26,7 @@ limitations under the License.
 
   <property>
     <name>javax.jdo.option.ConnectionURL</name>
-    <value>jdbc</value>
+    <value>jdbc:mysql://localhost/hive?createDatabaseIfNotExist=true</value>
     <description>JDBC connect string for a JDBC metastore</description>
   </property>
 
@@ -42,9 +42,10 @@ limitations under the License.
     <description>username to use against metastore database</description>
   </property>
 
-  <property>
+  <property require-input="true">
     <name>javax.jdo.option.ConnectionPassword</name>
     <value> </value>
+    <type>PASSWORD</type>
     <description>password to use against metastore database</description>
   </property>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/global.xml
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/global.xml
index e164c64..3d8cadc 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/global.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/global.xml
@@ -22,6 +22,11 @@
 
 <configuration>
   <property>
+    <name>hive_database_type</name>
+    <value>mysql</value>
+    <description>Default HIVE DB type.</description>
+  </property>
+  <property>
     <name>hive_database</name>
     <value>New MySQL Database</value>
     <description>
@@ -43,9 +48,10 @@
     <value>hive</value>
     <description>Database username to use to connect to the database.</description>
   </property>    
-  <property>
+  <property require-input="true">
     <name>hive_metastore_user_passwd</name>
     <value></value>
+    <type>PASSWORD</type>
     <description>Database password to use to connect to the database.</description>
   </property>    
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/hive-site.xml
index 6336a70..7e026bd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/configuration/hive-site.xml
@@ -27,7 +27,7 @@ limitations under the License.
 
   <property>
     <name>javax.jdo.option.ConnectionURL</name>
-    <value>jdbc</value>
+    <value>jdbc:mysql://localhost/hive?createDatabaseIfNotExist=true</value>
     <description>JDBC connect string for a JDBC metastore</description>
   </property>
 
@@ -43,9 +43,10 @@ limitations under the License.
     <description>username to use against metastore database</description>
   </property>
 
-  <property>
+  <property require-input="true">
     <name>javax.jdo.option.ConnectionPassword</name>
     <value> </value>
+    <type>PASSWORD</type>
     <description>password to use against metastore database</description>
   </property>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/configuration/global.xml
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/configuration/global.xml
index 61a2b90..fa112e3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/configuration/global.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/configuration/global.xml
@@ -36,9 +36,10 @@
     <value>nagiosadmin</value>
     <description>Nagios web user.</description>
   </property>
-  <property>
+  <property require-input = "true">
     <name>nagios_web_password</name>
     <value></value>
+    <type>PASSWORD</type>
     <description>Nagios Admin Password.</description>
   </property>
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
index 781fdcb..f2c4e87 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/configuration/hive-site.xml
@@ -27,7 +27,7 @@ limitations under the License.
 
   <property>
     <name>javax.jdo.option.ConnectionURL</name>
-    <value>jdbc</value>
+    <value>jdbc:mysql://localhost/hive?createDatabaseIfNotExist=true</value>
     <description>JDBC connect string for a JDBC metastore</description>
   </property>
 
@@ -43,9 +43,10 @@ limitations under the License.
     <description>username to use against metastore database</description>
   </property>
 
-  <property>
+  <property require-input="true">
     <name>javax.jdo.option.ConnectionPassword</name>
-    <value> </value>
+    <value></value>
+    <type>PASSWORD</type>
     <description>password to use against metastore database</description>
   </property>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 40e4bf3..de0cbf7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -1332,4 +1332,21 @@ public class AmbariMetaInfoTest {
     assertEquals("cluster", dependency.getScope());
   }
 
+  @Test
+  public void testPasswordPropertyAttribute() throws Exception {
+    ServiceInfo service = metaInfo.getService(STACK_NAME_HDP, "2.0.1", "HIVE");
+    List<PropertyInfo> propertyInfoList = service.getProperties();
+    Assert.assertNotNull(propertyInfoList);
+    PropertyInfo passwordProperty = null;
+    for (PropertyInfo propertyInfo : propertyInfoList) {
+      if (propertyInfo.isRequireInput()
+          && propertyInfo.getType().equals(PropertyInfo.PropertyType.PASSWORD)) {
+        passwordProperty = propertyInfo;
+      } else {
+        Assert.assertEquals(PropertyInfo.PropertyType.DEFAULT, propertyInfo.getType());
+      }
+    }
+    Assert.assertNotNull(passwordProperty);
+    Assert.assertEquals("javax.jdo.option.ConnectionPassword", passwordProperty.getName());
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9333258/ambari-server/src/test/resources/stacks/HDP/2.0.1/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.1/services/HIVE/configuration/hive-site.xml
b/ambari-server/src/test/resources/stacks/HDP/2.0.1/services/HIVE/configuration/hive-site.xml
index 7d35558..96b0d17 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.1/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.1/services/HIVE/configuration/hive-site.xml
@@ -43,9 +43,10 @@ limitations under the License.
     <description>username to use against metastore database</description>
   </property>
 
-  <property>
+  <property require-input="true">
     <name>javax.jdo.option.ConnectionPassword</name>
     <value></value>
+    <type>PASSWORD</type>
     <description>password to use against metastore database</description>
   </property>
 


Mime
View raw message