Author: swagle
Date: Wed Apr 10 23:22:20 2013
New Revision: 1466730
URL: http://svn.apache.org/r1466730
Log:
AMBARI-1868. Include stack version as a parameter in manifest. Unit test.
(swagle)
Modified:
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
Modified:
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java?rev=1466730&r1=1466729&r2=1466730&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
(original)
+++
incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
Wed Apr 10 23:22:20 2013
@@ -4607,6 +4607,55 @@ public class AmbariManagementControllerT
taskStatuses.get(0).getRole());
}
+ @Test
+ public void testStackVersionAsHostLevelParams() throws AmbariException {
+ String clusterName = "foo1";
+ createCluster(clusterName);
+ clusters.getCluster(clusterName)
+ .setDesiredStackVersion(new StackId("HDP-0.1"));
+ String serviceName = "PIG";
+ createService(clusterName, serviceName, null);
+ String componentName1 = "PIG";
+ createServiceComponent(clusterName, serviceName, componentName1,
+ State.INIT);
+
+ String host1 = "h1";
+ clusters.addHost(host1);
+ clusters.getHost("h1").persist();
+ String host2 = "h2";
+ clusters.addHost(host2);
+ clusters.getHost("h2").persist();
+
+ clusters.getHost("h1").setOsType("centos5");
+ clusters.getHost("h2").setOsType("centos6");
+ clusters.mapHostToCluster(host1, clusterName);
+ clusters.mapHostToCluster(host2, clusterName);
+
+ Map<String, String> mapRequestProps = new HashMap<String, String>();
+ mapRequestProps.put("context", "Called from a test");
+
+ // null service should work
+ createServiceComponentHost(clusterName, null, componentName1,
+ host1, null);
+ createServiceComponentHost(clusterName, null, componentName1,
+ host2, null);
+
+ ServiceRequest r = new ServiceRequest(clusterName, serviceName, null,
+ State.INSTALLED.toString());
+ Set<ServiceRequest> requests = new HashSet<ServiceRequest>();
+ requests.add(r);
+
+ RequestStatusResponse trackAction =
+ controller.updateServices(requests, mapRequestProps, true);
+ Assert.assertEquals(State.INSTALLED,
+ clusters.getCluster(clusterName).getService(serviceName)
+ .getDesiredState());
+
+ List<Stage> stages = actionDB.getAllStages(trackAction.getRequestId());
+ Assert.assertEquals("0.1", stages.get(0).getOrderedHostRoleCommands().get
+ (0).getExecutionCommandWrapper().getExecutionCommand()
+ .getHostLevelParams().get("stack_version"));
+ }
@Test
public void testGetStacks() throws Exception {