ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [1/3] ambari git commit: AMBARI-21078 - Merging Configurations On Service/Patch Upgrades Should Create New Configurations Only For Included Services (jonathanhurley)
Date Tue, 23 May 2017 21:35:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-12556 a45f5427b -> c4148d805


http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
index 98f5228..24c529d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
@@ -42,6 +42,7 @@ import org.apache.ambari.annotations.Experimental;
 import org.apache.ambari.annotations.ExperimentalFeature;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.H2DatabaseCleaner;
+import org.apache.ambari.server.actionmanager.HostRoleCommandFactory;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ClusterRequest;
@@ -55,6 +56,7 @@ import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.stack.HostsType;
 import org.apache.ambari.server.stack.MasterHostResolver;
 import org.apache.ambari.server.stack.StackManagerMock;
+import org.apache.ambari.server.stageplanner.RoleGraphFactory;
 import org.apache.ambari.server.state.UpgradeHelper.UpgradeGroupHolder;
 import org.apache.ambari.server.state.stack.ConfigUpgradePack;
 import org.apache.ambari.server.state.stack.UpgradePack;
@@ -100,6 +102,7 @@ import com.google.inject.util.Modules;
  */
 public class UpgradeHelperTest {
 
+  private static final StackId STACK_ID_HDP_211 = new StackId("HDP-2.1.1");
   private static final StackId STACK_ID_HDP_220 = new StackId("HDP-2.2.0");
   private static final String UPGRADE_VERSION = "2.2.1.0-1234";
   private static final String DOWNGRADE_VERSION = "2.2.0.0-1234";
@@ -113,8 +116,8 @@ public class UpgradeHelperTest {
   private ConfigHelper m_configHelper;
   private AmbariManagementController m_managementController;
   private Gson m_gson = new Gson();
-  private UpgradeContextFactory m_upgradeContextFactory;
 
+  private RepositoryVersionEntity repositoryVersion2110;
   private RepositoryVersionEntity repositoryVersion2200;
   private RepositoryVersionEntity repositoryVersion2210;
 
@@ -160,8 +163,8 @@ public class UpgradeHelperTest {
     m_upgradeHelper = injector.getInstance(UpgradeHelper.class);
     m_masterHostResolver = EasyMock.createMock(MasterHostResolver.class);
     m_managementController = injector.getInstance(AmbariManagementController.class);
-    m_upgradeContextFactory = injector.getInstance(UpgradeContextFactory.class);
 
+    repositoryVersion2110 = helper.getOrCreateRepositoryVersion(STACK_ID_HDP_211, "2.1.1.0-1234");
     repositoryVersion2200 = helper.getOrCreateRepositoryVersion(STACK_ID_HDP_220, DOWNGRADE_VERSION);
     repositoryVersion2210 = helper.getOrCreateRepositoryVersion(STACK_ID_HDP_220, UPGRADE_VERSION);
 
@@ -294,14 +297,9 @@ public class UpgradeHelperTest {
     Cluster cluster = makeCluster();
 
     Set<String> services = Collections.singleton("ZOOKEEPER");
-    UpgradeContext context = EasyMock.createNiceMock(UpgradeContext.class);
-    EasyMock.expect(context.getCluster()).andReturn(cluster).anyTimes();
-    EasyMock.expect(context.getType()).andReturn(UpgradeType.ROLLING).anyTimes();
-    EasyMock.expect(context.getDirection()).andReturn(Direction.UPGRADE).anyTimes();
-    EasyMock.expect(context.getRepositoryVersion()).andReturn(repositoryVersion2210).anyTimes();
-    EasyMock.expect(context.getSupportedServices()).andReturn(services).anyTimes();
-    EasyMock.expect(context.getRepositoryType()).andReturn(RepositoryType.PATCH).anyTimes();
-    EasyMock.replay(context);
+
+    UpgradeContext context = getMockUpgradeContext(cluster, Direction.UPGRADE, UpgradeType.ROLLING,
+        repositoryVersion2210, RepositoryType.PATCH, services);
 
     List<Grouping> groupings = upgrade.getGroups(Direction.UPGRADE);
     assertEquals(8, groupings.size());
@@ -460,7 +458,7 @@ public class UpgradeHelperTest {
         UpgradeType.ROLLING, repositoryVersion2210);
 
     // use a "real" master host resolver here so that we can actually test MM
-    MasterHostResolver masterHostResolver = new MasterHostResolver(null, context);
+    MasterHostResolver masterHostResolver = new MasterHostResolver(cluster, null, context);
 
     EasyMock.expect(context.getResolver()).andReturn(masterHostResolver).anyTimes();
     replay(context);
@@ -1525,14 +1523,10 @@ public class UpgradeHelperTest {
 
     String clusterName = "c1";
 
-    String version = "2.1.1.0-1234";
     StackId stackId = new StackId("HDP-2.1.1");
     clusters.addCluster(clusterName, stackId);
     Cluster c = clusters.getCluster(clusterName);
 
-    RepositoryVersionEntity repositoryVersion211 = helper.getOrCreateRepositoryVersion(stackId,
-        version);
-
     for (int i = 0; i < 2; i++) {
       String hostName = "h" + (i+1);
       clusters.addHost(hostName);
@@ -1548,24 +1542,24 @@ public class UpgradeHelperTest {
     }
 
     // !!! add services
-    c.addService(serviceFactory.createNew(c, "ZOOKEEPER", repositoryVersion211));
+    c.addService(serviceFactory.createNew(c, "ZOOKEEPER", repositoryVersion2110));
 
     Service s = c.getService("ZOOKEEPER");
     ServiceComponent sc = s.addServiceComponent("ZOOKEEPER_SERVER");
 
     ServiceComponentHost sch1 = sc.addServiceComponentHost("h1");
-    sch1.setVersion(repositoryVersion211.getVersion());
+    sch1.setVersion(repositoryVersion2110.getVersion());
 
     ServiceComponentHost sch2 = sc.addServiceComponentHost("h2");
-    sch2.setVersion(repositoryVersion211.getVersion());
+    sch2.setVersion(repositoryVersion2110.getVersion());
 
     List<ServiceComponentHost> schs = c.getServiceComponentHosts("ZOOKEEPER", "ZOOKEEPER_SERVER");
     assertEquals(2, schs.size());
 
     UpgradeContext context = getMockUpgradeContextNoReplay(c, Direction.UPGRADE,
-        UpgradeType.HOST_ORDERED, repositoryVersion211);
+        UpgradeType.HOST_ORDERED, repositoryVersion2110);
 
-    MasterHostResolver resolver = new MasterHostResolver(m_configHelper, context);
+    MasterHostResolver resolver = new MasterHostResolver(c, m_configHelper, context);
     EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
     replay(context);
 
@@ -1639,7 +1633,7 @@ public class UpgradeHelperTest {
         UpgradeType.NON_ROLLING, repositoryVersion211);
 
     // use a "real" master host resolver here so that we can actually test MM
-    MasterHostResolver mhr = new MockMasterHostResolver(m_configHelper, context);
+    MasterHostResolver mhr = new MockMasterHostResolver(c, m_configHelper, context);
 
     EasyMock.expect(context.getResolver()).andReturn(mhr).anyTimes();
     replay(context);
@@ -1708,7 +1702,7 @@ public class UpgradeHelperTest {
         UpgradeType.NON_ROLLING, repositoryVersion211);
 
     // use a "real" master host resolver here so that we can actually test MM
-    MasterHostResolver mhr = new BadMasterHostResolver(m_configHelper, context);
+    MasterHostResolver mhr = new BadMasterHostResolver(c, m_configHelper, context);
 
     EasyMock.expect(context.getResolver()).andReturn(mhr).anyTimes();
     replay(context);
@@ -1846,7 +1840,7 @@ public class UpgradeHelperTest {
         UpgradeType.NON_ROLLING, repoVersion220);
 
     // use a "real" master host resolver here so that we can actually test MM
-    MasterHostResolver masterHostResolver = new MasterHostResolver(m_configHelper, context);
+    MasterHostResolver masterHostResolver = new MasterHostResolver(c, m_configHelper, context);
 
     EasyMock.expect(context.getResolver()).andReturn(masterHostResolver).anyTimes();
     replay(context);
@@ -1862,7 +1856,7 @@ public class UpgradeHelperTest {
         repoVersion211);
 
     // use a "real" master host resolver here so that we can actually test MM
-    masterHostResolver = new MasterHostResolver(m_configHelper, context);
+    masterHostResolver = new MasterHostResolver(c, m_configHelper, context);
 
     EasyMock.expect(context.getResolver()).andReturn(masterHostResolver).anyTimes();
     replay(context);
@@ -2129,7 +2123,7 @@ public class UpgradeHelperTest {
     UpgradeContext context = getMockUpgradeContextNoReplay(c, Direction.UPGRADE,
         UpgradeType.HOST_ORDERED, repoVersion220);
 
-    MasterHostResolver resolver = new MasterHostResolver(m_configHelper, context);
+    MasterHostResolver resolver = new MasterHostResolver(c, m_configHelper, context);
     EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
     replay(context);
 
@@ -2173,7 +2167,7 @@ public class UpgradeHelperTest {
     context = getMockUpgradeContextNoReplay(c, Direction.DOWNGRADE, UpgradeType.HOST_ORDERED,
         repoVersion211);
 
-    resolver = new MasterHostResolver(m_configHelper, context);
+    resolver = new MasterHostResolver(c, m_configHelper, context);
     EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
     replay(context);
 
@@ -2190,7 +2184,7 @@ public class UpgradeHelperTest {
     context = getMockUpgradeContextNoReplay(c, Direction.DOWNGRADE, UpgradeType.HOST_ORDERED,
         repoVersion211);
 
-    resolver = new MasterHostResolver(m_configHelper, context);
+    resolver = new MasterHostResolver(c, m_configHelper, context);
     EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
     replay(context);
 
@@ -2281,7 +2275,7 @@ public class UpgradeHelperTest {
       UpgradeType type, RepositoryVersionEntity repositoryVersion, RepositoryType repositoryType,
       Set<String> services) {
     return getMockUpgradeContext(cluster, direction, type, repositoryVersion,
-        repositoryType, services, m_masterHostResolver);
+        repositoryType, services, m_masterHostResolver, true);
   }
 
   /**
@@ -2294,15 +2288,8 @@ public class UpgradeHelperTest {
       UpgradeType type, RepositoryVersionEntity repositoryVersion) {
     Set<String> allServices = cluster.getServices().keySet();
 
-    UpgradeContext context = EasyMock.createNiceMock(UpgradeContext.class);
-    EasyMock.expect(context.getCluster()).andReturn(cluster).anyTimes();
-    EasyMock.expect(context.getType()).andReturn(type).anyTimes();
-    EasyMock.expect(context.getDirection()).andReturn(direction).anyTimes();
-    EasyMock.expect(context.getRepositoryVersion()).andReturn(repositoryVersion).anyTimes();
-    EasyMock.expect(context.getSupportedServices()).andReturn(allServices).anyTimes();
-    EasyMock.expect(context.getRepositoryType()).andReturn(RepositoryType.STANDARD).anyTimes();
-    EasyMock.expect(context.isScoped(EasyMock.anyObject(UpgradeScope.class))).andReturn(true).anyTimes();
-    return context;
+    return getMockUpgradeContext(cluster, direction, type, repositoryVersion,
+        RepositoryType.STANDARD, allServices, null, false);
   }
 
   /**
@@ -2314,8 +2301,8 @@ public class UpgradeHelperTest {
    * @return
    */
   private UpgradeContext getMockUpgradeContext(Cluster cluster, Direction direction,
-      UpgradeType type, RepositoryVersionEntity repositoryVersion, RepositoryType repositoryType,
-      Set<String> services, MasterHostResolver resolver) {
+      UpgradeType type, RepositoryVersionEntity repositoryVersion, final RepositoryType repositoryType,
+      Set<String> services, MasterHostResolver resolver, boolean replay) {
     UpgradeContext context = EasyMock.createNiceMock(UpgradeContext.class);
     EasyMock.expect(context.getCluster()).andReturn(cluster).anyTimes();
     EasyMock.expect(context.getType()).andReturn(type).anyTimes();
@@ -2323,9 +2310,14 @@ public class UpgradeHelperTest {
     EasyMock.expect(context.getRepositoryVersion()).andReturn(repositoryVersion).anyTimes();
     EasyMock.expect(context.getSupportedServices()).andReturn(services).anyTimes();
     EasyMock.expect(context.getRepositoryType()).andReturn(repositoryType).anyTimes();
-    EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
-    EasyMock.expect(context.isScoped(EasyMock.anyObject(UpgradeScope.class))).andReturn(true).anyTimes();
     EasyMock.expect(context.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
+    EasyMock.expect(context.getHostRoleCommandFactory()).andStubReturn(injector.getInstance(HostRoleCommandFactory.class));
+    EasyMock.expect(context.getRoleGraphFactory()).andStubReturn(injector.getInstance(RoleGraphFactory.class));
+
+    // only set this if supplied
+    if (null != resolver) {
+      EasyMock.expect(context.getResolver()).andReturn(resolver).anyTimes();
+    }
 
     final Map<String, RepositoryVersionEntity> targetRepositoryVersions = new HashMap<>();
     for( String serviceName : services ){
@@ -2353,8 +2345,6 @@ public class UpgradeHelperTest {
 
 
     final Map<String, String> serviceNames = new HashMap<>();
-
-
     final Capture<String> serviceDisplayNameArg1 = EasyMock.newCapture();
     final Capture<String> serviceDisplayNameArg2 = EasyMock.newCapture();
 
@@ -2408,7 +2398,28 @@ public class UpgradeHelperTest {
           }
         }).anyTimes();
 
-    replay(context);
+    final Capture<UpgradeScope> isScopedCapture = EasyMock.newCapture();
+    EasyMock.expect(context.isScoped(EasyMock.capture(isScopedCapture))).andStubAnswer(
+        new IAnswer<Boolean>() {
+          @Override
+          public Boolean answer() throws Throwable {
+            UpgradeScope scope = isScopedCapture.getValue();
+            if (scope == UpgradeScope.ANY) {
+              return true;
+            }
+
+            if (scope == UpgradeScope.PARTIAL) {
+              return repositoryType != RepositoryType.STANDARD;
+            }
+
+            return repositoryType == RepositoryType.STANDARD;
+          }
+        });
+
+    if (replay) {
+      replay(context);
+    }
+
     return context;
   }
 
@@ -2418,8 +2429,8 @@ public class UpgradeHelperTest {
    */
   private class MockMasterHostResolver extends MasterHostResolver {
 
-    public MockMasterHostResolver(ConfigHelper configHelper, UpgradeContext context) {
-      super(configHelper, context);
+    public MockMasterHostResolver(Cluster cluster, ConfigHelper configHelper, UpgradeContext context) {
+      super(cluster, configHelper, context);
     }
 
     /**
@@ -2461,8 +2472,8 @@ public class UpgradeHelperTest {
 
   private static class BadMasterHostResolver extends MasterHostResolver {
 
-    public BadMasterHostResolver(ConfigHelper configHelper, UpgradeContext context) {
-      super(configHelper, context);
+    public BadMasterHostResolver(Cluster cluster, ConfigHelper configHelper, UpgradeContext context) {
+      super(cluster, configHelper, context);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 38c9d1c..8c4cb93 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -1293,6 +1293,9 @@ public class ClusterTest {
   public void testServiceConfigVersionsForGroups() throws Exception {
     createDefaultCluster();
 
+    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
+    c1.addService("HDFS", repositoryVersion);
+
     Config config1 = configFactory.createNew(c1, "hdfs-site", "version1",
       new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>());
 
@@ -1310,7 +1313,7 @@ public class ClusterTest {
       new HashMap<String, String>() {{ put("a", "c"); }}, new HashMap<String, Map<String,String>>());
 
     ConfigGroup configGroup =
-      configGroupFactory.createNew(c1, "test group", "HDFS", "descr", Collections.singletonMap("hdfs-site", config2),
+      configGroupFactory.createNew(c1, "HDFS", "test group", "HDFS", "descr", Collections.singletonMap("hdfs-site", config2),
         Collections.<Long, Host>emptyMap());
 
     c1.addConfigGroup(configGroup);
@@ -1362,7 +1365,7 @@ public class ClusterTest {
         Collections.singletonMap("a", "b"), null);
 
     ConfigGroup configGroup2 =
-        configGroupFactory.createNew(c1, "test group 2", "HDFS", "descr",
+        configGroupFactory.createNew(c1, "HDFS", "test group 2", "HDFS", "descr",
             new HashMap<>(Collections.singletonMap("hdfs-site", config4)),
             Collections.<Long, Host>emptyMap());
 
@@ -1397,7 +1400,7 @@ public class ClusterTest {
     Config hdfsSiteConfigV2 = configFactory.createNew(c1, "hdfs-site", "version2",
         ImmutableMap.of("p1", "v2"), ImmutableMap.<String, Map<String,String>>of());
 
-    ConfigGroup configGroup = configGroupFactory.createNew(c1, "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of());
+    ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of());
 
     c1.addConfigGroup(configGroup);
     ServiceConfigVersionResponse hdfsSiteConfigResponseV2 = c1.createServiceConfigVersion("HDFS", "admin", "test note", configGroup);
@@ -1456,7 +1459,7 @@ public class ClusterTest {
     Config hdfsSiteConfigV2 = configFactory.createNew(c1, "hdfs-site", "version2",
         ImmutableMap.of("p1", "v2"), ImmutableMap.<String, Map<String,String>>of());
 
-    ConfigGroup configGroup = configGroupFactory.createNew(c1, "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of());
+    ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of());
 
     c1.addConfigGroup(configGroup);
     ServiceConfigVersionResponse hdfsSiteConfigResponseV2 = c1.createServiceConfigVersion("HDFS", "admin", "test note", configGroup);
@@ -1934,7 +1937,7 @@ public class ClusterTest {
           }
         }, new HashMap<String, Map<String, String>>());
 
-    ConfigGroup configGroup = configGroupFactory.createNew(cluster, "g1", "t1", "",
+    ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", "g1", "t1", "",
         new HashMap<String, Config>() {
           {
             put("foo-site", originalConfig);
@@ -1974,25 +1977,31 @@ public class ClusterTest {
   }
 
   /**
-   * Tests that {@link Cluster#applyLatestConfigurations(StackId)} sets the
+   * Tests that {@link Cluster#applyLatestConfigurations(StackId, String)} sets the
    * right configs to enabled.
    *
    * @throws Exception
    */
   @Test
   public void testApplyLatestConfigurations() throws Exception {
-    createDefaultCluster();
+    StackId stackId = new StackId("HDP-2.0.6");
+    StackId newStackId = new StackId("HDP-2.2.0");
+    createDefaultCluster(Sets.newHashSet("host-1"), stackId);
+
     Cluster cluster = clusters.getCluster("c1");
     ClusterEntity clusterEntity = clusterDAO.findByName("c1");
-    StackId stackId = cluster.getCurrentStackVersion();
-    StackId newStackId = new StackId("HDP-2.0.6");
+    RepositoryVersionEntity repoVersion220 = helper.getOrCreateRepositoryVersion(newStackId, "2.2.0-1234");
 
     StackEntity currentStack = stackDAO.find(stackId.getStackName(), stackId.getStackVersion());
     StackEntity newStack = stackDAO.find(newStackId.getStackName(), newStackId.getStackVersion());
 
-    Assert.assertFalse( stackId.equals(newStackId) );
+    Assert.assertFalse(stackId.equals(newStackId));
 
-    String configType = "foo-type";
+    // add a service
+    String serviceName = "ZOOKEEPER";
+    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
+    Service service = cluster.addService(serviceName, repositoryVersion);
+    String configType = "zoo.cfg";
 
     ClusterConfigEntity clusterConfig1 = new ClusterConfigEntity();
     clusterConfig1.setClusterEntity(clusterEntity);
@@ -2009,6 +2018,8 @@ public class ClusterTest {
     clusterEntity.getClusterConfigEntities().add(clusterConfig1);
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    cluster.createServiceConfigVersion(serviceName, "", "version-1", null);
+
     ClusterConfigEntity clusterConfig2 = new ClusterConfigEntity();
     clusterConfig2.setClusterEntity(clusterEntity);
     clusterConfig2.setConfigId(2L);
@@ -2024,6 +2035,11 @@ public class ClusterTest {
     clusterEntity.getClusterConfigEntities().add(clusterConfig2);
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    // before creating the new service config version, we need to push the
+    // service's desired repository forward
+    service.setDesiredRepositoryVersion(repoVersion220);
+    cluster.createServiceConfigVersion(serviceName, "", "version-2", null);
+
     // check that the original config is enabled
     Collection<ClusterConfigEntity> clusterConfigs = clusterEntity.getClusterConfigEntities();
     Assert.assertEquals(2, clusterConfigs.size());
@@ -2035,7 +2051,7 @@ public class ClusterTest {
       }
     }
 
-    cluster.applyLatestConfigurations(newStackId);
+    cluster.applyLatestConfigurations(newStackId, serviceName);
     clusterEntity = clusterDAO.findByName("c1");
 
     // now check that the new config is enabled
@@ -2059,18 +2075,24 @@ public class ClusterTest {
    */
   @Test
   public void testApplyLatestConfigurationsToPreviousStack() throws Exception {
-    createDefaultCluster();
+    StackId stackId = new StackId("HDP-2.0.6");
+    StackId newStackId = new StackId("HDP-2.2.0");
+    createDefaultCluster(Sets.newHashSet("host-1"), stackId);
+
     Cluster cluster = clusters.getCluster("c1");
     ClusterEntity clusterEntity = clusterDAO.findByName("c1");
-    StackId stackId = cluster.getCurrentStackVersion();
-    StackId newStackId = new StackId("HDP-2.0.6");
+    RepositoryVersionEntity repoVersion220 = helper.getOrCreateRepositoryVersion(newStackId, "2.2.0-1234");
 
     StackEntity currentStack = stackDAO.find(stackId.getStackName(), stackId.getStackVersion());
     StackEntity newStack = stackDAO.find(newStackId.getStackName(), newStackId.getStackVersion());
 
     Assert.assertFalse(stackId.equals(newStackId));
 
-    String configType = "foo-type";
+    // add a service
+    String serviceName = "ZOOKEEPER";
+    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
+    Service service = cluster.addService(serviceName, repositoryVersion);
+    String configType = "zoo.cfg";
 
     // create 5 configurations in the current stack
     for (int i = 1; i <= 5; i++) {
@@ -2100,6 +2122,9 @@ public class ClusterTest {
     // save them all
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    // create a service configuration for them
+    cluster.createServiceConfigVersion(serviceName, "", "version-1", null);
+
     // create a new configuration in the new stack and enable it
     ClusterConfigEntity clusterConfigNewStack = new ClusterConfigEntity();
     clusterConfigNewStack.setClusterEntity(clusterEntity);
@@ -2116,6 +2141,11 @@ public class ClusterTest {
     clusterEntity.getClusterConfigEntities().add(clusterConfigNewStack);
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    // before creating the new service config version, we need to push the
+    // service's desired repository forward
+    service.setDesiredRepositoryVersion(repoVersion220);
+    cluster.createServiceConfigVersion(serviceName, "", "version-2", null);
+
     // check that only the newest configuration is enabled
     ClusterConfigEntity clusterConfig = clusterDAO.findEnabledConfigByType(
         clusterEntity.getClusterId(), configType);
@@ -2123,7 +2153,7 @@ public class ClusterTest {
     Assert.assertEquals(clusterConfigNewStack.getTag(), clusterConfig.getTag());
 
     // move back to the original stack
-    cluster.applyLatestConfigurations(stackId);
+    cluster.applyLatestConfigurations(stackId, serviceName);
     clusterEntity = clusterDAO.findByName("c1");
 
     // now check that latest config from the original stack is enabled
@@ -2138,65 +2168,73 @@ public class ClusterTest {
    */
   @Test
   public void testDesiredConfigurationsAfterApplyingLatestForStack() throws Exception {
-    createDefaultCluster();
-    Cluster cluster = clusters.getCluster("c1");
-    StackId stackId = cluster.getCurrentStackVersion();
+    StackId stackId = new StackId("HDP-2.0.6");
     StackId newStackId = new StackId("HDP-2.2.0");
+    createDefaultCluster(Sets.newHashSet("host-1"), stackId);
+
+    Cluster cluster = clusters.getCluster("c1");
+    RepositoryVersionEntity repoVersion220 = helper.getOrCreateRepositoryVersion(newStackId, "2.2.0-1234");
 
     ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
 
     // make sure the stacks are different
     Assert.assertFalse(stackId.equals(newStackId));
 
+    // add a service
+    String serviceName = "ZOOKEEPER";
+    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
+    Service service = cluster.addService(serviceName, repositoryVersion);
+    String configType = "zoo.cfg";
+
     Map<String, String> properties = new HashMap<>();
     Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
 
-    // foo-type for v1 on current stack
+    // config for v1 on current stack
     properties.put("foo-property-1", "foo-value-1");
-    Config c1 = configFactory.createNew(cluster, "foo-type", "version-1", properties, propertiesAttributes);
+    Config c1 = configFactory.createNew(stackId, cluster, configType, "version-1", properties, propertiesAttributes);
 
     // make v1 "current"
     cluster.addDesiredConfig("admin", Sets.newHashSet(c1), "note-1");
 
-    // bump the stack
-    cluster.setDesiredStackVersion(newStackId);
+    // bump the repo version
+    service.setDesiredRepositoryVersion(repoVersion220);
 
     // save v2
-    // foo-type for v2 on new stack
+    // config for v2 on new stack
     properties.put("foo-property-2", "foo-value-2");
-    Config c2 = configFactory.createNew(cluster, "foo-type", "version-2", properties, propertiesAttributes);
+    Config c2 = configFactory.createNew(newStackId, cluster, configType, "version-2", properties, propertiesAttributes);
 
     // make v2 "current"
     cluster.addDesiredConfig("admin", Sets.newHashSet(c2), "note-2");
 
     // check desired config
     Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
-    DesiredConfig desiredConfig = desiredConfigs.get("foo-type");
-    desiredConfig = desiredConfigs.get("foo-type");
+    DesiredConfig desiredConfig = desiredConfigs.get(configType);
+    desiredConfig = desiredConfigs.get(configType);
     assertNotNull(desiredConfig);
     assertEquals(Long.valueOf(2), desiredConfig.getVersion());
     assertEquals("version-2", desiredConfig.getTag());
 
     String hostName = cluster.getHosts().iterator().next().getHostName();
 
-    // {foo-type={tag=version-2}}
+    // {config-type={tag=version-2}}
     Map<String, Map<String, String>> effectiveDesiredTags = configHelper.getEffectiveDesiredTags(
         cluster, hostName);
 
-    assertEquals("version-2", effectiveDesiredTags.get("foo-type").get("tag"));
+    assertEquals("version-2", effectiveDesiredTags.get(configType).get("tag"));
 
-    // move the stack back to the old stack
-    cluster.setDesiredStackVersion(stackId);
+    // move the service back to the old repo version / stack
+    service.setDesiredRepositoryVersion(repositoryVersion);
 
     // apply the configs for the old stack
-    cluster.applyLatestConfigurations(stackId);
+    cluster.applyLatestConfigurations(stackId, serviceName);
 
-    // {foo-type={tag=version-1}}
+    // {config-type={tag=version-1}}
     effectiveDesiredTags = configHelper.getEffectiveDesiredTags(cluster, hostName);
-    assertEquals("version-1", effectiveDesiredTags.get("foo-type").get("tag"));
+    assertEquals("version-1", effectiveDesiredTags.get(configType).get("tag"));
 
     desiredConfigs = cluster.getDesiredConfigs();
-    desiredConfig = desiredConfigs.get("foo-type");
+    desiredConfig = desiredConfigs.get(configType);
     assertNotNull(desiredConfig);
     assertEquals(Long.valueOf(1), desiredConfig.getVersion());
     assertEquals("version-1", desiredConfig.getTag());
@@ -2209,18 +2247,24 @@ public class ClusterTest {
    */
   @Test
   public void testRemoveConfigurations() throws Exception {
-    createDefaultCluster();
+    StackId stackId = new StackId("HDP-2.0.6");
+    StackId newStackId = new StackId("HDP-2.2.0");
+    createDefaultCluster(Sets.newHashSet("host-1"), stackId);
+
     Cluster cluster = clusters.getCluster("c1");
     ClusterEntity clusterEntity = clusterDAO.findByName("c1");
-    StackId stackId = cluster.getCurrentStackVersion();
-    StackId newStackId = new StackId("HDP-2.0.6");
+    RepositoryVersionEntity repoVersion220 = helper.getOrCreateRepositoryVersion(newStackId, "2.2.0-1234");
 
     StackEntity currentStack = stackDAO.find(stackId.getStackName(), stackId.getStackVersion());
     StackEntity newStack = stackDAO.find(newStackId.getStackName(), newStackId.getStackVersion());
 
     Assert.assertFalse(stackId.equals(newStackId));
 
-    String configType = "foo-type";
+    // add a service
+    String serviceName = "ZOOKEEPER";
+    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(c1);
+    Service service = cluster.addService(serviceName, repositoryVersion);
+    String configType = "zoo.cfg";
 
     ClusterConfigEntity clusterConfig = new ClusterConfigEntity();
     clusterConfig.setClusterEntity(clusterEntity);
@@ -2237,6 +2281,13 @@ public class ClusterTest {
     clusterEntity.getClusterConfigEntities().add(clusterConfig);
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    // create the service version association
+    cluster.createServiceConfigVersion(serviceName, "", "version-1", null);
+
+    // now un-select it and create a new config
+    clusterConfig.setSelected(false);
+    clusterConfig = clusterDAO.merge(clusterConfig);
+
     ClusterConfigEntity newClusterConfig = new ClusterConfigEntity();
     newClusterConfig.setClusterEntity(clusterEntity);
     newClusterConfig.setConfigId(2L);
@@ -2246,12 +2297,19 @@ public class ClusterTest {
     newClusterConfig.setType(configType);
     newClusterConfig.setTimestamp(2L);
     newClusterConfig.setVersion(2L);
-    newClusterConfig.setSelected(false);
+    newClusterConfig.setSelected(true);
 
     clusterDAO.createConfig(newClusterConfig);
     clusterEntity.getClusterConfigEntities().add(newClusterConfig);
     clusterEntity = clusterDAO.merge(clusterEntity);
 
+    // before creating the new service config version, we need to push the
+    // service's desired repository forward
+    service.setDesiredRepositoryVersion(repoVersion220);
+    cluster.createServiceConfigVersion(serviceName, "", "version-2", null);
+
+    cluster.applyLatestConfigurations(newStackId, serviceName);
+
     // get back the cluster configs for the new stack
     List<ClusterConfigEntity> clusterConfigs = clusterDAO.getAllConfigurations(
         cluster.getClusterId(), newStackId);
@@ -2259,7 +2317,7 @@ public class ClusterTest {
     Assert.assertEquals(1, clusterConfigs.size());
 
     // remove the configs
-    cluster.removeConfigurations(newStackId);
+    cluster.removeConfigurations(newStackId, serviceName);
 
     clusterConfigs = clusterDAO.getAllConfigurations(cluster.getClusterId(), newStackId);
     Assert.assertEquals(0, clusterConfigs.size());

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
index b8c0e7c..c851419 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
@@ -545,7 +545,7 @@ public class ServiceComponentHostTest {
 
     Cluster cluster = clusters.getCluster(clusterName);
 
-    final ConfigGroup configGroup = configGroupFactory.createNew(cluster,
+    final ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS",
       "cg1", "t1", "", new HashMap<String, Config>(), new HashMap<Long, Host>());
 
     cluster.addConfigGroup(configGroup);
@@ -799,7 +799,7 @@ public class ServiceComponentHostTest {
         new HashMap<String, Map<String,String>>());
 
     host.addDesiredConfig(cluster.getClusterId(), true, "user", c);
-    ConfigGroup configGroup = configGroupFactory.createNew(cluster, "g1",
+    ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", "g1",
       "t1", "", new HashMap<String, Config>() {{ put("hdfs-site", c); }},
       new HashMap<Long, Host>() {{ put(hostEntity.getHostId(), host); }});
     cluster.addConfigGroup(configGroup);
@@ -855,7 +855,7 @@ public class ServiceComponentHostTest {
     final Config c1 = configFactory.createNew(cluster, "core-site", "version2",
       new HashMap<String, String>() {{ put("fs.trash.interval", "400"); }},
       new HashMap<String, Map<String,String>>());
-    configGroup = configGroupFactory.createNew(cluster, "g2",
+    configGroup = configGroupFactory.createNew(cluster, "HDFS", "g2",
       "t2", "", new HashMap<String, Config>() {{ put("core-site", c1); }},
       new HashMap<Long, Host>() {{ put(hostEntity.getHostId(), host); }});
     cluster.addConfigGroup(configGroup);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/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 26df0d2..066ec34 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
@@ -131,7 +131,7 @@ public class AbstractUpgradeCatalogTest {
     mergedProperties.put("prop1", "v1-old");
     mergedProperties.put("prop4", "v4");
 
-    expect(amc.createConfig(anyObject(StackId.class), eq(cluster), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
 
     replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
 
@@ -153,7 +153,7 @@ public class AbstractUpgradeCatalogTest {
     mergedProperties.put("prop2", "v2");
     mergedProperties.put("prop3", "v3-old");
 
-    expect(amc.createConfig(anyObject(StackId.class), eq(cluster), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
 
     replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
 
@@ -172,7 +172,7 @@ public class AbstractUpgradeCatalogTest {
     Map<String, String> mergedProperties = new HashMap<>();
     mergedProperties.put("prop1", "v1-old");
 
-    expect(amc.createConfig(anyObject(StackId.class), eq(cluster), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
+    expect(amc.createConfig(eq(cluster), anyObject(StackId.class), eq("hdfs-site"), eq(mergedProperties), anyString(), eq(tags))).andReturn(null);
 
     replay(injector, configHelper, amc, cluster, clusters, serviceInfo, oldConfig);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
index a8f5f62..7218578 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
@@ -517,7 +517,7 @@ public class UpgradeCatalog210Test {
     expect(mockClusterExpected.getDesiredConfigByType("hive-site")).andReturn(mockHiveSite).atLeastOnce();
     expect(mockHiveSite.getProperties()).andReturn(propertiesExpectedHiveSite).anyTimes();
     expect(mockClusterExpected.getServices()).andReturn(servicesExpected).atLeastOnce();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), (Cluster)anyObject(),
+    expect(mockAmbariManagementController.createConfig((Cluster)anyObject(), anyObject(StackId.class),
       anyString(),
       capture(configCreation),
       anyString(),
@@ -601,7 +601,7 @@ public class UpgradeCatalog210Test {
     expect(mockHiveSite.getProperties()).andReturn(propertiesExpectedHiveSite).anyTimes();
     expect(mockHivePluginProperies.getProperties()).andReturn(propertiesExpectedPluginProperies).anyTimes();
     expect(mockClusterExpected.getServices()).andReturn(servicesExpected).atLeastOnce();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), (Cluster) anyObject(),
+    expect(mockAmbariManagementController.createConfig((Cluster) anyObject(), anyObject(StackId.class),
         anyString(),
         capture(configCreation),
         anyString(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog211Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog211Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog211Test.java
index f2e9974..14fb598 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog211Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog211Test.java
@@ -269,7 +269,7 @@ public class UpgradeCatalog211Test extends EasyMockSupport {
     Capture<Map<String, Map<String, String>>> attributesCapture = newCapture();
 
 
-    expect(controller.createConfig(anyObject(StackId.class), capture(clusterCapture), capture(typeCapture),
+    expect(controller.createConfig(capture(clusterCapture), anyObject(StackId.class),capture(typeCapture),
         capture(propertiesCapture), capture(tagCapture), capture(attributesCapture) ))
         .andReturn(createNiceMock(Config.class))
         .once();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
index 4c9f661..1c3d34b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
@@ -605,7 +605,7 @@ public class UpgradeCatalog220Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -666,7 +666,7 @@ public class UpgradeCatalog220Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
index 102c629..ff859f0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
@@ -455,7 +455,7 @@ public class UpgradeCatalog221Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).anyTimes();
 
     replay(controller, injector2);
@@ -511,7 +511,7 @@ public class UpgradeCatalog221Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
index ba2cf79..9611334 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
@@ -553,7 +553,7 @@ public class UpgradeCatalog222Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -612,7 +612,7 @@ public class UpgradeCatalog222Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
index f4903fe..46ce2d5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
@@ -765,9 +765,9 @@ public class UpgradeCatalog240Test {
 
     Capture<Map<String, String>> oozieCapture =  newCapture();
     Capture<Map<String, String>> hiveCapture =  newCapture();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockClusterExpected), eq("oozie-env"),
+    expect(mockAmbariManagementController.createConfig(eq(mockClusterExpected), anyObject(StackId.class), eq("oozie-env"),
         capture(oozieCapture), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockClusterExpected), eq("hive-env"),
+    expect(mockAmbariManagementController.createConfig(eq(mockClusterExpected), anyObject(StackId.class), eq("hive-env"),
             capture(hiveCapture), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
 
     easyMockSupport.replayAll();
@@ -849,15 +849,15 @@ public class UpgradeCatalog240Test {
     expect(falconStartupConfig.getProperties()).andReturn(falconStartupConfigProperties).anyTimes();
 
     Capture<Map<String, String>> falconCapture =  newCapture();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockClusterExpected), eq("falcon-env"),
+    expect(mockAmbariManagementController.createConfig(eq(mockClusterExpected), anyObject(StackId.class),  eq("falcon-env"),
         capture(falconCapture), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
 
     Capture<Map<String, String>> falconCapture2 =  newCapture();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockClusterExpected), eq("falcon-env"),
+    expect(mockAmbariManagementController.createConfig(eq(mockClusterExpected), anyObject(StackId.class), eq("falcon-env"),
         capture(falconCapture2), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
 
     Capture<Map<String, String>> falconStartupCapture =  newCapture();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockClusterExpected), eq("falcon-startup.properties"),
+    expect(mockAmbariManagementController.createConfig(eq(mockClusterExpected), anyObject(StackId.class), eq("falcon-startup.properties"),
         capture(falconStartupCapture), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
 
     easyMockSupport.replayAll();
@@ -939,7 +939,7 @@ public class UpgradeCatalog240Test {
 
 
     Capture<Map<String, String>> hbaseCapture =  newCapture();
-    expect(mockAmbariManagementController.createConfig(anyObject(StackId.class), eq(mockCluster), eq("hbase-site"),
+    expect(mockAmbariManagementController.createConfig(eq(mockCluster), anyObject(StackId.class), eq("hbase-site"),
         capture(hbaseCapture), anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(null).once();
 
     easyMockSupport.replayAll();
@@ -1025,7 +1025,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
                                    EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1101,9 +1101,9 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("hdfs-site"), capture(propertiesCaptureHdfsSite), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("hdfs-site"), capture(propertiesCaptureHdfsSite), anyString(),
                                    EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("hadoop-env"), capture(propertiesCaptureHadoopEnv), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("hadoop-env"), capture(propertiesCaptureHadoopEnv), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1169,7 +1169,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
             EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1301,9 +1301,9 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("spark-defaults"), capture(propertiesSparkDefaultsCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("spark-defaults"), capture(propertiesSparkDefaultsCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("spark-javaopts-properties"), capture(propertiesSparkJavaOptsCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("spark-javaopts-properties"), capture(propertiesSparkJavaOptsCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1362,7 +1362,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1421,7 +1421,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1478,7 +1478,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);
@@ -1583,7 +1583,7 @@ public class UpgradeCatalog240Test {
     Capture<String> tagCapture = newCapture(CaptureType.ALL);
     Capture<Map<String, Map<String, String>>> attributesCapture = newCapture(CaptureType.ALL);
 
-    expect(controller.createConfig(anyObject(StackId.class), capture(clusterCapture), capture(typeCapture),
+    expect(controller.createConfig(capture(clusterCapture), anyObject(StackId.class), capture(typeCapture),
         capture(propertiesCapture), capture(tagCapture), capture(attributesCapture) ))
         .andReturn(createNiceMock(Config.class))
         .anyTimes();
@@ -1739,7 +1739,7 @@ public class UpgradeCatalog240Test {
     Capture<String> tagCapture = newCapture(CaptureType.ALL);
     Capture<Map<String, Map<String, String>>> attributesCapture = newCapture(CaptureType.ALL);
 
-    expect(controller.createConfig(anyObject(StackId.class), capture(clusterCapture), capture(typeCapture),
+    expect(controller.createConfig(capture(clusterCapture), anyObject(StackId.class), capture(typeCapture),
         capture(propertiesCapture), capture(tagCapture), capture(attributesCapture)))
         .andReturn(createNiceMock(Config.class))
         .anyTimes();
@@ -2586,7 +2586,7 @@ public class UpgradeCatalog240Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
             EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(createNiceMock(Config.class)).once();
 
     replay(controller, injector2);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 118d5f1..0663049 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -737,7 +737,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(controller, injector2);
@@ -824,7 +824,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
       EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(controller, injector2);
@@ -905,7 +905,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).times(2);
 
     replay(controller, injector2);
@@ -959,7 +959,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(controller, injector2);
@@ -1064,7 +1064,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("ams-log4j")).andReturn(mockAmsLog4j).atLeastOnce();
     expect(mockAmsLog4j.getProperties()).andReturn(oldAmsLog4j).anyTimes();
     Capture<Map<String, String>> AmsLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(AmsLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(AmsLog4jCapture), anyString(),
         anyObject(Map.class))).andReturn(config).once();
 
     Map<String, String> oldAmsHbaseLog4j = ImmutableMap.of(
@@ -1299,7 +1299,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("ams-hbase-log4j")).andReturn(mockAmsHbaseLog4j).atLeastOnce();
     expect(mockAmsHbaseLog4j.getProperties()).andReturn(oldAmsHbaseLog4j).anyTimes();
     Capture<Map<String, String>> AmsHbaseLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(AmsHbaseLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(AmsHbaseLog4jCapture), anyString(),
         anyObject(Map.class))).andReturn(config).once();
 
     replay(clusters, cluster);
@@ -1348,7 +1348,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("logsearch-properties")).andReturn(mockLogSearchProperties).atLeastOnce();
     expect(mockLogSearchProperties.getProperties()).andReturn(oldLogSearchProperties).anyTimes();
     Capture<Map<String, String>> logSearchPropertiesCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logSearchPropertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchPropertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldLogFeederEnv = ImmutableMap.of(
@@ -1361,7 +1361,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("logfeeder-env")).andReturn(mockLogFeederEnv).atLeastOnce();
     expect(mockLogFeederEnv.getProperties()).andReturn(oldLogFeederEnv).anyTimes();
     Capture<Map<String, String>> logFeederEnvCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logFeederEnvCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logFeederEnvCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldLogSearchEnv = new HashMap<>();
@@ -1383,7 +1383,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("logsearch-env")).andReturn(mockLogSearchEnv).atLeastOnce();
     expect(mockLogSearchEnv.getProperties()).andReturn(oldLogSearchEnv).anyTimes();
     Capture<Map<String, String>> logSearchEnvCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logSearchEnvCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchEnvCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldLogFeederLog4j = ImmutableMap.of(
@@ -1436,7 +1436,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("logfeeder-log4j")).andReturn(mockLogFeederLog4j).atLeastOnce();
     expect(mockLogFeederLog4j.getProperties()).andReturn(oldLogFeederLog4j).anyTimes();
     Capture<Map<String, String>> logFeederLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logFeederLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logFeederLog4jCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldLogSearchLog4j = ImmutableMap.of(
@@ -1554,7 +1554,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("logsearch-log4j")).andReturn(mockLogSearchLog4j).atLeastOnce();
     expect(mockLogSearchLog4j.getProperties()).andReturn(oldLogSearchLog4j).anyTimes();
     Capture<Map<String, String>> logSearchLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logSearchLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchLog4jCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(clusters, cluster);
@@ -1613,7 +1613,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("infra-solr-env")).andReturn(mockInfraSolrEnv).atLeastOnce();
     expect(mockInfraSolrEnv.getProperties()).andReturn(oldInfraSolrEnv).anyTimes();
     Capture<Map<String, String>> infraSolrEnvCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(infraSolrEnvCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(infraSolrEnvCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldInfraSolrLog4j = ImmutableMap.of(
@@ -1630,7 +1630,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("infra-solr-log4j")).andReturn(mockInfraSolrLog4j).atLeastOnce();
     expect(mockInfraSolrLog4j.getProperties()).andReturn(oldInfraSolrLog4j).anyTimes();
     Capture<Map<String, String>> infraSolrLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(infraSolrLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(infraSolrLog4jCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Map<String, String> oldInfraSolrClientLog4j = ImmutableMap.of(
@@ -1649,7 +1649,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("infra-solr-client-log4j")).andReturn(mockInfraSolrClientLog4j).atLeastOnce();
     expect(mockInfraSolrClientLog4j.getProperties()).andReturn(oldInfraSolrClientLog4j).anyTimes();
     Capture<Map<String, String>> infraSolrClientLog4jCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(infraSolrClientLog4jCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(infraSolrClientLog4jCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(clusters, cluster);
@@ -1708,7 +1708,7 @@ public class UpgradeCatalog250Test {
     expect(cluster.getDesiredConfigByType("hive-interactive-env")).andReturn(mockHsiEnv).atLeastOnce();
     expect(mockHsiEnv.getProperties()).andReturn(oldHsiEnv).anyTimes();
     Capture<Map<String, String>> hsiEnvCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(hsiEnvCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(hsiEnvCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(clusters, cluster);
@@ -1789,7 +1789,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(controller, injector2);
@@ -2076,7 +2076,7 @@ public class UpgradeCatalog250Test {
 
     expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
     expect(controller.getClusters()).andReturn(clusters).anyTimes();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(propertiesCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(propertiesCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(controller, injector2);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c4148d80/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 b5f0e09..43707dd 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
@@ -300,7 +300,7 @@ public class UpgradeCatalog300Test {
     expect(confLogSearchConf1.getProperties()).andReturn(oldLogSearchConf).once();
     expect(confLogSearchConf2.getProperties()).andReturn(oldLogSearchConf).once();
     Capture<Map<String, String>> logSearchConfCapture = EasyMock.newCapture(CaptureType.ALL);
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), anyString(), capture(logSearchConfCapture), anyString(),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchConfCapture), anyString(),
         EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).times(2);
 
     Map<String, String> oldLogSearchProperties = ImmutableMap.of(
@@ -315,14 +315,14 @@ public class UpgradeCatalog300Test {
     expect(cluster.getDesiredConfigByType("logfeeder-properties")).andReturn(logFeederPropertiesConf).times(2);
     expect(logFeederPropertiesConf.getProperties()).andReturn(Collections.<String, String> emptyMap()).once();
     Capture<Map<String, String>> logFeederPropertiesCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("logfeeder-properties"), capture(logFeederPropertiesCapture),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("logfeeder-properties"), capture(logFeederPropertiesCapture),
         anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     Config logSearchPropertiesConf = easyMockSupport.createNiceMock(Config.class);
     expect(cluster.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchPropertiesConf).times(2);
     expect(logSearchPropertiesConf.getProperties()).andReturn(oldLogSearchProperties).times(2);
     Capture<Map<String, String>> logSearchPropertiesCapture = EasyMock.newCapture();
-    expect(controller.createConfig(anyObject(StackId.class), anyObject(Cluster.class), eq("logsearch-properties"), capture(logSearchPropertiesCapture),
+    expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("logsearch-properties"), capture(logSearchPropertiesCapture),
         anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once();
 
     replay(clusters, cluster);


Mime
View raw message