You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2017/11/24 20:41:15 UTC

ambari git commit: AMBARI-22515. Fix validators tests in feature branch.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 99259e500 -> 586ab647e


AMBARI-22515. Fix validators tests in feature branch.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 586ab647e232b30dc8dc7791b9ab8e6390eff4ae
Parents: 99259e5
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Fri Nov 24 22:40:35 2017 +0200
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Fri Nov 24 22:40:35 2017 +0200

----------------------------------------------------------------------
 .../server/upgrade/AbstractUpgradeCatalog.java  |  4 ++
 .../ClusterConfigTypeValidatorTest.java         | 29 +++++++---
 .../validators/HiveServiceValidatorTest.java    | 58 +++++++++++---------
 .../RequiredConfigPropertiesValidatorTest.java  | 46 +++++++++-------
 .../StackConfigTypeValidatorTest.java           | 45 +++++++++------
 .../topology/validators/UnitValidatorTest.java  | 29 ++++++----
 .../upgrade/AbstractUpgradeCatalogTest.java     | 22 +++++---
 .../server/upgrade/UpgradeCatalog300Test.java   | 24 +++++++-
 8 files changed, 163 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index ebb0362..0941535 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -1156,4 +1156,8 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog {
   private StackId getStackId(Cluster cluster) throws AmbariException {
     return cluster.getServices().values().iterator().next().getDesiredStackId();
   }
+
+  protected void setConfiguration(Configuration configuration) {
+    this.configuration = configuration;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index 424ed63..e469576 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -19,11 +19,12 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
@@ -45,10 +46,16 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport {
   private Configuration clusterConfigurationMock;
 
   @Mock
-  private Blueprint blueprintMock;
+  private BlueprintV2 blueprintMock;
 
   @Mock
-  private Stack stackMock;
+  private StackV2 stackMock;
+
+  @Mock
+  private Service yarnMock;
+
+  @Mock
+  private Service hdfsMock;
 
   @Mock
   private ClusterTopology clusterTopologyMock;
@@ -62,8 +69,12 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport {
   public void before() {
     EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(clusterConfigurationMock).anyTimes();
 
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
-    EasyMock.expect(blueprintMock.getStack()).andReturn(stackMock).anyTimes();
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes();
+    EasyMock.expect(blueprintMock.getStackById("1")).andReturn(stackMock).anyTimes();
+    EasyMock.expect(yarnMock.getStackId()).andReturn("1").anyTimes();
+    EasyMock.expect(yarnMock.getType()).andReturn("YARN").anyTimes();
+    EasyMock.expect(hdfsMock.getStackId()).andReturn("1").anyTimes();
+    EasyMock.expect(hdfsMock.getType()).andReturn("HDFS").anyTimes();
   }
 
   @After
@@ -94,7 +105,7 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport {
     clusterRequestConfigTypes = new HashSet<>(Arrays.asList("core-site", "yarn-site"));
     EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes();
 
-    EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS")));
+    EasyMock.expect(blueprintMock.getAllServices()).andReturn(new HashSet<>(Arrays.asList(yarnMock, hdfsMock)));
 
     EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site"));
     EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site"));
@@ -117,7 +128,7 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport {
     clusterRequestConfigTypes = new HashSet<>(Arrays.asList("oozie-site"));
     EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes();
 
-    EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS")));
+    EasyMock.expect(blueprintMock.getAllServices()).andReturn(new HashSet<>(Arrays.asList(yarnMock, hdfsMock)));
     EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site"));
     EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site"));
 
@@ -138,7 +149,7 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport {
     clusterRequestConfigTypes = new HashSet<>(Arrays.asList("core-site", "yarn-site", "oozie-site"));
     EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes();
 
-    EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS")));
+    EasyMock.expect(blueprintMock.getAllServices()).andReturn(new HashSet<>(Arrays.asList(yarnMock, hdfsMock)));
 
     EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site"));
     EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java
index e3eca17..45d0b3e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java
@@ -18,10 +18,12 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
+import org.apache.ambari.server.topology.ComponentV2;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
@@ -41,7 +43,13 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   private ClusterTopology clusterTopologyMock;
 
   @Mock
-  private Blueprint blueprintMock;
+  private BlueprintV2 blueprintMock;
+
+  @Mock
+  private Service hiveMock;
+
+  @Mock
+  private ComponentV2 mysqlComponent;
 
   @Mock
   private Configuration configurationMock;
@@ -64,8 +72,8 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   public void testShouldValidationPassWhenHiveServiceIsNotInBlueprint() throws Exception {
 
     // GIVEN
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null);
-    EasyMock.expect(blueprintMock.getServices()).andReturn(Collections.emptySet());
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock);
+    EasyMock.expect(blueprintMock.getServicesByType("HIVE")).andReturn(Collections.emptySet());
     replayAll();
 
     // WHEN
@@ -79,10 +87,10 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   public void testShouldValidationFailWhenHiveServiceIsMissingConfigType() throws Exception {
 
     // GIVEN
-    Collection<String> blueprintServices = Arrays.asList("HIVE", "OOZIE");
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null);
-    EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices);
-    EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock);
+    Collection<Service> blueprintServices = Arrays.asList(hiveMock);
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock);
+    EasyMock.expect(blueprintMock.getServicesByType("HIVE")).andReturn(blueprintServices);
+    EasyMock.expect(hiveMock.getConfiguration()).andReturn(configurationMock);
     EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(Collections.emptySet());
 
     replayAll();
@@ -98,11 +106,11 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   public void testShouldValidationPassWhenCustomHiveDatabaseSettingsProvided() throws Exception {
 
     // GIVEN
-    Collection<String> blueprintServices = Arrays.asList("HIVE", "OOZIE");
+    Collection<Service> blueprintServices = Arrays.asList(hiveMock);
     Collection<String> configTypes = Arrays.asList("hive-env", "core-site", "hadoop-env");
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null);
-    EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices);
-    EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock);
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock);
+    EasyMock.expect(blueprintMock.getServicesByType("HIVE")).andReturn(blueprintServices);
+    EasyMock.expect(hiveMock.getConfiguration()).andReturn(configurationMock);
     EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(configTypes);
 
     EasyMock.expect(configurationMock.getPropertyValue("hive-env", "hive_database")).andReturn("PSQL");
@@ -118,12 +126,12 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   @Test(expected = InvalidTopologyException.class)
   public void testShouldValidationFailWhenDefaultsAreUsedAndMysqlComponentIsMissing() throws Exception {
     // GIVEN
-    Collection<String> blueprintServices = Arrays.asList("HIVE", "HDFS");
+    Collection<Service> blueprintServices = Arrays.asList(hiveMock);
     Collection<String> configTypes = Arrays.asList("hive-env", "core-site", "hadoop-env");
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
-    EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices).anyTimes();
-    EasyMock.expect(blueprintMock.getComponents("HIVE")).andReturn(Collections.emptyList()).anyTimes();
-    EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock);
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).atLeastOnce();
+    EasyMock.expect(blueprintMock.getServicesByType("HIVE")).andReturn(blueprintServices).atLeastOnce();
+    EasyMock.expect(blueprintMock.getComponentsByType(hiveMock, "MYSQL_SERVER")).andReturn(Collections.emptyList()).atLeastOnce();
+    EasyMock.expect(hiveMock.getConfiguration()).andReturn(configurationMock);
     EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(configTypes);
 
     EasyMock.expect(configurationMock.getPropertyValue("hive-env", "hive_database")).andReturn("New MySQL Database");
@@ -140,16 +148,16 @@ public class HiveServiceValidatorTest extends EasyMockSupport {
   @Test
   public void testShouldValidationPassWhenDefaultsAreUsedAndMsqlComponentIsListed() throws Exception {
     // GIVEN
-    Collection<String> blueprintServices = Arrays.asList("HIVE", "HDFS", "MYSQL_SERVER");
-    Collection<String> hiveComponents = Arrays.asList("MYSQL_SERVER");
+    Collection<Service> blueprintServices = Arrays.asList(hiveMock);
+    Collection<ComponentV2> hiveComponents = Arrays.asList(mysqlComponent);
     Collection<String> configTypes = Arrays.asList("hive-env", "core-site", "hadoop-env");
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
-    EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices).anyTimes();
-    EasyMock.expect(blueprintMock.getComponents("HIVE")).andReturn(hiveComponents).anyTimes();
-    EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock);
-    EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(configTypes);
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).atLeastOnce();
+    EasyMock.expect(blueprintMock.getServicesByType("HIVE")).andReturn(blueprintServices).atLeastOnce();
+    EasyMock.expect(blueprintMock.getComponentsByType(hiveMock, "MYSQL_SERVER")).andReturn(hiveComponents).atLeastOnce();
+    EasyMock.expect(hiveMock.getConfiguration()).andReturn(configurationMock).atLeastOnce();
+    EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(configTypes).atLeastOnce();
 
-    EasyMock.expect(configurationMock.getPropertyValue("hive-env", "hive_database")).andReturn("New MySQL Database");
+    EasyMock.expect(configurationMock.getPropertyValue("hive-env", "hive_database")).andReturn("New MySQL Database").atLeastOnce();
     replayAll();
 
     // WHEN

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java
index cfa3af1..f6b4ec8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java
@@ -22,12 +22,13 @@ import java.util.Map;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
-import org.apache.ambari.server.topology.HostGroup;
+import org.apache.ambari.server.topology.HostGroupV2Impl;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
@@ -53,16 +54,19 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport {
   private Configuration topologyConfigurationMock;
 
   @Mock
-  private Blueprint blueprintMock;
+  private BlueprintV2 blueprintMock;
 
   @Mock
-  private Stack stackMock;
+  private StackV2 stackMock;
 
   @Mock
-  private HostGroup slaveHostGroupMock;
+  private Service kerberosMock;
 
   @Mock
-  private HostGroup masterHostGroupMock;
+  private HostGroupV2Impl slaveHostGroupMock;
+
+  @Mock
+  private HostGroupV2Impl masterHostGroupMock;
 
   @Mock
   private Configuration slaveHostGroupConfigurationMock;
@@ -75,9 +79,10 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport {
   private Map<String, Map<String, String>> masterHostGroupConfigurationMap = new HashMap<>();
   private Map<String, Map<String, String>> slaveHostGroupConfigurationMap = new HashMap<>();
   private Collection<String> bpServices = new HashSet<>();
-  private Collection<String> slaveHostGroupServices = new HashSet<>();
-  private Collection<String> masterHostGroupServices = new HashSet<>();
-  private Map<String, HostGroup> hostGroups = new HashMap<>();
+  private Collection<Service> slaveHostGroupServices = new HashSet<>();
+  private Collection<Service> masterHostGroupServices = new HashSet<>();
+  private Map<String, HostGroupV2Impl> hostGroups = new HashMap<>();
+
   private Map<String, Collection<String>> missingProps = new TreeMap<>();
 
   @TestSubject
@@ -96,21 +101,22 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport {
     EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(topologyConfigurationMock);
     EasyMock.expect(topologyConfigurationMock.getFullProperties(1)).andReturn(topologyConfigurationMap);
 
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
+    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes();
 
-    EasyMock.expect(blueprintMock.getHostGroups()).andReturn(hostGroups);
-    EasyMock.expect(blueprintMock.getServices()).andReturn(bpServices);
-    EasyMock.expect(blueprintMock.getStack()).andReturn(stackMock).anyTimes();
+    EasyMock.expect((Map<String, HostGroupV2Impl>)blueprintMock.getHostGroups()).andReturn(hostGroups);
 
     EasyMock.expect(masterHostGroupMock.getName()).andReturn("master").anyTimes();
     EasyMock.expect(masterHostGroupMock.getConfiguration()).andReturn(masterHostGroupConfigurationMock).anyTimes();
     EasyMock.expect(masterHostGroupMock.getServices()).andReturn(masterHostGroupServices);
 
-
     EasyMock.expect(slaveHostGroupMock.getName()).andReturn("slave").anyTimes();
     EasyMock.expect(slaveHostGroupMock.getConfiguration()).andReturn(slaveHostGroupConfigurationMock).anyTimes();
     EasyMock.expect(slaveHostGroupMock.getServices()).andReturn(slaveHostGroupServices);
 
+    EasyMock.expect(kerberosMock.getName()).andReturn("KERBEROS").anyTimes();
+    EasyMock.expect(kerberosMock.getType()).andReturn("KERBEROS").anyTimes();
+    EasyMock.expect(kerberosMock.getStack()).andReturn(stackMock).anyTimes();
+
     // there are 2 hostgroups to be considered by the test
     hostGroups.put("master", masterHostGroupMock);
     hostGroups.put("slave", slaveHostGroupMock);
@@ -119,8 +125,8 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport {
     bpServices.addAll(Lists.newArrayList("KERBEROS", "OOZIE"));
 
     // host group services
-    masterHostGroupServices.addAll(Collections.singletonList("KERBEROS"));
-    slaveHostGroupServices.addAll(Collections.singletonList("KERBEROS"));
+    masterHostGroupServices.addAll(Collections.singletonList(kerberosMock));
+    slaveHostGroupServices.addAll(Collections.singletonList(kerberosMock));
 
     EasyMock.expect(masterHostGroupConfigurationMock.getProperties()).andReturn(masterHostGroupConfigurationMap);
     EasyMock.expect(slaveHostGroupConfigurationMock.getProperties()).andReturn(slaveHostGroupConfigurationMap);
@@ -131,9 +137,9 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport {
     // required properties for listed services
     EasyMock.expect(stackMock.getRequiredConfigurationProperties("KERBEROS")).
       andReturn(Lists.newArrayList(
-        new Stack.ConfigProperty("kerberos-env", "realm", "value"),
-        new Stack.ConfigProperty("kerberos-env", "kdc_type", "value"), // this is missing!
-        new Stack.ConfigProperty("krb5-conf", "domains", "smthg")));
+        new StackV2.ConfigProperty("kerberos-env", "realm", "value"),
+        new StackV2.ConfigProperty("kerberos-env", "kdc_type", "value"), // this is missing!
+        new StackV2.ConfigProperty("krb5-conf", "domains", "smthg"))).anyTimes();
 
     EasyMock.expect(stackMock.getRequiredConfigurationProperties("OOZIE")).andReturn(Collections.EMPTY_LIST);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java
index e63ff45..28739dc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java
@@ -14,17 +14,21 @@
 
 package org.apache.ambari.server.topology.validators;
 
+import static org.easymock.EasyMock.expect;
+
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.InvalidTopologyException;
-import org.easymock.EasyMock;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
 import org.easymock.Mock;
@@ -46,10 +50,13 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport {
   private Configuration stackConfigurationMock;
 
   @Mock
-  private Blueprint blueprintMock;
+  private BlueprintV2 blueprintMock;
+
+  @Mock
+  private Service testService;
 
   @Mock
-  private Stack stackMock;
+  private StackV2 stackMock;
 
   @Mock
   private ClusterTopology clusterTopologyMock;
@@ -61,10 +68,12 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport {
 
   @Before
   public void before() {
-    EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(clusterConfigurationMock).anyTimes();
-    EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
-
-    EasyMock.expect(blueprintMock.getStack()).andReturn(stackMock).anyTimes();
+    List<Service> serviceConfigs = new ArrayList<>();
+    serviceConfigs.add(testService);
+    expect(testService.getConfiguration()).andReturn(clusterConfigurationMock).anyTimes();
+    expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes();
+    expect(clusterTopologyMock.getServiceConfigs()).andReturn(serviceConfigs).anyTimes();
+    expect(testService.getStack()).andReturn(stackMock).anyTimes();
   }
 
   @After
@@ -76,9 +85,9 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport {
   @Test(expected = InvalidTopologyException.class)
   public void testShouldValidationFailWhenUnknownConfigTypeComesIn() throws Exception {
     // GIVEN
-    EasyMock.expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
-    EasyMock.expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
-    EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("invalid-site")));
+    expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
+    expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
+    expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("invalid-site")));
 
     replayAll();
 
@@ -93,9 +102,9 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport {
   @Test
   public void testShouldValidationPassifNoConfigTypesomeIn() throws Exception {
     // GIVEN
-    EasyMock.expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
-    EasyMock.expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
-    EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Collections.emptyList()));
+    expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
+    expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
+    expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Collections.emptyList()));
 
     replayAll();
 
@@ -110,9 +119,9 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport {
   @Test(expected = InvalidTopologyException.class)
   public void testShouldValidationFailIfMultipleInvalidConfigTypesComeIn() throws Exception {
     // GIVEN
-    EasyMock.expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
-    EasyMock.expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
-    EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("invalid-site-1", "invalid-default")));
+    expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock);
+    expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site")));
+    expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("invalid-site-1", "invalid-default")));
 
     replayAll();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/UnitValidatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/UnitValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/UnitValidatorTest.java
index 95e539e..ca42ecc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/UnitValidatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/UnitValidatorTest.java
@@ -21,18 +21,22 @@ import static com.google.common.collect.Sets.newHashSet;
 import static java.util.Collections.emptyMap;
 import static org.easymock.EasyMock.expect;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.ambari.server.controller.StackLevelConfigurationResponse;
+import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.internal.ConfigurationTopologyException;
-import org.apache.ambari.server.controller.internal.Stack;
 import org.apache.ambari.server.state.ValueAttributesInfo;
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
+import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
 import org.easymock.Mock;
@@ -45,11 +49,12 @@ public class UnitValidatorTest extends EasyMockSupport {
   private static final String CONFIG_TYPE = "config-type";
   private static final String SERVICE = "service";
   @Rule public EasyMockRule mocks = new EasyMockRule(this);
-  private Map<String, Stack.ConfigProperty> stackConfigWithMetadata = new HashMap<>();
+  private Map<String, StackV2.ConfigProperty> stackConfigWithMetadata = new HashMap<>();
   private UnitValidator validator;
   private @Mock ClusterTopology clusterTopology;
-  private @Mock Blueprint blueprint;
-  private @Mock Stack stack;
+  private @Mock Service testService;
+  private @Mock BlueprintV2 blueprint;
+  private @Mock StackV2 stack;
 
   @Test(expected = IllegalArgumentException.class)
   public void rejectsPropertyWithDifferentUnitThanStackUnit() throws Exception {
@@ -74,9 +79,13 @@ public class UnitValidatorTest extends EasyMockSupport {
 
   @Before
   public void setUp() throws Exception {
-    expect(clusterTopology.getBlueprint()).andReturn(null).anyTimes();
-    expect(clusterTopology.getHostGroupInfo()).andReturn(null).anyTimes();
-    expect(blueprint.getStack()).andReturn(stack).anyTimes();
+    List<Service> serviceConfigs = new ArrayList<>();
+    serviceConfigs.add(testService);
+    expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes();
+    expect(clusterTopology.getHostGroupInfo()).andReturn(new HashMap<String, HostGroupInfo>()).anyTimes();
+    expect(clusterTopology.getServiceConfigs()).andReturn(serviceConfigs).anyTimes();
+    expect(testService.getStackId()).andReturn("1");
+    expect(blueprint.getStackById("1")).andReturn(stack).anyTimes();
     expect(stack.getConfigurationPropertiesWithMetadata(SERVICE, CONFIG_TYPE)).andReturn(stackConfigWithMetadata).anyTimes();
   }
 
@@ -86,7 +95,7 @@ public class UnitValidatorTest extends EasyMockSupport {
         put(propertyName, propertyValue);
       }});
     }};
-    expect(clusterTopology.getConfiguration()).andReturn(new Configuration(propertiesToBeValidated, emptyMap())).anyTimes();
+    expect(testService.getConfiguration()).andReturn(new Configuration(propertiesToBeValidated, emptyMap())).anyTimes();
     replayAll();
   }
 
@@ -98,7 +107,7 @@ public class UnitValidatorTest extends EasyMockSupport {
   private void stackUnitIs(String name, String unit) {
     ValueAttributesInfo propertyValueAttributes = new ValueAttributesInfo();
     propertyValueAttributes.setUnit(unit);
-    stackConfigWithMetadata.put(name, new Stack.ConfigProperty(new StackLevelConfigurationResponse(
+    stackConfigWithMetadata.put(name, new StackV2.ConfigProperty(new StackLevelConfigurationResponse(
       name,
       "any",
       "any",

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
index d7ad7f2..1f58204 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
@@ -57,6 +57,7 @@ public class AbstractUpgradeCatalogTest {
   private ConfigHelper configHelper;
   private Injector injector;
   private Cluster cluster;
+  private Service hdfsMock;
   private Clusters clusters;
   private ServiceInfo serviceInfo;
   private Config oldConfig;
@@ -72,6 +73,7 @@ public class AbstractUpgradeCatalogTest {
     clusters = createStrictMock(Clusters.class);
     serviceInfo = createNiceMock(ServiceInfo.class);
     oldConfig = createNiceMock(Config.class);
+    hdfsMock = createNiceMock(Service.class);
 
     expect(injector.getInstance(ConfigHelper.class)).andReturn(configHelper).anyTimes();
     expect(injector.getInstance(AmbariManagementController.class)).andReturn(amc).anyTimes();
@@ -87,6 +89,8 @@ public class AbstractUpgradeCatalogTest {
     HashMap<String, Service> serviceMap = new HashMap<>();
     serviceMap.put(SERVICE_NAME, null);
     expect(cluster.getServices()).andReturn(serviceMap).anyTimes();
+    expect(cluster.getServiceByConfigType("hdfs-site")).andReturn(hdfsMock).atLeastOnce();
+    expect(hdfsMock.getName()).andReturn("HDFS").atLeastOnce();
 
     HashSet<PropertyInfo> serviceProperties = new HashSet<>();
     serviceProperties.add(createProperty(CONFIG_TYPE, "prop1", true, false, false));
@@ -132,13 +136,13 @@ public class AbstractUpgradeCatalogTest {
     mergedProperties.put("prop1", "v1-old");
     mergedProperties.put("prop4", "v4");
 
-    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), eq(anyLong()))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), anyLong())).andReturn(null);
 
-    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
 
     upgradeCatalog.addNewConfigurationsFromXml();
 
-    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
   }
 
   @Test
@@ -154,13 +158,13 @@ public class AbstractUpgradeCatalogTest {
     mergedProperties.put("prop2", "v2");
     mergedProperties.put("prop3", "v3-old");
 
-    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), eq(anyLong()))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), anyLong())).andReturn(null);
 
-    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
 
     upgradeCatalog.addNewConfigurationsFromXml();
 
-    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
   }
 
   @Test
@@ -173,13 +177,13 @@ public class AbstractUpgradeCatalogTest {
     Map<String, String> mergedProperties = new HashMap<>();
     mergedProperties.put("prop1", "v1-old");
 
-    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), eq(anyLong()))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags), anyLong())).andReturn(null);
 
-    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
 
     upgradeCatalog.addNewConfigurationsFromXml();
 
-    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
+    verify(configHelper, amc, cluster, clusters, serviceInfo, oldConfig, hdfsMock);
   }
 
   private static PropertyInfo createProperty(String filename, String name, boolean add, boolean update, boolean delete) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/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 03219bf..f12f3af 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
@@ -26,6 +26,7 @@ import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMockBuilder;
+import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
@@ -53,6 +54,7 @@ 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.Service;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.Capture;
@@ -194,7 +196,6 @@ public class UpgradeCatalog300Test {
 
     EasyMockSupport easyMockSupport = new EasyMockSupport();
 
-    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
     AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
         .addMockedMethod("createConfiguration")
         .addMockedMethod("getClusters", new Class[]{})
@@ -206,6 +207,10 @@ public class UpgradeCatalog300Test {
             String.class, Map.class, String.class, String.class)
         .createMock();
 
+    Configuration configMock = createNiceMock(Configuration.class);
+
+    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
+
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(injector2.getInstance(ConfigHelper.class)).andReturn(configHelper).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
@@ -334,14 +339,27 @@ public class UpgradeCatalog300Test {
     expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logFeederOutputConfCapture), anyString(),
             anyObject(Map.class), anyLong())).andReturn(config).once();
 
-    replay(clusters, cluster);
+    Service logsearchMock = createNiceMock(Service.class);
+    expect(cluster.getServiceByConfigType("logsearch-properties")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logfeeder-properties")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logfeeder-log4j")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logsearch-log4j")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logsearch-service_logs-solrconfig")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logsearch-audit_logs-solrconfig")).andReturn(logsearchMock).atLeastOnce();
+    expect(cluster.getServiceByConfigType("logfeeder-output-config")).andReturn(logsearchMock).atLeastOnce();
+
+    expect(logsearchMock.getName()).andReturn("LOGSEARCH").atLeastOnce();
+
+    replay(clusters, cluster, logsearchMock, configMock);
     replay(controller, injector2);
     replay(confSomethingElse1, confSomethingElse2, confLogSearchConf1, confLogSearchConf2);
     replay(logSearchPropertiesConf, logFeederPropertiesConf);
     replay(logFeederLog4jConf, logSearchLog4jConf);
     replay(logSearchServiceLogsConf, logSearchAuditLogsConf);
     replay(logFeederOutputConf);
-    new UpgradeCatalog300(injector2).updateLogSearchConfigs();
+    UpgradeCatalog300 upgradeCatalog300 = new UpgradeCatalog300(injector2);
+    upgradeCatalog300.setConfiguration(configMock);
+    upgradeCatalog300.updateLogSearchConfigs();
     easyMockSupport.verifyAll();
 
     Map<String,String> newLogFeederProperties = logFeederPropertiesCapture.getValue();