ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-22104. Refactor existing server side actions to use the common AbstractUpgradeServerAction (dlysnichenko)
Date Tue, 03 Oct 2017 14:38:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1f00c19d0 -> 1032bc5d3


AMBARI-22104. Refactor existing server side actions to use the common AbstractUpgradeServerAction (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 1032bc5d38b518429d953049fc043da3d6ddfc9d
Parents: 1f00c19
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Tue Oct 3 17:37:02 2017 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Tue Oct 3 17:37:02 2017 +0300

----------------------------------------------------------------------
 .../upgrades/AbstractUpgradeServerAction.java      |  6 +++++-
 .../upgrades/AutoSkipFailedSummaryAction.java      | 15 ++-------------
 .../upgrades/ComponentVersionCheckAction.java      |  2 +-
 .../serveraction/upgrades/ConfigureAction.java     | 11 ++---------
 .../upgrades/FinalizeUpgradeAction.java            |  2 +-
 .../FixCapacitySchedulerOrderingPolicy.java        | 12 ++----------
 .../serveraction/upgrades/FixLzoCodecPath.java     | 10 ++--------
 .../serveraction/upgrades/FixOozieAdminUsers.java  | 10 ++--------
 .../upgrades/FixYarnWebServiceUrl.java             | 11 ++---------
 .../upgrades/HBaseConfigCalculation.java           | 10 ++--------
 .../HBaseEnvMaxDirectMemorySizeAction.java         | 11 ++---------
 .../upgrades/HiveEnvClasspathAction.java           | 11 ++---------
 .../upgrades/HiveZKQuorumConfigAction.java         | 13 ++-----------
 .../upgrades/KerberosKeytabsAction.java            | 13 ++-----------
 .../serveraction/upgrades/ManualStageAction.java   |  3 +--
 .../upgrades/OozieConfigCalculation.java           | 11 ++---------
 .../upgrades/PreconfigureKerberosAction.java       |  2 +-
 .../upgrades/RangerConfigCalculation.java          | 11 ++---------
 .../upgrades/RangerKerberosConfigCalculation.java  | 11 ++---------
 .../upgrades/RangerKmsProxyConfig.java             | 11 ++---------
 .../upgrades/RangerUsersyncConfigCalculation.java  | 11 ++---------
 .../upgrades/RangerWebAlertConfigAction.java       |  9 ++-------
 .../upgrades/SparkShufflePropertyConfig.java       | 11 ++---------
 .../upgrades/UpdateDesiredRepositoryAction.java    | 10 +---------
 .../upgrades/UpgradeUserKerberosDescriptor.java    |  6 +-----
 .../upgrades/YarnConfigCalculation.java            | 11 ++---------
 .../FixCapacitySchedulerOrderingPolicyTest.java    |  2 +-
 .../upgrades/FixOozieAdminUsersTest.java           |  2 +-
 .../upgrades/FixYarnWebServiceUrlTest.java         |  2 +-
 .../HBaseEnvMaxDirectMemorySizeActionTest.java     |  2 +-
 .../upgrades/HiveEnvClasspathActionTest.java       |  2 +-
 .../upgrades/HiveZKQuorumConfigActionTest.java     |  2 +-
 .../upgrades/KerberosKeytabsActionTest.java        | 17 +++++++++++++++++
 .../upgrades/RangerConfigCalculationTest.java      |  2 +-
 .../RangerKerberosConfigCalculationTest.java       |  2 +-
 .../upgrades/RangerKmsProxyConfigTest.java         |  2 +-
 .../RangerUsersyncConfigCalculationTest.java       |  2 +-
 .../upgrades/RangerWebAlertConfigActionTest.java   |  9 ++++++++-
 .../upgrades/SparkShufflePropertyConfigTest.java   |  2 +-
 .../UpgradeUserKerberosDescriptorTest.java         |  4 ++--
 40 files changed, 87 insertions(+), 209 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java
index 8ebb186..80c73f8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java
@@ -33,8 +33,12 @@ import com.google.inject.Inject;
  */
 public abstract class AbstractUpgradeServerAction extends AbstractServerAction {
 
+  public Clusters getClusters() {
+    return m_clusters;
+  }
+
   @Inject
-  protected Clusters m_clusters;
+  private Clusters m_clusters;
 
   /**
    * Used to move desired repo versions forward.

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java
index 664cb2c..1abd947 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryAction.java
@@ -36,13 +36,10 @@ import org.apache.ambari.server.actionmanager.ServiceComponentHostEventWrapper;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.metadata.ActionMetadata;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
-import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.UpgradeGroupEntity;
 import org.apache.ambari.server.orm.entities.UpgradeItemEntity;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ServiceComponentHostEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,7 +54,7 @@ import com.google.inject.Inject;
  * {@link HostRoleStatus#COMPLETED} if there are no skipped failures. Otherwise
  * it will be placed into {@link HostRoleStatus#HOLDING}.
  */
-public class AutoSkipFailedSummaryAction extends AbstractServerAction {
+public class AutoSkipFailedSummaryAction extends AbstractUpgradeServerAction {
 
   /**
    * Logger.
@@ -75,12 +72,6 @@ public class AutoSkipFailedSummaryAction extends AbstractServerAction {
   private static final String FAILURES = "failures";
 
   /**
-   * Used to lookup the {@link UpgradeGroupEntity}.
-   */
-  @Inject
-  private UpgradeDAO m_upgradeDAO;
-
-  /**
    * Used to lookup the tasks that need to be checked for
    * {@link HostRoleStatus#SKIPPED_FAILED}.
    */
@@ -99,8 +90,6 @@ public class AutoSkipFailedSummaryAction extends AbstractServerAction {
   @Inject
   private ActionMetadata actionMetadata;
 
-  @Inject
-  private Clusters clusters;
 
   /**
    * A mapping of host -> Map<key,info> for each failure.
@@ -119,7 +108,7 @@ public class AutoSkipFailedSummaryAction extends AbstractServerAction {
     long stageId = hostRoleCommand.getStageId();
 
     String clusterName = hostRoleCommand.getExecutionCommandWrapper().getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     // use the host role command to get to the parent upgrade group
     UpgradeItemEntity upgradeItem = m_upgradeDAO.findUpgradeItemByRequestAndStage(requestId,stageId);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java
index 44d2b4d..f72637e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java
@@ -48,7 +48,7 @@ public class ComponentVersionCheckAction extends FinalizeUpgradeAction {
 
     String clusterName = getExecutionCommand().getClusterName();
 
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     UpgradeContext upgradeContext = getUpgradeContext(cluster);
     Set<InfoTuple> errors = validateComponentVersions(upgradeContext);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
index ec4d383..a7f910f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
@@ -37,7 +37,6 @@ import org.apache.ambari.server.controller.ConfigurationRequest;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.serveraction.ServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.ConfigMergeHelper;
@@ -89,12 +88,6 @@ public class ConfigureAction extends AbstractUpgradeServerAction {
   private static final Logger LOG = LoggerFactory.getLogger(ConfigureAction.class);
 
   /**
-   * Used to lookup the cluster.
-   */
-  @Inject
-  private Clusters m_clusters;
-
-  /**
    * Used to update the configuration properties.
    */
   @Inject
@@ -183,7 +176,7 @@ public class ConfigureAction extends AbstractUpgradeServerAction {
     }
 
     String clusterName = commandParameters.get("clusterName");
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     UpgradeContext upgradeContext = getUpgradeContext(cluster);
 
     // such as hdfs-site or hbase-env
@@ -591,7 +584,7 @@ public class ConfigureAction extends AbstractUpgradeServerAction {
 
 
     String configType = config.getType();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     StackId oldStack = cluster.getCurrentStackVersion();
 
     // iterate over all properties for every cluster service; if the property

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index 451f802..d6876d9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -84,7 +84,7 @@ public class FinalizeUpgradeAction extends AbstractUpgradeServerAction {
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     UpgradeContext upgradeContext = getUpgradeContext(cluster);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicy.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicy.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicy.java
index f14d702..03dbd27 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicy.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicy.java
@@ -27,20 +27,16 @@ import java.util.regex.Pattern;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * In HDP-2.6, the parent queue's cannot have a ordering-policy other than {@code utilization} or
  * {@code priority-utilization}.
  *
  * This class is used when moving from HDP-2.3/HDP-2.4/HDP-2.5 to HDP2.6
  */
-public class FixCapacitySchedulerOrderingPolicy extends AbstractServerAction {
+public class FixCapacitySchedulerOrderingPolicy extends AbstractUpgradeServerAction {
   private static final String SOURCE_CONFIG_TYPE = "capacity-scheduler";
   private static final String ORDERING_POLICY_SUFFIX = "ordering-policy";
 
@@ -53,17 +49,13 @@ public class FixCapacitySchedulerOrderingPolicy extends AbstractServerAction {
   private static final Pattern ROOT_QUEUE_REGEX = Pattern.compile(
       String.format("%s.([.\\-_\\w]+).queues", CAPACITY_SCHEDULER_PREFIX));
 
-
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
 
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config config = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);
 
     if (null == config) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
index 4833729..4a92327 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixLzoCodecPath.java
@@ -26,20 +26,17 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.commons.lang.StringUtils;
 
-import com.google.inject.Inject;
 
 /**
  * During stack upgrade, update lzo codec path in mapreduce.application.classpath and
  * at tez.cluster.additional.classpath.prefix to look like
  * /usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar
  */
-public class FixLzoCodecPath extends AbstractServerAction {
+public class FixLzoCodecPath extends AbstractUpgradeServerAction {
 
   /**
    * Lists config types and properties that may contain lzo codec path
@@ -49,14 +46,11 @@ public class FixLzoCodecPath extends AbstractServerAction {
     put("tez-site", new String [] {"tez.cluster.additional.classpath.prefix"});
   }};
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     ArrayList<String> modifiedProperties = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsers.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsers.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsers.java
index 75588d5..305825a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsers.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsers.java
@@ -24,34 +24,28 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.commons.lang.StringUtils;
 
-import com.google.inject.Inject;
 
 /**
  * During stack upgrade, update lzo codec path in mapreduce.application.classpath and
  * at tez.cluster.additional.classpath.prefix to look like
  * /usr/hdp/${hdp.version}/hadoop/lib/hadoop-lzo-0.6.0.${hdp.version}.jar
  */
-public class FixOozieAdminUsers extends AbstractServerAction {
+public class FixOozieAdminUsers extends AbstractUpgradeServerAction {
   private static final String TARGET_OOZIE_CONFIG_TYPE = "oozie-env";
   private static final String OOZIE_ADMIN_USERS_PROP = "oozie_admin_users";
   private static final String FALCON_CONFIG_TYPE = "falcon-env";
   private static final String FALCON_USER_PROP = "falcon_user";
 
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config oozieConfig = cluster.getDesiredConfigByType(TARGET_OOZIE_CONFIG_TYPE);
     Config falconConfig = cluster.getDesiredConfigByType(FALCON_CONFIG_TYPE);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrl.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrl.java
index 5823c8b..6a3c5e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrl.java
@@ -23,20 +23,16 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * yarn.log.server.web-service.url is added in HDP 2.6
  * It takes value from yarn.timeline-service.webapp.address if the yarn.http.policy is HTTP_ONLY
  * and takes value from yarn.timeline-service.webapp.https.address if the yarn.http.policy is HTTPS_ONLY.
  * This class is used when moving from HDP-2.3/HDP-2.4/HDP-2.5 to HDP2.6
  */
-public class FixYarnWebServiceUrl extends AbstractServerAction {
+public class FixYarnWebServiceUrl extends AbstractUpgradeServerAction {
     private static final String SOURCE_CONFIG_TYPE = "yarn-site";
     private static final String YARN_TIMELINE_WEBAPP_HTTPADDRESS = "yarn.timeline-service.webapp.address";
     private static final String YARN_TIMELINE_WEBAPP_HTTPSADDRESS = "yarn.timeline-service.webapp.https.address";
@@ -45,15 +41,12 @@ public class FixYarnWebServiceUrl extends AbstractServerAction {
     private static final String HTTP = "HTTP_ONLY";
     private static final String HTTPS = "HTTPS_ONLY";
 
-    @Inject
-    private Clusters clusters;
-
     @Override
     public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
             throws AmbariException, InterruptedException{
 
         String clusterName = getExecutionCommand().getClusterName();
-        Cluster cluster = clusters.getCluster(clusterName);
+        Cluster cluster = getClusters().getCluster(clusterName);
         Config config = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);
 
         if (config == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseConfigCalculation.java
index 739dd7e..aaaec92 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseConfigCalculation.java
@@ -25,25 +25,19 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Computes HBase properties.  This class is only used when moving from
  * HDP-2.2 to HDP-2.3 in that upgrade pack.
  */
-public class HBaseConfigCalculation extends AbstractServerAction {
+public class HBaseConfigCalculation extends AbstractUpgradeServerAction {
   private static final String SOURCE_CONFIG_TYPE = "hbase-site";
   private static final String OLD_UPPER_LIMIT_PROPERTY_NAME = "hbase.regionserver.global.memstore.upperLimit";
   private static final String OLD_LOWER_LIMIT_PROPERTY_NAME = "hbase.regionserver.global.memstore.lowerLimit";
   private static final String NEW_LOWER_LIMIT_PROPERTY_NAME = "hbase.regionserver.global.memstore.size.lower.limit";
 
-  @Inject
-  private Clusters clusters;
 
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
@@ -51,7 +45,7 @@ public class HBaseConfigCalculation extends AbstractServerAction {
 
     String clusterName = getExecutionCommand().getClusterName();
 
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     Config config = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeAction.java
index fb15555..26e3c73 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeAction.java
@@ -26,33 +26,26 @@ import java.util.regex.Pattern;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Computes HBase Env content property.
  * This class is only used when moving from HDP-2.3 to HDP-2.4 and HDP-2.3 to HDP-2.5
  */
-public class HBaseEnvMaxDirectMemorySizeAction extends AbstractServerAction {
+public class HBaseEnvMaxDirectMemorySizeAction extends AbstractUpgradeServerAction {
   private static final String SOURCE_CONFIG_TYPE = "hbase-env";
   private static final String CONTENT_NAME = "content";
   private static final String APPEND_CONTENT_LINE = "export HBASE_MASTER_OPTS=\"$HBASE_MASTER_OPTS {% if hbase_max_direct_memory_size %} -XX:MaxDirectMemorySize={{hbase_max_direct_memory_size}}m {% endif %}\"";
   private static final String CHECK_REGEX = "^.*\\s*(HBASE_MASTER_OPTS)\\s*=.*(XX:MaxDirectMemorySize).*$";
   private static final Pattern REGEX = Pattern.compile(CHECK_REGEX, Pattern.MULTILINE);
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config config = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);
 
     if (config == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathAction.java
index c5000bf..12ef9b5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathAction.java
@@ -26,17 +26,13 @@ import java.util.regex.Pattern;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Append hive-env config type with HIVE_HOME and HIVE_CONF_DIR variables if they are absent
  */
-public class HiveEnvClasspathAction extends AbstractServerAction {
+public class HiveEnvClasspathAction extends AbstractUpgradeServerAction {
   private static final String TARGET_CONFIG_TYPE = "hive-env";
   private static final String CONTENT_PROPERTY_NAME = "content";
 
@@ -48,16 +44,13 @@ public class HiveEnvClasspathAction extends AbstractServerAction {
 
   private static final String VERIFY_REGEXP = "^\\s*export\\s(?<property>%s|%s)\\s*=\\s*.*$";
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
 
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config config = cluster.getDesiredConfigByType(TARGET_CONFIG_TYPE);
 
     if (config == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigAction.java
index 23eacec..c89152b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigAction.java
@@ -23,13 +23,9 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * The {@link HiveZKQuorumConfigAction} is used to ensure that the following
  * settings are correctly set when upgrading a Hive Server:
@@ -48,16 +44,11 @@ import com.google.inject.Inject;
  * Hive that was upgraded previously. They are actually set (incorrectly) on a
  * non-Kerberized Hive installation by the installation wizard.
  */
-public class HiveZKQuorumConfigAction extends AbstractServerAction {
+public class HiveZKQuorumConfigAction extends AbstractUpgradeServerAction {
   protected static final String HIVE_SITE_CONFIG_TYPE = "hive-site";
   protected static final String HIVE_SITE_ZK_QUORUM = "hive.zookeeper.quorum";
   protected static final String HIVE_SITE_ZK_CONNECT_STRING = "hive.cluster.delegation.token.store.zookeeper.connectString";
 
-  /**
-   * Used for retrieving the cluster (and eventually the desired configuration).
-   */
-  @Inject
-  private Clusters m_clusters;
 
   /**
    * {@inheritDoc}
@@ -67,7 +58,7 @@ public class HiveZKQuorumConfigAction extends AbstractServerAction {
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     Config hiveSite = cluster.getDesiredConfigByType(HIVE_SITE_CONFIG_TYPE);
     if (hiveSite == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsAction.java
index 4c6371b..bf48873 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsAction.java
@@ -24,10 +24,8 @@ import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.controller.KerberosHelper;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.serveraction.kerberos.KDCType;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
 import com.google.inject.Inject;
@@ -42,18 +40,11 @@ import com.google.inject.Inject;
  *  <li>If the KDC type is set (KDCType is not {@link KDCType#NONE}, implying manual)</li>
  * </ul>
  */
-public class KerberosKeytabsAction extends AbstractServerAction {
+public class KerberosKeytabsAction extends AbstractUpgradeServerAction {
 
   private static final String KERBEROS_ENV = "kerberos-env";
   private static final String KDC_TYPE_KEY = "kdc_type";
 
-
-  /**
-   * Used for retrieving the cluster (and eventually the desired configuration).
-   */
-  @Inject
-  private Clusters m_clusters;
-
   @Inject
   private KerberosHelper m_kerberosHelper;
 
@@ -63,7 +54,7 @@ public class KerberosKeytabsAction extends AbstractServerAction {
 
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     StringBuilder stdout = new StringBuilder();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ManualStageAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ManualStageAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ManualStageAction.java
index 39b23bc..7faa6f6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ManualStageAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ManualStageAction.java
@@ -22,12 +22,11 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 
 /**
  * Action that represents a manual stage.
  */
-public class ManualStageAction extends AbstractServerAction {
+public class ManualStageAction extends AbstractUpgradeServerAction {
 
   @Override
   public CommandReport execute(

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
index 9b8a7dc..5b64ba6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/OozieConfigCalculation.java
@@ -26,28 +26,21 @@ import java.util.regex.Pattern;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Changes oozie-env during upgrade (adds -Dhdp.version to $HADOOP_OPTS variable)
  */
-public class OozieConfigCalculation extends AbstractServerAction {
+public class OozieConfigCalculation extends AbstractUpgradeServerAction {
   private static final String TARGET_CONFIG_TYPE = "oozie-env";
   private static final String CONTENT_PROPERTY_NAME = "content";
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config config = cluster.getDesiredConfigByType(TARGET_CONFIG_TYPE);
 
     if (config == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
index 30bc47f..d18f333 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/PreconfigureKerberosAction.java
@@ -92,7 +92,7 @@ public class PreconfigureKerberosAction extends AbstractUpgradeServerAction {
 
     if (!isDowngrade()) {
       String clusterName = commandParameters.get("clusterName");
-      Cluster cluster = m_clusters.getCluster(clusterName);
+      Cluster cluster = getClusters().getCluster(clusterName);
 
       if (cluster.getSecurityType() == SecurityType.KERBEROS) {
         StackId stackId;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculation.java
index e53c95f..0e4b650 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculation.java
@@ -24,32 +24,25 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Computes Ranger properties.  This class is only used when moving from
  * HDP-2.2 to HDP-2.3 in that upgrade pack.
  */
-public class RangerConfigCalculation extends AbstractServerAction {
+public class RangerConfigCalculation extends AbstractUpgradeServerAction {
   private static final String SOURCE_CONFIG_TYPE = "admin-properties";
   private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
   private static final String RANGER_ADMIN_SITE_CONFIG_TYPE = "ranger-admin-site";
 
-  @Inject
-  private Clusters m_clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
 
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     Config sourceConfig = cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculation.java
index 348b69e..18f97ee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculation.java
@@ -24,20 +24,16 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.commons.lang.StringUtils;
 
-import com.google.inject.Inject;
-
 /**
 * Computes Ranger properties when upgrading to HDP-2.5
 */
 
-public class RangerKerberosConfigCalculation extends AbstractServerAction {
+public class RangerKerberosConfigCalculation extends AbstractUpgradeServerAction {
   private static final String RANGER_ADMIN_SITE_CONFIG_TYPE = "ranger-admin-site";
   private static final String HADOOP_ENV_CONFIG_TYPE = "hadoop-env";
   private static final String HIVE_ENV_CONFIG_TYPE = "hive-env";
@@ -58,15 +54,12 @@ public class RangerKerberosConfigCalculation extends AbstractServerAction {
   private static final String RANGER_PLUGINS_KAFKA_SERVICE_USER = "ranger.plugins.kafka.serviceuser";
   private static final String RANGER_PLUGINS_KMS_SERVICE_USER = "ranger.plugins.kms.serviceuser";
 
-  @Inject
-  private Clusters m_clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     String errMsg = "";
     String sucessMsg = "";
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfig.java
index 71c3a07..b4299e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfig.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfig.java
@@ -24,31 +24,24 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.SecurityType;
 
-import com.google.inject.Inject;
-
 /**
 * Computes Ranger KMS Proxy properties in kms-site
 */
 
-public class RangerKmsProxyConfig extends AbstractServerAction {
+public class RangerKmsProxyConfig extends AbstractUpgradeServerAction {
   private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
   private static final String RANGER_KMS_SITE_CONFIG_TYPE = "kms-site";
 
-  @Inject
-  private Clusters m_clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
     throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     String outputMsg = "";
 
     Config rangerEnv = cluster.getDesiredConfigByType(RANGER_ENV_CONFIG_TYPE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
index 3573748..54d74be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -25,30 +25,23 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Computes Ranger Usersync ldap grouphierarchylevels property. This class is only used when upgrading from
  * HDP-2.6.x to HDP-2.6.y.
  */
 
-public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+public class RangerUsersyncConfigCalculation extends AbstractUpgradeServerAction {
   private static final String RANGER_USERSYNC_CONFIG_TYPE = "ranger-ugsync-site";
   private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
 
-  @Inject
-  private Clusters m_clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
 
   String clusterName = getExecutionCommand().getClusterName();
-  Cluster cluster = m_clusters.getCluster(clusterName);
+  Cluster cluster = getClusters().getCluster(clusterName);
   String outputMsg = "";
 
   Config rangerUsersyncConfig = cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigAction.java
index a6b94f4..0d10b22 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigAction.java
@@ -29,9 +29,7 @@ import org.apache.ambari.server.events.AlertHashInvalidationEvent;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
 import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.alert.AlertDefinitionHash;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,13 +41,10 @@ import com.google.inject.Inject;
 /**
  * This class is used to update Ranger service alert-check configs in Ambari
  */
-public class RangerWebAlertConfigAction extends AbstractServerAction {
+public class RangerWebAlertConfigAction extends AbstractUpgradeServerAction {
 
 
   @Inject
-  Clusters m_clusters;
-
-  @Inject
   AlertDefinitionDAO alertDefinitionDAO;
 
   @Inject
@@ -73,7 +68,7 @@ public class RangerWebAlertConfigAction extends AbstractServerAction {
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = m_clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     String ranger_admin_process = "ranger_admin_process";
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfig.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfig.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfig.java
index b1aa6e1..f743a30 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfig.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfig.java
@@ -27,14 +27,10 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.commons.lang.StringUtils;
 
-import com.google.inject.Inject;
-
 /**
  * Computes Yarn properties for SPARK.
  *
@@ -44,7 +40,7 @@ import com.google.inject.Inject;
  *
  * These properties available starting from HDP-2.4 stack.
  */
-public class SparkShufflePropertyConfig extends AbstractServerAction {
+public class SparkShufflePropertyConfig extends AbstractUpgradeServerAction {
   private static final String YARN_SITE_CONFIG_TYPE = "yarn-site";
 
   private static final String YARN_NODEMANAGER_AUX_SERVICES = "yarn.nodemanager.aux-services";
@@ -52,15 +48,12 @@ public class SparkShufflePropertyConfig extends AbstractServerAction {
   private static final String YARN_NODEMANAGER_AUX_SERVICES_SPARK_SHUFFLE_CLASS = "yarn.nodemanager.aux-services.spark_shuffle.class";
   private static final String YARN_NODEMANAGER_AUX_SERVICES_SPARK_SHUFFLE_CLASS_VALUE = "org.apache.spark.network.yarn.YarnShuffleService";
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     Config yarnSiteConfig = cluster.getDesiredConfigByType(YARN_SITE_CONFIG_TYPE);
 
     if (yarnSiteConfig == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
index 10d6630..3c6c8e1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredRepositoryAction.java
@@ -34,7 +34,6 @@ import org.apache.ambari.server.orm.entities.HostVersionEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.serveraction.ServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.RepositoryType;
 import org.apache.ambari.server.state.RepositoryVersionState;
 import org.apache.ambari.server.state.UpgradeContext;
@@ -59,13 +58,6 @@ public class UpdateDesiredRepositoryAction extends AbstractUpgradeServerAction {
    */
   private static final Logger LOG = LoggerFactory.getLogger(UpdateDesiredRepositoryAction.class);
 
-
-  /**
-   * The Cluster that this ServerAction implementation is executing on.
-   */
-  @Inject
-  private Clusters clusters;
-
   /**
    * The Ambari configuration.
    */
@@ -86,7 +78,7 @@ public class UpdateDesiredRepositoryAction extends AbstractUpgradeServerAction {
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     UpgradeContext upgradeContext = getUpgradeContext(cluster);
 
     Map<String, String> roleParams = getExecutionCommand().getRoleParams();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptor.java
index 8640600..ef145e4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptor.java
@@ -32,7 +32,6 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.orm.dao.ArtifactDAO;
 import org.apache.ambari.server.orm.entities.ArtifactEntity;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.UpgradeContext;
 import org.apache.ambari.server.state.kerberos.KerberosDescriptor;
@@ -60,9 +59,6 @@ public class UpgradeUserKerberosDescriptor extends AbstractUpgradeServerAction {
   private ArtifactDAO artifactDAO;
 
   @Inject
-  private Clusters clusters;
-
-  @Inject
   private AmbariMetaInfo ambariMetaInfo;
 
   @Inject
@@ -81,7 +77,7 @@ public class UpgradeUserKerberosDescriptor extends AbstractUpgradeServerAction {
       throws AmbariException, InterruptedException {
     HostRoleCommand hostRoleCommand = getHostRoleCommand();
     String clusterName = hostRoleCommand.getExecutionCommandWrapper().getExecutionCommand().getClusterName();
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
     List<String> messages = new ArrayList<>();
     List<String> errorMessages = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
index d638858..c1a472b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/YarnConfigCalculation.java
@@ -24,33 +24,26 @@ import java.util.concurrent.ConcurrentMap;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.serveraction.AbstractServerAction;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 
-import com.google.inject.Inject;
-
 /**
  * Computes Yarn properties.  This class is only used when moving from
  * HDP-2.1 to HDP-2.3 in that upgrade pack.
  */
-public class YarnConfigCalculation extends AbstractServerAction {
+public class YarnConfigCalculation extends AbstractUpgradeServerAction {
   private static final String YARN_SITE_CONFIG_TYPE = "yarn-site";
 
   private static final String YARN_RM_ZK_ADDRESS_PROPERTY_NAME = "yarn.resourcemanager.zk-address";
   private static final String HADOOP_REGISTRY_ZK_QUORUM_PROPERTY_NAME = "hadoop.registry.zk.quorum";
 
-  @Inject
-  private Clusters clusters;
-
   @Override
   public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext)
       throws AmbariException, InterruptedException {
 
     String clusterName = getExecutionCommand().getClusterName();
 
-    Cluster cluster = clusters.getCluster(clusterName);
+    Cluster cluster = getClusters().getCluster(clusterName);
 
     Config yarnSiteConfig = cluster.getDesiredConfigByType(YARN_SITE_CONFIG_TYPE);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicyTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicyTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicyTest.java
index daf1c30..d322658 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicyTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixCapacitySchedulerOrderingPolicyTest.java
@@ -62,7 +62,7 @@ public class FixCapacitySchedulerOrderingPolicyTest {
     injector = EasyMock.createMock(Injector.class);
     clusters = EasyMock.createMock(Clusters.class);
     cluster = EasyMock.createMock(Cluster.class);
-    clustersField = FixCapacitySchedulerOrderingPolicy.class.getDeclaredField("clusters");
+    clustersField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     clustersField.setAccessible(true);
 
     expect(clusters.getCluster((String) anyObject())).andReturn(cluster).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
index fade2dd..bc42a2e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
@@ -78,7 +78,7 @@ public class FixOozieAdminUsersTest {
     expect(injector.getInstance(Clusters.class)).andReturn(clusters).atLeastOnce();
     replay(injector, clusters, falconEnvConfig, oozieEnvConfig);
 
-    clustersField = FixOozieAdminUsers.class.getDeclaredField("clusters");
+    clustersField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     clustersField.setAccessible(true);
 
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
index ffd55eb..17b23e2 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
@@ -61,7 +61,7 @@ public class FixYarnWebServiceUrlTest {
         injector = EasyMock.createMock(Injector.class);
         clusters = EasyMock.createMock(Clusters.class);
         cluster = EasyMock.createMock(Cluster.class);
-        clustersField = FixYarnWebServiceUrl.class.getDeclaredField("clusters");
+        clustersField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
         clustersField.setAccessible(true);
 
         expect(clusters.getCluster((String) anyObject())).andReturn(cluster).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
index d884d74..a5a6b15 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
@@ -138,7 +138,7 @@ public class HBaseEnvMaxDirectMemorySizeActionTest {
 
     replay(injector, clusters, cluster, hbaseEnv);
 
-    m_clusterField = HBaseEnvMaxDirectMemorySizeAction.class.getDeclaredField("clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
index d179db0..1a5a6c8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
@@ -119,7 +119,7 @@ public class HiveEnvClasspathActionTest {
 
     replay(m_injector, m_clusters, cluster, hiveEnv);
 
-    m_clusterField = HiveEnvClasspathAction.class.getDeclaredField("clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java
index 2f047fa..2157568 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java
@@ -64,7 +64,7 @@ public class HiveZKQuorumConfigActionTest {
     EasyMock.expect(m_clusters.getCluster(CLUSTER_NAME)).andReturn(m_cluster).atLeastOnce();
 
     // set the mock objects on the class under test
-    Field m_clusterField = HiveZKQuorumConfigAction.class.getDeclaredField("m_clusters");
+    Field m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
     m_clusterField.set(m_action, m_clusters);
     m_action.setExecutionCommand(m_executionCommand);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
index 3678aa7..8d96b06 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
@@ -26,17 +26,26 @@ import static org.junit.Assert.assertNotNull;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.persistence.EntityManager;
+
 import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.audit.AuditLogger;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.KerberosHelper;
+import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.orm.dao.StackDAO;
+import org.apache.ambari.server.stack.StackManagerFactory;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.SecurityType;
+import org.apache.ambari.server.state.UpgradeContextFactory;
+import org.apache.ambari.server.state.UpgradeHelper;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.commons.lang.StringUtils;
 import org.easymock.EasyMock;
 import org.junit.Assert;
@@ -87,6 +96,14 @@ public class KerberosKeytabsActionTest {
         bind(Clusters.class).toInstance(m_clusters);
         bind(KerberosHelper.class).toInstance(m_kerberosHelper);
         bind(AuditLogger.class).toInstance(EasyMock.createNiceMock(AuditLogger.class));
+        bind(OsFamily.class).toInstance(EasyMock.createNiceMock(OsFamily.class));
+        bind(AmbariManagementController.class).toInstance(EasyMock.createNiceMock(AmbariManagementController.class));
+        bind(UpgradeHelper.class).toInstance(EasyMock.createNiceMock(UpgradeHelper.class));
+        bind(UpgradeContextFactory.class).toInstance(EasyMock.createNiceMock(UpgradeContextFactory.class));
+        bind(StackManagerFactory.class).toInstance(EasyMock.createNiceMock(StackManagerFactory.class));
+        bind(StackDAO.class).toInstance(EasyMock.createNiceMock(StackDAO.class));
+        bind(EntityManager.class).toInstance(EasyMock.createNiceMock(EntityManager.class));
+        bind(DBAccessor.class).toInstance(EasyMock.createNiceMock(DBAccessor.class));
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
index 6527c9b..7e4095d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
@@ -87,7 +87,7 @@ public class RangerConfigCalculationTest {
 
     replay(m_injector, m_clusters, cluster, adminConfig, adminSiteConfig, rangerEnv);
 
-    m_clusterField = RangerConfigCalculation.class.getDeclaredField("m_clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java
index d6a47f5..84c3587 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java
@@ -122,7 +122,7 @@ public class RangerKerberosConfigCalculationTest {
     replay(m_injector, m_clusters, cluster, hadoopConfig, hiveConfig, yarnConfig, hbaseConfig,
         knoxConfig, stormConfig, kafkaConfig, kmsConfig, hdfsSiteConfig, adminSiteConfig);
 
-    m_clusterField = RangerKerberosConfigCalculation.class.getDeclaredField("m_clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
index 2be8db4..34a877b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
@@ -76,7 +76,7 @@ public class RangerKmsProxyConfigTest {
 
     replay(m_injector, m_clusters, cluster, rangerEnv, kmsSite);
 
-    m_clusterField = RangerKmsProxyConfig.class.getDeclaredField("m_clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculationTest.java
index 427fb33..6a44b54 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculationTest.java
@@ -81,7 +81,7 @@ public class RangerUsersyncConfigCalculationTest {
 
     replay(m_injector, m_clusters, cluster, rangerUsersyncConfig, rangerEnvConfig);
 
-    m_clusterField = RangerUsersyncConfigCalculation.class.getDeclaredField("m_clusters");
+    m_clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     m_clusterField.setAccessible(true);
 
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
index 362f372..7a1831c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
@@ -19,10 +19,12 @@
 package org.apache.ambari.server.serveraction.upgrades;
 
 
+import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 
 import java.io.File;
+import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Scanner;
@@ -47,6 +49,8 @@ import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 
+import com.google.inject.Injector;
+
 import junit.framework.Assert;
 
 
@@ -64,6 +68,7 @@ public class RangerWebAlertConfigActionTest {
   private AlertDefinitionEntity alertDefinitionEntity;
   private AlertDefinitionHash alertDefinitionHash;
   private AmbariEventPublisher eventPublisher;
+  private Field clustersField;
 
 
 
@@ -75,6 +80,8 @@ public class RangerWebAlertConfigActionTest {
     eventPublisher = Mockito.mock(AmbariEventPublisher.class);
     m_clusters = Mockito.mock(Clusters.class);
     rangerWebAlertConfigAction = new RangerWebAlertConfigAction();
+    clustersField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
+    clustersField.setAccessible(true);
   }
 
   @Test
@@ -129,7 +136,7 @@ public class RangerWebAlertConfigActionTest {
     }
 
     rangerWebAlertConfigAction.alertDefinitionDAO = alertDefinitionDAO;
-    rangerWebAlertConfigAction.m_clusters = m_clusters;
+    clustersField.set(rangerWebAlertConfigAction, m_clusters);
     rangerWebAlertConfigAction.alertDefinitionHash = alertDefinitionHash;
     rangerWebAlertConfigAction.eventPublisher = eventPublisher;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfigTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfigTest.java
index 518ab42..1ed95f8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfigTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/SparkShufflePropertyConfigTest.java
@@ -72,7 +72,7 @@ public class SparkShufflePropertyConfigTest {
 
     replay(m_injector, m_clusters, yarnConfig);
 
-    clusterField = SparkShufflePropertyConfig.class.getDeclaredField("clusters");
+    clusterField = AbstractUpgradeServerAction.class.getDeclaredField("m_clusters");
     clusterField.setAccessible(true);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1032bc5d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
index 59a8a4c..3b388e9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
@@ -213,7 +213,7 @@ public class UpgradeUserKerberosDescriptorTest {
   }
 
   private void prepareFields() throws NoSuchFieldException {
-    String[] fieldsNames = { "artifactDAO", "clusters", "ambariMetaInfo",
+    String[] fieldsNames = { "artifactDAO", "m_clusters", "ambariMetaInfo",
         "kerberosDescriptorFactory", "m_upgradeContextFactory" };
 
     for (String fieldName : fieldsNames) {
@@ -230,7 +230,7 @@ public class UpgradeUserKerberosDescriptorTest {
   }
   private void injectFields(UpgradeUserKerberosDescriptor action) throws IllegalAccessException {
     fields.get("artifactDAO").set(action, artifactDAO);
-    fields.get("clusters").set(action, clusters);
+    fields.get("m_clusters").set(action, clusters);
     fields.get("ambariMetaInfo").set(action, ambariMetaInfo);
     fields.get("kerberosDescriptorFactory").set(action, kerberosDescriptorFactory);
     fields.get("m_upgradeContextFactory").set(action, upgradeContextFactory);


Mime
View raw message