You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2014/05/01 02:25:19 UTC
git commit: AMBARI-5515. Caputre all Hive properties in the stack
definition. (swagle)
Repository: ambari
Updated Branches:
refs/heads/branch-1.6.0 07635428c -> f08b3c4a3
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/f08b3c4a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f08b3c4a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f08b3c4a
Branch: refs/heads/branch-1.6.0
Commit: f08b3c4a3fd0061ff49eb256c9afe81366cf44a6
Parents: 0763542
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Apr 30 17:16:34 2014 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Apr 30 17:16:34 2014 -0700
----------------------------------------------------------------------
.../server/api/services/AmbariMetaInfo.java | 38 ++++++++----
.../server/api/util/StackExtensionHelper.java | 24 +++++++-
.../ambari/server/controller/AmbariServer.java | 3 +-
.../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 ++++++
.../internal/BlueprintResourceProviderTest.java | 23 ++++++--
.../services/HIVE/configuration/hive-site.xml | 3 +-
15 files changed, 217 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f08b3c4a/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/f08b3c4a/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/f08b3c4a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 91632c0..fd9f5a7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -509,7 +509,8 @@ public class AmbariServer {
StackDefinedPropertyProvider.init(injector);
NagiosPropertyProvider.init(injector);
AbstractControllerResourceProvider.init(injector.getInstance(ResourceProviderFactory.class));
- BlueprintResourceProvider.init(injector.getInstance(BlueprintDAO.class), injector.getInstance(Gson.class));
+ BlueprintResourceProvider.init(injector.getInstance(BlueprintDAO.class),
+ injector.getInstance(Gson.class));
StackDependencyResourceProvider.init(ambariMetaInfo);
ClusterResourceProvider.injectBlueprintDAO(injector.getInstance(BlueprintDAO.class));
ViewRegistry.init(injector.getInstance(ViewDAO.class), injector.getInstance(ViewInstanceDAO.class));
http://git-wip-us.apache.org/repos/asf/ambari/blob/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/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/f08b3c4a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
index 9e12c63..6993420 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintResourceProviderTest.java
@@ -19,6 +19,11 @@
package org.apache.ambari.server.controller.internal;
import com.google.gson.Gson;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import junit.framework.Assert;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.predicate.EqualsPredicate;
import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
import org.apache.ambari.server.controller.spi.NoSuchResourceException;
@@ -30,6 +35,7 @@ import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.spi.SystemException;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.orm.dao.BlueprintDAO;
import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
import org.apache.ambari.server.orm.entities.BlueprintEntity;
@@ -38,8 +44,13 @@ import org.apache.ambari.server.orm.entities.HostGroupConfigEntity;
import org.apache.ambari.server.orm.entities.HostGroupEntity;
import org.easymock.Capture;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createMockBuilder;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -48,6 +59,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -74,12 +86,11 @@ import static org.junit.Assert.fail;
public class BlueprintResourceProviderTest {
private static String BLUEPRINT_NAME = "test-blueprint";
-
private final static BlueprintDAO dao = createStrictMock(BlueprintDAO.class);
private final static Gson gson = new Gson();
@BeforeClass
- public static void initClass() {
+ public static void initClass() throws Exception {
BlueprintResourceProvider.init(dao, gson);
}
@@ -159,7 +170,7 @@ public class BlueprintResourceProviderTest {
@Test
public void testGetResourcesNoPredicate() throws SystemException, UnsupportedPropertyException,
- NoSuchParentResourceException, NoSuchResourceException {
+ NoSuchParentResourceException, NoSuchResourceException {
Request request = createNiceMock(Request.class);
ResourceProvider provider = createProvider();
@@ -182,7 +193,7 @@ public class BlueprintResourceProviderTest {
@Test
public void testGetResourcesNoPredicate_withConfiguration() throws SystemException, UnsupportedPropertyException,
- NoSuchParentResourceException, NoSuchResourceException {
+ NoSuchParentResourceException, NoSuchResourceException {
Request request = createNiceMock(Request.class);
ResourceProvider provider = createProvider();
@@ -208,7 +219,7 @@ public class BlueprintResourceProviderTest {
@Test
public void testDeleteResources() throws SystemException, UnsupportedPropertyException,
- NoSuchParentResourceException, NoSuchResourceException {
+ NoSuchParentResourceException, NoSuchResourceException {
Capture<BlueprintEntity> entityCapture = new Capture<BlueprintEntity>();
@@ -272,12 +283,12 @@ public class BlueprintResourceProviderTest {
mapProperties.put(BlueprintResourceProvider.BLUEPRINT_NAME_PROPERTY_ID, BLUEPRINT_NAME);
mapProperties.put(BlueprintResourceProvider.STACK_NAME_PROPERTY_ID, "test-stack-name");
mapProperties.put(BlueprintResourceProvider.STACK_VERSION_PROPERTY_ID, "test-stack-version");
- mapProperties.put(BlueprintResourceProvider.STACK_VERSION_PROPERTY_ID, "test-stack-version");
mapProperties.put(BlueprintResourceProvider.HOST_GROUP_PROPERTY_ID, setHostGroupProperties);
return Collections.singleton(mapProperties);
}
+ @SuppressWarnings("unchecked")
private void setConfigurationProperties(Set<Map<String, Object>> properties ) {
Map<String, String> clusterProperties = new HashMap<String, String>();
clusterProperties.put("core-site/fs.trash.interval", "480");
http://git-wip-us.apache.org/repos/asf/ambari/blob/f08b3c4a/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>