You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/09/29 09:37:35 UTC
ambari git commit: AMBARI-22088. A couple of merge fixes for
branch-3.0-perf (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-3.0-perf be73d167a -> d04ce2e87
AMBARI-22088. A couple of merge fixes for branch-3.0-perf (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d04ce2e8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d04ce2e8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d04ce2e8
Branch: refs/heads/branch-3.0-perf
Commit: d04ce2e87442534bb27aff4ff0f5647b36945a72
Parents: be73d16
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Sep 29 12:37:19 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Sep 29 12:37:19 2017 +0300
----------------------------------------------------------------------
.../ambari_agent/CustomServiceOrchestrator.py | 4 +-
.../main/python/ambari_agent/HeartbeatThread.py | 2 +-
.../actionmanager/ExecutionCommandWrapper.java | 2 -
.../server/api/services/AmbariMetaInfo.java | 1 -
.../AmbariManagementControllerImpl.java | 2 -
.../internal/AbstractProviderModule.java | 5 +-
.../ClusterStackVersionResourceProvider.java | 3 -
.../internal/ComponentResourceProvider.java | 2 +-
.../ambari/server/orm/dao/RequestDAO.java | 1 -
.../server/state/cluster/ClusterImpl.java | 3 -
.../server/state/cluster/ClustersImpl.java | 1 -
.../svccomphost/ServiceComponentHostImpl.java | 1 -
.../templates/input.config-zeppelin.json.j2 | 48 ------
.../stacks/HDP/2.6/upgrades/config-upgrade.xml | 125 --------------
.../actionmanager/TestActionScheduler.java | 6 +-
.../server/agent/DummyHeartbeatConstants.java | 1 +
.../server/agent/HeartbeatProcessorTest.java | 3 +-
.../server/agent/TestHeartbeatHandler.java | 1 -
.../configuration/RecoveryConfigHelperTest.java | 1 -
.../AmbariCustomCommandExecutionHelperTest.java | 9 +-
.../upgrade/StackVersionListenerTest.java | 2 +-
.../ambari/server/state/UpgradeHelperTest.java | 11 +-
.../state/alerts/InitialAlertEventTest.java | 2 +-
.../server/upgrade/UpgradeCatalog300Test.java | 57 -------
ambari-web/app/mixins/common/persist.js | 166 +++++++++++++++++++
25 files changed, 193 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 9f3e9a2..2270dce 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -84,8 +84,8 @@ class CustomServiceOrchestrator():
self.host_level_params_cache = initializer_module.host_level_params_cache
self.config = initializer_module.config
self.tmp_dir = self.config.get('agent', 'prefix')
- self.force_https_protocol = self.config.get_force_https_protocol()
- self.ca_cert_file_path = config.get_ca_cert_file_path()
+ self.force_https_protocol = self.config.get_force_https_protocol_name()
+ self.ca_cert_file_path = self.config.get_ca_cert_file_path()
self.exec_tmp_dir = Constants.AGENT_TMP_DIR
self.file_cache = initializer_module.file_cache
self.status_commands_stdout = os.path.join(self.tmp_dir,
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py b/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
index 2d9e5cc..c0325ff 100644
--- a/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
+++ b/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
@@ -71,7 +71,7 @@ class HeartbeatThread(threading.Thread):
(Constants.METADATA_REQUEST_ENDPOINT, initializer_module.metadata_cache, self.metadata_events_listener),
(Constants.CONFIGURATIONS_REQUEST_ENDPOINT, initializer_module.configurations_cache, self.configuration_events_listener),
(Constants.HOST_LEVEL_PARAMS_TOPIC_ENPOINT, initializer_module.host_level_params_cache, self.host_level_params_events_listener),
- (Constants.ALERTS_DEFINITIONS_REQUEST_ENDPOINT, initializer_module.alert_definitions_cache, self.alert_definitions_events_listener)
+ #(Constants.ALERTS_DEFINITIONS_REQUEST_ENDPOINT, initializer_module.alert_definitions_cache, self.alert_definitions_events_listener)
]
self.responseId = 0
self.file_cache = initializer_module.file_cache
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
index ea208e8..903619e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java
@@ -20,7 +20,6 @@ package org.apache.ambari.server.actionmanager;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER;
-import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -47,7 +46,6 @@ import org.apache.ambari.server.state.StackInfo;
import org.apache.ambari.server.state.UpgradeContext;
import org.apache.ambari.server.state.UpgradeContext.UpgradeSummary;
import org.apache.ambari.server.state.UpgradeContextFactory;
-import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/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 5f4ba17..1787b49 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
@@ -72,7 +72,6 @@ import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.OperatingSystemInfo;
import org.apache.ambari.server.state.PropertyInfo;
import org.apache.ambari.server.state.RepositoryInfo;
-import org.apache.ambari.server.state.RepositoryVersionState;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceInfo;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index d14bd33..8769da9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -44,7 +44,6 @@ import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.MYSQL_JDB
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.NOT_MANAGED_HDFS_PATH_LIST;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.ORACLE_JDBC_URL;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_LIST;
-import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.PACKAGE_VERSION;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.REPO_INFO;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT;
import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SCRIPT_TYPE;
@@ -103,7 +102,6 @@ import org.apache.ambari.server.actionmanager.RequestFactory;
import org.apache.ambari.server.actionmanager.Stage;
import org.apache.ambari.server.actionmanager.StageFactory;
import org.apache.ambari.server.agent.ExecutionCommand;
-import org.apache.ambari.server.agent.ExecutionCommand.KeyNames;
import org.apache.ambari.server.agent.stomp.AgentConfigsHolder;
import org.apache.ambari.server.agent.stomp.MetadataHolder;
import org.apache.ambari.server.agent.stomp.TopologyHolder;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index e0df487..82ff972 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -51,7 +51,6 @@ import org.apache.ambari.server.controller.spi.NoSuchResourceException;
import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.PropertyProvider;
import org.apache.ambari.server.controller.spi.ProviderModule;
-import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.spi.SystemException;
@@ -297,6 +296,10 @@ public abstract class AbstractProviderModule implements ProviderModule,
if (null == metricsCollectorHAManager && null != managementController) {
metricsCollectorHAManager = managementController.getMetricsCollectorHAManager();
}
+
+ if (null == clusters && null != managementController) {
+ clusters = managementController.getClusters();
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 5d75b99..4d5a4ac 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -41,9 +41,6 @@ import org.apache.ambari.server.actionmanager.ActionManager;
import org.apache.ambari.server.actionmanager.RequestFactory;
import org.apache.ambari.server.actionmanager.Stage;
import org.apache.ambari.server.actionmanager.StageFactory;
-import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.agent.ExecutionCommand;
-import org.apache.ambari.server.agent.ExecutionCommand.KeyNames;
import org.apache.ambari.server.agent.stomp.MetadataHolder;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index 447d7e8..1d5ee2b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -64,8 +64,8 @@ import org.apache.ambari.server.topology.TopologyDeleteFormer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
-import com.google.inject.Inject;
import com.google.common.collect.Sets;
+import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import com.google.inject.persist.Transactional;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java
index c97f4cf..d80ddd8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java
@@ -52,7 +52,6 @@ import org.eclipse.persistence.config.QueryHints;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.google.inject.Provider;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index e6da65e..7d874b5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -60,7 +60,6 @@ import org.apache.ambari.server.controller.MaintenanceStateHelper;
import org.apache.ambari.server.controller.RootServiceResponseFactory.Services;
import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
import org.apache.ambari.server.controller.internal.DeleteHostComponentStatusMetaData;
-import org.apache.ambari.server.controller.internal.UpgradeResourceProvider;
import org.apache.ambari.server.events.AmbariEvent.AmbariEventType;
import org.apache.ambari.server.events.ClusterConfigChangedEvent;
import org.apache.ambari.server.events.ClusterEvent;
@@ -136,8 +135,6 @@ import org.apache.ambari.server.state.repository.ClusterVersionSummary;
import org.apache.ambari.server.state.repository.VersionDefinitionXml;
import org.apache.ambari.server.state.scheduler.RequestExecution;
import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
-import org.apache.ambari.server.state.stack.upgrade.Direction;
-import org.apache.ambari.server.state.svccomphost.ServiceComponentHostSummary;
import org.apache.ambari.server.topology.TopologyDeleteFormer;
import org.apache.ambari.server.topology.TopologyRequest;
import org.apache.commons.collections.CollectionUtils;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
index 8743f63..59f83ef 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
@@ -41,7 +41,6 @@ import org.apache.ambari.server.agent.DiskInfo;
import org.apache.ambari.server.agent.stomp.MetadataHolder;
import org.apache.ambari.server.agent.stomp.TopologyHolder;
import org.apache.ambari.server.agent.stomp.dto.TopologyCluster;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.AmbariManagementControllerImpl;
import org.apache.ambari.server.events.HostRegisteredEvent;
import org.apache.ambari.server.events.HostsAddedEvent;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index ecb616a..5141a4b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -25,7 +25,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/templates/input.config-zeppelin.json.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/templates/input.config-zeppelin.json.j2 b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/templates/input.config-zeppelin.json.j2
deleted file mode 100644
index 2b373d5..0000000
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/templates/input.config-zeppelin.json.j2
+++ /dev/null
@@ -1,48 +0,0 @@
-{#
- # Licensed to the Apache Software Foundation (ASF) under one
- # or more contributor license agreements. See the NOTICE file
- # distributed with this work for additional information
- # regarding copyright ownership. The ASF licenses this file
- # to you under the Apache License, Version 2.0 (the
- # "License"); you may not use this file except in compliance
- # with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #}
-{
- "input":[
- {
- "type":"zeppelin",
- "rowtype":"service",
- "path":"{{default('/configurations/zeppelin-env/zeppelin_log_dir', '/var/log/zeppelin')}}/zeppelin-zeppelin-*.log"
- }
- ],
- "filter":[
- {
- "filter":"grok",
- "conditions":{
- "fields":{
- "type":[
- "zeppelin"
- ]
- }
- },
- "log4j_format":"",
- "multiline_pattern":"^(%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\])",
- "message_pattern":"(?m)^%{SPACE}%{LOGLEVEL:level}%{SPACE}\\[%{TIMESTAMP_ISO8601:logtime}\\]%{SPACE}\\(\\{{"{"}}%{DATA:thread_name}\\{{"}"}}%{SPACE}%{JAVAFILE:file}\\[%{JAVAMETHOD:method}\\]:%{INT:line_number}\\)%{SPACE}-%{SPACE}%{GREEDYDATA:log_message}",
- "post_map_values":{
- "logtime":{
- "map_date":{
- "target_date_pattern":"yyyy-MM-dd HH:mm:ss,SSS"
- }
- }
- }
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
index 4a89fd4..2b4c656 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/upgrades/config-upgrade.xml
@@ -246,130 +246,5 @@
</component>
</service>
- <service name="HDFS">
- <component name="NAMENODE">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hdfs_plugin_cluster_name">
- <type>ranger-hdfs-audit</type>
- <set key="ranger.plugin.hdfs.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-hdfs-plugin-properties" if-key="ranger-hdfs-plugin-enabled" if-key-state="present"/>
- </definition>
-
- <definition xsi:type="configure" id="hdfs_namenode_prevent_gc_heuristics" summary="Prevent Garbage Collection Heuristics">
- <type>hadoop-env</type>
- <replace key="content" find="-XX:+PrintGCDateStamps -Xms{{namenode_heapsize}}" replace-with="-XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xms{{namenode_heapsize}}"/>
- <replace key="content" find="-XX:+PrintGCDateStamps ${HADOOP_NAMENODE_INIT_HEAPSIZE}" replace-with="-XX:+PrintGCDateStamps -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly ${HADOOP_NAMENODE_INIT_HEAPSIZE}"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="HIVE">
- <component name="HIVE_SERVER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hive_plugin_cluster_name">
- <type>ranger-hive-audit</type>
- <set key="ranger.plugin.hive.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-hive-audit" if-key="xasecure.audit.destination.solr" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="HBASE">
- <component name="HBASE_MASTER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_hbase_plugin_cluster_name">
- <type>ranger-hbase-audit</type>
- <set key="ranger.plugin.hbase.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-hbase-plugin-properties" if-key="ranger-hbase-plugin-enabled" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="KNOX">
- <component name="KNOX_GATEWAY">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_knox_plugin_cluster_name">
- <type>ranger-knox-audit</type>
- <set key="ranger.plugin.knox.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-knox-plugin-properties" if-key="ranger-knox-plugin-enabled" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="STORM">
- <component name="NIMBUS">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_storm_plugin_cluster_name">
- <type>ranger-storm-audit</type>
- <set key="ranger.plugin.storm.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-storm-plugin-properties" if-key="ranger-storm-plugin-enabled" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="YARN">
- <component name="RESOURCEMANAGER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_yarn_plugin_cluster_name">
- <type>ranger-yarn-audit</type>
- <set key="ranger.plugin.yarn.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-yarn-plugin-properties" if-key="ranger-yarn-plugin-enabled" if-key-state="present"/>
- </definition>
- <definition xsi:type="configure" id="hdp_2_6_yarn_preemption" summary="Resource Manager Preemption Settings">
- <type>yarn-site</type>
- <set key="yarn.resourcemanager.monitor.capacity.preemption.total_preemption_per_round" value="0.1"
- if-type="yarn-site"
- if-key="yarn.resourcemanager.monitor.capacity.preemption.total_preemption_per_round"
- if-key-state="absent" />
- <set key="yarn.resourcemanager.monitor.capacity.preemption.natural_termination_factor" value="1"
- if-type="yarn-site"
- if-key="yarn.resourcemanager.monitor.capacity.preemption.natural_termination_factor"
- if-key-state="absent" />
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="KAFKA">
- <component name="KAFKA_BROKER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_kafka_plugin_cluster_name">
- <type>ranger-kafka-audit</type>
- <set key="ranger.plugin.kafka.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-kafka-plugin-properties" if-key="ranger-kafka-plugin-enabled" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="ATLAS">
- <component name="ATLAS_SERVER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_atlas_plugin_cluster_name">
- <type>ranger-atlas-audit</type>
- <set key="ranger.plugin.atlas.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-atlas-plugin-properties" if-key="ranger-atlas-plugin-enabled" if-key-state="present"/>
- </definition>
- </changes>
- </component>
- </service>
-
- <service name="RANGER_KMS">
- <component name="RANGER_KMS_SERVER">
- <changes>
- <definition xsi:type="configure" id="hdp_2_6_maint_ranger_kms_plugin_cluster_name">
- <type>ranger-kms-audit</type>
- <set key="ranger.plugin.kms.ambari.cluster.name" value="{{cluster_name}}"
- if-type="ranger-kms-audit" if-key="ranger.plugin.kms.ambari.cluster.name" if-key-state="absent"/>
- </definition>
- </changes>
- </component>
- </service>
-
</services>
</upgrade-config-changes>
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index 439a554..c680776 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -214,7 +214,7 @@ public class TestActionScheduler {
ActionDBAccessor db = mock(ActionDBAccessorImpl.class);
HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
- Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
+ Stage s = StageUtils.getATestStage(1, 977, hostname,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
List<Stage> stages = Collections.singletonList(s);
@@ -412,7 +412,7 @@ public class TestActionScheduler {
hostEntity.setHostName(hostname);
hostDAO.create(hostEntity);
- final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
+ final Stage s = StageUtils.getATestStage(1, 977, hostname,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
s.addHostRoleExecutionCommand(hostname, Role.SECONDARY_NAMENODE, RoleCommand.INSTALL,
new ServiceComponentHostInstallEvent("SECONDARY_NAMENODE", hostname, System.currentTimeMillis(), "HDP-1.2.0"),
@@ -502,7 +502,7 @@ public class TestActionScheduler {
when(host.getState()).thenReturn(HostState.HEARTBEAT_LOST);
when(host.getHostName()).thenReturn(hostname);
- final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
+ final Stage s = StageUtils.getATestStage(1, 977, hostname,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
List<Stage> stages = Collections.singletonList(s);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java
index 69980dc..c191a4d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/DummyHeartbeatConstants.java
@@ -22,6 +22,7 @@ import org.apache.ambari.server.Role;
public interface DummyHeartbeatConstants {
String DummyCluster = "cluster1";
+ String DummyClusterId = "1";
String DummyHostname1 = "host1";
String DummyHostname2 = "host2";
String DummyHostname3 = "host3";
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
index f55db08..f2d9c86 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
@@ -19,6 +19,7 @@ package org.apache.ambari.server.agent;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DATANODE;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DummyCluster;
+import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DummyClusterId;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DummyHostStatus;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DummyHostname1;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.DummyOSRelease;
@@ -1181,7 +1182,7 @@ public class HeartbeatProcessorTest {
cmdReport.setRoleCommand(RoleCommand.ACTIONEXECUTE.name());
cmdReport.setStatus(HostRoleStatus.COMPLETED.name());
cmdReport.setRole("install_packages");
- cmdReport.setClusterName(DummyCluster);
+ cmdReport.setClusterId(DummyClusterId);
List<CommandReport> reports = new ArrayList<>();
reports.add(cmdReport);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index 4b4da49..92b8429 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -30,7 +30,6 @@ import static org.apache.ambari.server.agent.DummyHeartbeatConstants.HDFS;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.HDFS_CLIENT;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.NAMENODE;
import static org.apache.ambari.server.agent.DummyHeartbeatConstants.SECONDARY_NAMENODE;
-import static org.apache.ambari.server.controller.KerberosHelperImpl.SET_KEYTAB;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.reset;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java
index 1b37435..7b65f06 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/RecoveryConfigHelperTest.java
@@ -37,7 +37,6 @@ import org.apache.ambari.server.agent.HeartbeatTestHelper;
import org.apache.ambari.server.agent.RecoveryConfig;
import org.apache.ambari.server.agent.RecoveryConfigHelper;
import org.apache.ambari.server.controller.internal.DeleteHostComponentStatusMetaData;
-import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.orm.OrmTestHelper;
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
index 883e891..87ca569 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java
@@ -39,6 +39,7 @@ import org.apache.ambari.server.actionmanager.Request;
import org.apache.ambari.server.actionmanager.Stage;
import org.apache.ambari.server.agent.CommandRepository;
import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.configuration.Configuration;
import org.apache.ambari.server.controller.internal.ComponentResourceProviderTest;
import org.apache.ambari.server.controller.internal.RequestOperationLevel;
@@ -573,13 +574,13 @@ public class AmbariCustomCommandExecutionHelperTest {
ServiceComponent componentZKC = serviceZK.getServiceComponent("ZOOKEEPER_CLIENT");
Host host = clusters.getHost("c1-c6401");
- AmbariCustomCommandExecutionHelper helper = injector.getInstance(AmbariCustomCommandExecutionHelper.class);
+ AmbariMetaInfo ambariMetaInfo = injector.getInstance(AmbariMetaInfo.class);
StackDAO stackDAO = injector.getInstance(StackDAO.class);
RepositoryVersionDAO repoVersionDAO = injector.getInstance(RepositoryVersionDAO.class);
ServiceComponentDesiredStateDAO componentDAO = injector.getInstance(ServiceComponentDesiredStateDAO.class);
RepositoryVersionHelper repoVersionHelper = injector.getInstance(RepositoryVersionHelper.class);
- CommandRepository commandRepo = helper.getCommandRepository(cluster, componentRM, host);
+ CommandRepository commandRepo = ambariMetaInfo.getCommandRepository(cluster, componentRM, host);
Assert.assertEquals(0, commandRepo.getRepositories().size());
@@ -610,14 +611,14 @@ public class AmbariCustomCommandExecutionHelperTest {
componentEntity = componentDAO.merge(componentEntity);
// !!! make sure the override is set
- commandRepo = helper.getCommandRepository(cluster, componentRM, host);
+ commandRepo = ambariMetaInfo.getCommandRepository(cluster, componentRM, host);
Assert.assertEquals(1, commandRepo.getRepositories().size());
CommandRepository.Repository repo = commandRepo.getRepositories().iterator().next();
Assert.assertEquals("http://foo", repo.getBaseUrl());
// verify that ZK has no repositories, since we haven't defined a repo version for ZKC
- commandRepo = helper.getCommandRepository(cluster, componentZKC, host);
+ commandRepo = ambariMetaInfo.getCommandRepository(cluster, componentZKC, host);
Assert.assertEquals(0, commandRepo.getRepositories().size());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
index ff6fab9..b066324 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackVersionListenerTest.java
@@ -241,7 +241,7 @@ public class StackVersionListenerTest extends EasyMockSupport {
}
@Test
- public void testSetUpgradeStateToVersionMismatchWhenUpgradeIsInProgressAndNewVersionIsNotEqualToComponentDesiredVersion() {
+ public void testSetUpgradeStateToVersionMismatchWhenUpgradeIsInProgressAndNewVersionIsNotEqualToComponentDesiredVersion() throws AmbariException {
expect(sch.getVersion()).andReturn(VALID_PREVIOUS_VERSION);
expect(sch.getUpgradeState()).andReturn(UpgradeState.IN_PROGRESS);
expect(componentInfo.isVersionAdvertised()).andReturn(true).once();
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index 677b607..b875db6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -49,6 +49,7 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.controller.ClusterRequest;
import org.apache.ambari.server.controller.ConfigurationRequest;
+import org.apache.ambari.server.controller.internal.DeleteHostComponentStatusMetaData;
import org.apache.ambari.server.controller.internal.UpgradeResourceProvider;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
@@ -2513,8 +2514,8 @@ public class UpgradeHelperTest extends EasyMockSupport {
assertNotNull(upgrade);
Cluster cluster = makeCluster();
- cluster.deleteService("HDFS");
- cluster.deleteService("YARN");
+ cluster.deleteService("HDFS", new DeleteHostComponentStatusMetaData());
+ cluster.deleteService("YARN", new DeleteHostComponentStatusMetaData());
UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE,
UpgradeType.ROLLING, repositoryVersion2110);
@@ -2543,9 +2544,9 @@ public class UpgradeHelperTest extends EasyMockSupport {
assertNotNull(upgrade);
Cluster cluster = makeCluster();
- cluster.deleteService("HDFS");
- cluster.deleteService("YARN");
- cluster.deleteService("ZOOKEEPER");
+ cluster.deleteService("HDFS", new DeleteHostComponentStatusMetaData());
+ cluster.deleteService("YARN", new DeleteHostComponentStatusMetaData());
+ cluster.deleteService("ZOOKEEPER", new DeleteHostComponentStatusMetaData());
UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE,
UpgradeType.ROLLING, repositoryVersion2110);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
index 3d25ef7..88db216 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
@@ -152,7 +152,7 @@ public class InitialAlertEventTest {
definition.getServiceName(), definition.getComponentName(), null,
AlertState.CRITICAL);
- alert.setCluster(m_clusterName);
+ alert.setClusterId(m_cluster.getClusterId());
AlertReceivedEvent event = new AlertReceivedEvent(m_cluster.getClusterId(), alert);
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index 95a04de..25e9dbf 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@ -55,7 +55,6 @@ import org.apache.ambari.server.state.ConfigHelper;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.stack.OsFamily;
import org.easymock.Capture;
-import org.easymock.CaptureType;
import org.easymock.EasyMock;
import org.easymock.EasyMockRunner;
import org.easymock.EasyMockSupport;
@@ -365,60 +364,4 @@ public class UpgradeCatalog300Test {
Map<String, String> updatedLogFeederOutputConf = logFeederOutputConfCapture.getValue();
assertTrue(Maps.difference(expectedLogFeederOutputConf, updatedLogFeederOutputConf).areEqual());
}
-
- @Test
- public void testLogSearchUpdateConfigs() throws Exception {
- reset(clusters, cluster);
- expect(clusters.getClusters()).andReturn(ImmutableMap.of("normal", cluster)).once();
-
- EasyMockSupport easyMockSupport = new EasyMockSupport();
-
- Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
- AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
- .addMockedMethod("createConfiguration")
- .addMockedMethod("getClusters", new Class[]{})
- .addMockedMethod("createConfig")
- .withConstructor(actionManager, clusters, injector)
- .createNiceMock();
-
- expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
- expect(controller.getClusters()).andReturn(clusters).anyTimes();
-
- Config confSomethingElse1 = easyMockSupport.createNiceMock(Config.class);
- expect(confSomethingElse1.getType()).andReturn("something-else-1");
- Config confSomethingElse2 = easyMockSupport.createNiceMock(Config.class);
- expect(confSomethingElse2.getType()).andReturn("something-else-2");
- Config confLogSearchConf1 = easyMockSupport.createNiceMock(Config.class);
- expect(confLogSearchConf1.getType()).andReturn("service-1-logsearch-conf");
- Config confLogSearchConf2 = easyMockSupport.createNiceMock(Config.class);
- expect(confLogSearchConf2.getType()).andReturn("service-2-logsearch-conf");
-
- Map<String, String> oldLogSearchConf = ImmutableMap.of(
- "service_name", "Service",
- "component_mappings", "Component Mappings",
- "content", "Content");
-
- Collection<Config> configs = Arrays.asList(confSomethingElse1, confLogSearchConf1, confSomethingElse2, confLogSearchConf2);
-
- expect(cluster.getAllConfigs()).andReturn(configs).atLeastOnce();
- expect(cluster.getDesiredConfigByType("service-1-logsearch-conf")).andReturn(confLogSearchConf1).once();
- expect(cluster.getDesiredConfigByType("service-2-logsearch-conf")).andReturn(confLogSearchConf2).once();
- expect(confLogSearchConf1.getProperties()).andReturn(oldLogSearchConf).once();
- expect(confLogSearchConf2.getProperties()).andReturn(oldLogSearchConf).once();
- Capture<Map<String, String>> logSearchConfCapture = EasyMock.newCapture(CaptureType.ALL);
- expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(logSearchConfCapture), anyString(),
- EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).times(2);
-
- replay(clusters, cluster);
- replay(controller, injector2);
- replay(confSomethingElse1, confSomethingElse2, confLogSearchConf1, confLogSearchConf2);
- new UpgradeCatalog300(injector2).updateLogSearchConfigs();
- easyMockSupport.verifyAll();
-
- List<Map<String, String>> updatedLogSearchConfs = logSearchConfCapture.getValues();
- assertEquals(updatedLogSearchConfs.size(), 2);
- for (Map<String, String> updatedLogSearchConf : updatedLogSearchConfs) {
- assertTrue(Maps.difference(Collections.<String, String> emptyMap(), updatedLogSearchConf).areEqual());
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/d04ce2e8/ambari-web/app/mixins/common/persist.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/persist.js b/ambari-web/app/mixins/common/persist.js
index e69de29..4475112 100644
--- a/ambari-web/app/mixins/common/persist.js
+++ b/ambari-web/app/mixins/common/persist.js
@@ -0,0 +1,166 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+var LZString = require('utils/lz-string');
+
+/**
+ * Small mixin for processing user preferences
+ * Provide methods to save/load some values in <code>persist</code> storage
+ * Save available only for admin users!
+ * When using this mixin you should redeclare methods:
+ * <ul>
+ * <li>getUserPrefSuccessCallback</li>
+ * <li>getUserPrefErrorCallback</li>
+ * <li>postUserPrefSuccessCallback</li>
+ * <li>postUserPrefErrorCallback</li>
+ * </ul>
+ * @type {Em.Mixin}
+ */
+App.Persist = Em.Mixin.create({
+
+ /**
+ * Additional to request data
+ * @type {object}
+ */
+ additionalData: {},
+
+ /**
+ * Get persist value from server with persistKey
+ * @param {String} key
+ */
+ getUserPref: function(key) {
+ return App.ajax.send({
+ name: 'persist.get',
+ sender: this,
+ data: {
+ key: key,
+ data: this.get('additionalData')
+ },
+ success: 'getUserPrefSuccessCallback',
+ error: 'getUserPrefErrorCallback'
+ });
+ },
+
+ /**
+ *
+ * @param {string} key
+ * @returns {$.Deferred}
+ */
+ getDecompressedData: function(key) {
+ var dfd = $.Deferred();
+ App.ajax.send({
+ name: 'persist.get.text',
+ sender: this,
+ data: {
+ key: key
+ }
+ }).always(function(data, textStatus, error) {
+ if (data && typeof data === 'string') {
+ dfd.resolve(JSON.parse(LZString.decompressFromBase64(data)));
+ } else {
+ dfd.reject({error: error});
+ }
+ });
+ return dfd.promise();
+ },
+
+ /**
+ * Should be redefined in objects that use this mixin
+ * @param {*} response
+ * @param {Object} request
+ * @param {Object} data
+ * @returns {*}
+ */
+ getUserPrefSuccessCallback: function (response, request, data) {},
+
+ /**
+ * Should be redefined in objects that use this mixin
+ * @param {Object} request
+ * @param {Object} ajaxOptions
+ * @param {String} error
+ */
+ getUserPrefErrorCallback: function (request, ajaxOptions, error) {},
+
+ /**
+ * Post persist key/value to server, value is object
+ * Only for admin users!
+ * @param {String} key
+ * @param {Object} value
+ */
+ postUserPref: function (key, value) {
+ if (!App.isAuthorized('CLUSTER.MANAGE_USER_PERSISTED_DATA')) {
+ return $.Deferred().reject().promise();
+ }
+ var keyValuePair = {};
+ keyValuePair[key] = JSON.stringify(value);
+ return this.post(keyValuePair);
+ },
+
+ /**
+ *
+ * @param {string} key
+ * @param {Object} value
+ * @returns {$.ajax}
+ */
+ postCompressedData: function (key, value) {
+ var keyValuePair = {};
+ keyValuePair[key] = !Em.isEmpty(value) ? LZString.compressToBase64(JSON.stringify(value)) : '';
+ return this.post(keyValuePair);
+ },
+
+ post: function(keyValuePair) {
+ return App.ajax.send({
+ 'name': 'persist.post',
+ 'sender': this,
+ 'beforeSend': 'postUserPrefBeforeSend',
+ 'data': {
+ 'keyValuePair': keyValuePair
+ },
+ 'success': 'postUserPrefSuccessCallback',
+ 'error': 'postUserPrefErrorCallback'
+ });
+ },
+
+ /**
+ * Should be redefined in objects that use this mixin
+ * @param {*} response
+ * @param {Object} request
+ * @param {Object} data
+ * @returns {*}
+ */
+ postUserPrefSuccessCallback: function (response, request, data) {},
+
+ /**
+ * Should be redefined in objects that use this mixin
+ * @param {Object} request
+ * @param {Object} ajaxOptions
+ * @param {String} error
+ */
+ postUserPrefErrorCallback: function(request, ajaxOptions, error) {},
+
+ /**
+ * Little log before post request
+ * @param {Object} request
+ * @param {Object} ajaxOptions
+ * @param {Object} data
+ */
+ postUserPrefBeforeSend: function(request, ajaxOptions, data){
+ }
+
+});