[1/2] ambari git commit: AMBARI-22614. Fix unit tests in feature branch to make them workable.(vbrodetskyi)

2017-12-14 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 bfeaa1071 -> 481175d12


http://git-wip-us.apache.org/repos/asf/ambari/blob/481175d1/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
index 8546a9b..d43a712 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
@@ -62,6 +62,7 @@ import org.apache.ambari.server.mpack.MpackManagerFactory;
 import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
+import org.apache.ambari.server.resources.RootLevelSettingsManagerFactory;
 import org.apache.ambari.server.security.SecurityHelper;
 import org.apache.ambari.server.security.encryption.CredentialStoreService;
 import org.apache.ambari.server.stack.StackManagerFactory;
@@ -133,6 +134,7 @@ public class StageUtilsTest extends EasyMockSupport {
 
bind(HostRoleCommandDAO.class).toInstance(createNiceMock(HostRoleCommandDAO.class));
 
bind(MpackManagerFactory.class).toInstance(createNiceMock(MpackManagerFactory.class));
 
bind(AmbariManagementController.class).toInstance(createNiceMock(AmbariManagementController.class));
+
bind(RootLevelSettingsManagerFactory.class).toInstance(createNiceMock(RootLevelSettingsManagerFactory.class));
 install(new 
FactoryModuleBuilder().build(ExecutionCommandWrapperFactory.class));
 install(new FactoryModuleBuilder().implement(Config.class, 
ConfigImpl.class).build(ConfigFactory.class));
 install(new 
FactoryModuleBuilder().build(ConfigureClusterTaskFactory.class));



[1/2] ambari git commit: AMBARI-22614. Fix unit tests in feature branch to make them workable.(vbrodetskyi)

2017-12-08 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 490808cb9 -> bcbacf0c7


http://git-wip-us.apache.org/repos/asf/ambari/blob/bcbacf0c/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
index a52f438..d40679a 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
@@ -48,6 +48,7 @@ import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
+import org.apache.ambari.server.state.ServiceGroup;
 import org.apache.ambari.server.state.StackId;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -214,7 +215,7 @@ public class ClusterImplTest {
 String stackVersion = "HDP-2.1.1";
 String repoVersion = "2.1.1-1234";
 StackId stackId = new StackId(stackVersion);
-ormTestHelper.createStack(stackId);
+ormTestHelper.createStackWithRepoVersion(stackId, "");
 
 clusters.addCluster(clusterName, stackId);
 Cluster cluster = clusters.getCluster(clusterName);
@@ -233,7 +234,8 @@ public class ClusterImplTest {
 
 clusters.mapAndPublishHostsToCluster(Sets.newHashSet(hostName1, 
hostName2), clusterName);
 
-Service hdfs = cluster.addService(null, "HDFS", "", repositoryVersion);
+ServiceGroup serviceGroup = cluster.addServiceGroup("CORE");
+Service hdfs = cluster.addService(serviceGroup, "HDFS", "HDFS", 
repositoryVersion);
 
 ServiceComponent nameNode = hdfs.addServiceComponent("NAMENODE");
 nameNode.addServiceComponentHost(hostName1);
@@ -246,7 +248,7 @@ public class ClusterImplTest {
 hdfsClient.addServiceComponentHost(hostName1);
 hdfsClient.addServiceComponentHost(hostName2);
 
-Service tez = cluster.addService(null, serviceToDelete, "", 
repositoryVersion);
+Service tez = cluster.addService(serviceGroup, serviceToDelete, 
serviceToDelete, repositoryVersion);
 
 ServiceComponent tezClient = tez.addServiceComponent("TEZ_CLIENT");
 ServiceComponentHost tezClientHost1 =  
tezClient.addServiceComponentHost(hostName1);
@@ -275,7 +277,7 @@ public class ClusterImplTest {
 String hostToDelete = hostName2;
 StackId stackId = new StackId("HDP-2.1.1");
 
-ormTestHelper.createStack(stackId);
+ormTestHelper.createStackWithRepoVersion(stackId, "");
 clusters.addCluster(clusterName, stackId);
 
 Cluster cluster = clusters.getCluster(clusterName);
@@ -315,7 +317,7 @@ public class ClusterImplTest {
 String clusterName = "TEST_CLUSTER_SIZE";
 String hostName1 = "host1", hostName2 = "host2";
 StackId stackId = new StackId("HDP", "2.1.1");
-ormTestHelper.createStack(stackId);
+ormTestHelper.createStackWithRepoVersion(stackId, "");
 clusters.addCluster(clusterName, stackId);
 
 Cluster cluster = clusters.getCluster(clusterName);

http://git-wip-us.apache.org/repos/asf/ambari/blob/bcbacf0c/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 4ce7387..bbfc838 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
@@ -96,6 +96,7 @@ import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.ServiceComponentHostFactory;
 import org.apache.ambari.server.state.ServiceFactory;
+import org.apache.ambari.server.state.ServiceGroup;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
@@ -1076,9 +1077,10 @@ public class ClusterTest {
 
 RepositoryVersionEntity repositoryVersion = 
helper.getOrCreateRepositoryVersion(c1);
 
-c1.addService(null, "MAPREDUCE", "", repositoryVersion);
+ServiceGroup serviceGroup = c1.addServiceGroup("CORE");
+c1.addService(serviceGroup, "MAPREDUCE", "MAPREDUCE", repositoryVersion);
 
-Service hdfs = c1.addService(null, "HDFS", "", repositoryVersion);
+Service hdfs = c1.addService(serviceGroup, "HDFS", "HDFS", 
repositoryVersion);
 ServiceComponent nameNode = hdfs.addServiceComponent("NAMENODE");
 
 assertEquals(2,