You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by js...@apache.org on 2013/03/19 21:20:28 UTC

svn commit: r1458497 [3/4] - in /incubator/ambari/trunk: ./ ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ ambari-server/src/main/java/org/apache/ambari/server/api/handlers/ ambari-server/src/main/java/org/apache/ambari/server/api/...

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java Tue Mar 19 20:20:27 2013
@@ -23,18 +23,19 @@ import com.google.gson.reflect.TypeToken
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import org.apache.ambari.server.*;
-import org.apache.ambari.server.actionmanager.*;
-import org.apache.ambari.server.agent.CommandReport;
-import org.apache.ambari.server.agent.ExecutionCommand;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.ClusterNotFoundException;
+import org.apache.ambari.server.HostNotFoundException;
+import org.apache.ambari.server.ParentObjectNotFoundException;
+import org.apache.ambari.server.ServiceComponentHostNotFoundException;
+import org.apache.ambari.server.ServiceComponentNotFoundException;
+import org.apache.ambari.server.ServiceNotFoundException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
-import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.state.*;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostInstallEvent;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostOpSucceededEvent;
-import org.apache.ambari.server.utils.StageUtils;
 import org.easymock.Capture;
 import org.junit.Test;
 
@@ -1474,6 +1475,7 @@ public class AmbariManagementControllerI
 
   @Test
   public void testMaintenanceAndDeleteStates() throws Exception {
+    Map<String,String> mapRequestProps = new HashMap<String, String>();
     Injector injector = Guice.createInjector(new AbstractModule() {
       @Override
       protected void configure() {
@@ -1513,11 +1515,6 @@ public class AmbariManagementControllerI
 
     Set<ServiceRequest> serviceRequests = new HashSet<ServiceRequest>();
     serviceRequests.add(new ServiceRequest("c1", "HDFS", null, null));
-//    serviceRequests.add(new ServiceRequest("c1", "MAPREDUCE", null, null));
-//    serviceRequests.add(new ServiceRequest("c1", "ZOOKEEPER", null, null));
-//    serviceRequests.add(new ServiceRequest("c1", "HBASE", null, null));
-//    serviceRequests.add(new ServiceRequest("c1", "GANGLIA", null, null));
-//    serviceRequests.add(new ServiceRequest("c1", "NAGIOS", null, null));
 
     amc.createServices(serviceRequests);
 
@@ -1539,30 +1536,6 @@ public class AmbariManagementControllerI
     );
     amc.createConfiguration(configurationRequest);
 
-//    configurationRequest = new ConfigurationRequest("c1", "mapred-site", "version1",
-//        gson.<Map<String, String>>fromJson("{ \"mapred.job.tracker\" : \"localhost:50300\", \"mapreduce.history.server.embedded\": \"false\", \"mapreduce.history.server.http.address\": \"localhost:51111\"}", confType)
-//    );
-//    amc.createConfiguration(configurationRequest);
-//
-//    configurationRequest = new ConfigurationRequest("c1", "hbase-site", "version1",
-//        gson.<Map<String, String>>fromJson("{ \"hbase.rootdir\" : \"hdfs://localhost:8020/apps/hbase/\", \"hbase.cluster.distributed\" : \"true\", \"hbase.zookeeper.quorum\": \"localhost\", \"zookeeper.session.timeout\": \"60000\" }", confType));
-//    amc.createConfiguration(configurationRequest);
-//
-//    configurationRequest = new ConfigurationRequest("c1", "hbase-env", "version1",
-//        gson.<Map<String, String>>fromJson("{ \"hbase_hdfs_root_dir\" : \"/apps/hbase/\"}", confType)
-//    );
-//    amc.createConfiguration(configurationRequest);
-//
-//    configurationRequest = new ConfigurationRequest("c1", "nagios-global", "version2",
-//        gson.<Map<String, String>>fromJson("{ \"nagios_web_login\" : \"nagiosadmin\", \"nagios_web_password\" : \"password\", \"nagios_contact\": \"a\\u0040b.c\" }", confType)
-//    );
-//    amc.createConfiguration(configurationRequest);
-//
-//    configurationRequest = new ConfigurationRequest("c1", "nagios-global", "version1",
-//        gson.<Map<String, String>>fromJson("{ \"nagios_web_login\" : \"nagiosadmin\", \"nagios_web_password\" : \"password\"  }", confType)
-//    );
-//    amc.createConfiguration(configurationRequest);
-
 
     serviceRequests.clear();
     serviceRequests.add(new ServiceRequest("c1", "HDFS",
@@ -1578,7 +1551,7 @@ public class AmbariManagementControllerI
 //        gson.<Map<String, String>>fromJson("{\"nagios-global\": \"version2\" }", confType)
 //        , null));
 
-    amc.updateServices(serviceRequests);
+    amc.updateServices(serviceRequests, mapRequestProps);
 
 
     Set<ServiceComponentRequest> serviceComponentRequests = new HashSet<ServiceComponentRequest>();
@@ -1587,20 +1560,6 @@ public class AmbariManagementControllerI
     serviceComponentRequests.add(new ServiceComponentRequest("c1", "HDFS", "DATANODE", null, null));
     serviceComponentRequests.add(new ServiceComponentRequest("c1", "HDFS", "HDFS_CLIENT", null, null));
 
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "MAPREDUCE", "JOBTRACKER", null, null));
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "MAPREDUCE", "TASKTRACKER", null, null));
-//
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "ZOOKEEPER", "ZOOKEEPER_SERVER", null, null));
-//
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "HBASE", "HBASE_MASTER", null, null));
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "HBASE", "HBASE_REGIONSERVER", null, null));
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "HBASE", "HBASE_CLIENT", null, null));
-//
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "GANGLIA", "GANGLIA_SERVER", null, null));
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "GANGLIA", "GANGLIA_MONITOR", null, null));
-//
-//    serviceComponentRequests.add(new ServiceComponentRequest("c1", "NAGIOS", "NAGIOS_SERVER", null, null));
-
     amc.createComponents(serviceComponentRequests);
 
     Set<HostRequest> hostRequests = new HashSet<HostRequest>();
@@ -1618,34 +1577,11 @@ public class AmbariManagementControllerI
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "DATANODE", "host3", null, null));
 
 
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "JOBTRACKER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "TASKTRACKER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "TASKTRACKER", "host2", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "TASKTRACKER", "host3", null, null));
-//
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "ZOOKEEPER_SERVER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "GANGLIA_SERVER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "GANGLIA_MONITOR", "host1", null, null));
-//
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "HDFS_CLIENT", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "HBASE_MASTER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "HBASE_REGIONSERVER", "host1", null, null));
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "HBASE_CLIENT", "host1", null, null));
-//
-//    componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAGIOS_SERVER", "host1", null, null));
-
-
     amc.createHostComponents(componentHostRequests);
 
     serviceRequests.clear();
     serviceRequests.add(new ServiceRequest("c1", "HDFS", null, "INSTALLED"));
-//    serviceRequests.add(new ServiceRequest("c1", "MAPREDUCE", null, "INSTALLED"));
-//    serviceRequests.add(new ServiceRequest("c1", "ZOOKEEPER", null, "INSTALLED"));
-//    serviceRequests.add(new ServiceRequest("c1", "HBASE", null, "INSTALLED"));
-//    serviceRequests.add(new ServiceRequest("c1", "GANGLIA", null, "INSTALLED"));
-//    serviceRequests.add(new ServiceRequest("c1", "NAGIOS", null, "INSTALLED"));
-
-    amc.updateServices(serviceRequests);
+    amc.updateServices(serviceRequests, mapRequestProps);
 
     Cluster cluster = clusters.getCluster("c1");
     Map<String, ServiceComponentHost> namenodes = cluster.getService("HDFS").getServiceComponent("NAMENODE").getServiceComponentHosts();
@@ -1675,21 +1611,21 @@ public class AmbariManagementControllerI
     componentHostRequests.clear();
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", null, "MAINTENANCE"));
 
-    amc.updateHostComponents(componentHostRequests);
+    amc.updateHostComponents(componentHostRequests, mapRequestProps);
 
     assertEquals(State.MAINTENANCE, componentHost.getState());
 
     componentHostRequests.clear();
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", null, "INSTALLED"));
 
-    amc.updateHostComponents(componentHostRequests);
+    amc.updateHostComponents(componentHostRequests, mapRequestProps);
 
     assertEquals(State.INSTALLED, componentHost.getState());
 
     componentHostRequests.clear();
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host1", null, "MAINTENANCE"));
 
-    amc.updateHostComponents(componentHostRequests);
+    amc.updateHostComponents(componentHostRequests, mapRequestProps);
 
     assertEquals(State.MAINTENANCE, componentHost.getState());
 
@@ -1701,7 +1637,7 @@ public class AmbariManagementControllerI
     componentHostRequests.clear();
     componentHostRequests.add(new ServiceComponentHostRequest("c1", null, "NAMENODE", "host2", null, "INSTALLED"));
 
-    amc.updateHostComponents(componentHostRequests);
+    amc.updateHostComponents(componentHostRequests, mapRequestProps);
 
     namenodes = cluster.getService("HDFS").getServiceComponent("NAMENODE").getServiceComponentHosts();
     assertEquals(2, namenodes.size());
@@ -1713,7 +1649,7 @@ public class AmbariManagementControllerI
     serviceRequests.clear();
     serviceRequests.add(new ServiceRequest("c1", "HDFS", null, "STARTED"));
 
-    RequestStatusResponse response = amc.updateServices(serviceRequests);
+    RequestStatusResponse response = amc.updateServices(serviceRequests, mapRequestProps);
     for (ShortTaskStatus shortTaskStatus : response.getTasks()) {
       assertFalse("host1".equals(shortTaskStatus.getHostName()) && "NAMENODE".equals(shortTaskStatus.getRole()));
     }

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=1458497&r1=1458496&r2=1458497&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 Tue Mar 19 20:20:27 2013
@@ -1302,6 +1302,9 @@ public class AmbariManagementControllerT
     Config c2 = new ConfigImpl(cluster, "core-site", properties, injector);
     Config c3 = new ConfigImpl(cluster, "foo-site", properties, injector);
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     c1.setVersionTag("v1");
     c2.setVersionTag("v1");
     c3.setVersionTag("v1");
@@ -1324,7 +1327,7 @@ public class AmbariManagementControllerT
     requests.add(r);
 
     RequestStatusResponse trackAction =
-        controller.updateServices(requests);
+        controller.updateServices(requests, mapRequestProps);
     Assert.assertEquals(State.INSTALLED,
         clusters.getCluster(clusterName).getService(serviceName)
         .getDesiredState());
@@ -1447,7 +1450,7 @@ public class AmbariManagementControllerT
         State.STARTED.toString());
     requests.clear();
     requests.add(r);
-    trackAction = controller.updateServices(requests);
+    trackAction = controller.updateServices(requests, mapRequestProps);
 
     Assert.assertEquals(State.STARTED,
         clusters.getCluster(clusterName).getService(serviceName)
@@ -1523,7 +1526,7 @@ public class AmbariManagementControllerT
         State.INSTALLED.toString());
     requests.clear();
     requests.add(r);
-    trackAction = controller.updateServices(requests);
+    trackAction = controller.updateServices(requests, mapRequestProps);
 
     Assert.assertEquals(State.INSTALLED,
         clusters.getCluster(clusterName).getService(serviceName)
@@ -2174,6 +2177,10 @@ public class AmbariManagementControllerT
     String clusterName = "foo1";
     createCluster(clusterName);
     String serviceName = "HDFS";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     clusters.getCluster("foo1").setDesiredStackVersion(
         new StackId("HDP-0.2"));
     createService(clusterName, serviceName, State.INIT);
@@ -2193,7 +2200,7 @@ public class AmbariManagementControllerT
           null, State.INSTALLING.toString());
       reqs.clear();
       reqs.add(r);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected fail for invalid state transition");
     } catch (Exception e) {
       // Expected
@@ -2203,7 +2210,7 @@ public class AmbariManagementControllerT
         null, State.INSTALLED.toString());
     reqs.clear();
     reqs.add(r);
-    RequestStatusResponse trackAction = controller.updateServices(reqs);
+    RequestStatusResponse trackAction = controller.updateServices(reqs, mapRequestProps);
     Assert.assertNull(trackAction);
   }
 
@@ -2221,6 +2228,10 @@ public class AmbariManagementControllerT
     createService(clusterName1, serviceName1, null);
     String serviceName2 = "HBASE";
     String serviceName3 = "HBASE";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     try {
       createService(clusterName2, serviceName3, null);
       fail("Expected fail for invalid service for stack 0.1");
@@ -2245,7 +2256,7 @@ public class AmbariManagementControllerT
           State.INSTALLED.toString());
       reqs.add(req1);
       reqs.add(req2);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected failure for multi cluster update");
     } catch (Exception e) {
       // Expected
@@ -2259,7 +2270,7 @@ public class AmbariManagementControllerT
           State.INSTALLED.toString());
       reqs.add(req1);
       reqs.add(req2);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected failure for dups services");
     } catch (Exception e) {
       // Expected
@@ -2276,7 +2287,7 @@ public class AmbariManagementControllerT
           State.STARTED.toString());
       reqs.add(req1);
       reqs.add(req2);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected failure for different states");
     } catch (Exception e) {
       // Expected
@@ -2303,6 +2314,10 @@ public class AmbariManagementControllerT
     String componentName2 = "DATANODE";
     String componentName3 = "HBASE_MASTER";
     String componentName4 = "HDFS_CLIENT";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createServiceComponent(clusterName, serviceName1, componentName1,
         State.INIT);
     createServiceComponent(clusterName, serviceName1, componentName2,
@@ -2391,7 +2406,7 @@ public class AmbariManagementControllerT
       req1 = new ServiceRequest(clusterName, serviceName1, null,
           State.STARTED.toString());
       reqs.add(req1);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected failure for invalid state update");
     } catch (Exception e) {
       // Expected
@@ -2418,7 +2433,7 @@ public class AmbariManagementControllerT
       req1 = new ServiceRequest(clusterName, serviceName1, null,
           State.STARTED.toString());
       reqs.add(req1);
-      controller.updateServices(reqs);
+      controller.updateServices(reqs, mapRequestProps);
       fail("Expected failure for invalid state update");
     } catch (Exception e) {
       // Expected
@@ -2447,7 +2462,7 @@ public class AmbariManagementControllerT
         State.STARTED.toString());
     reqs.add(req1);
     reqs.add(req2);
-    RequestStatusResponse trackAction = controller.updateServices(reqs);
+    RequestStatusResponse trackAction = controller.updateServices(reqs, mapRequestProps);
 
     Assert.assertEquals(State.STARTED, s1.getDesiredState());
     Assert.assertEquals(State.STARTED, s2.getDesiredState());
@@ -2517,7 +2532,7 @@ public class AmbariManagementControllerT
         State.STARTED.toString());
     reqs.add(req1);
     reqs.add(req2);
-    trackAction = controller.updateServices(reqs);
+    trackAction = controller.updateServices(reqs, mapRequestProps);
     Assert.assertNull(trackAction);
 
   }
@@ -2607,7 +2622,7 @@ public class AmbariManagementControllerT
       req1 = new ServiceComponentRequest(clusterName, serviceName1,
           sc1.getName(), null, State.INIT.toString());
       reqs.add(req1);
-      controller.updateComponents(reqs);
+      controller.updateComponents(reqs, Collections.<String, String>emptyMap());
       fail("Expected failure for invalid state update");
     } catch (Exception e) {
       // Expected
@@ -2633,7 +2648,7 @@ public class AmbariManagementControllerT
       req1 = new ServiceComponentRequest(clusterName, serviceName1,
           sc1.getName(), null, State.STARTED.toString());
       reqs.add(req1);
-      controller.updateComponents(reqs);
+      controller.updateComponents(reqs, Collections.<String, String>emptyMap());
       fail("Expected failure for invalid state update");
     } catch (Exception e) {
       // Expected
@@ -2664,7 +2679,7 @@ public class AmbariManagementControllerT
     reqs.add(req1);
     reqs.add(req2);
     reqs.add(req3);
-    RequestStatusResponse trackAction = controller.updateComponents(reqs);
+    RequestStatusResponse trackAction = controller.updateComponents(reqs, Collections.<String, String>emptyMap());
 
     Assert.assertEquals(State.INSTALLED, s1.getDesiredState());
     Assert.assertEquals(State.INSTALLED, sc1.getDesiredState());
@@ -2708,7 +2723,7 @@ public class AmbariManagementControllerT
         sc2.getName(), null, State.INSTALLED.toString());
     reqs.add(req1);
     reqs.add(req2);
-    trackAction = controller.updateComponents(reqs);
+    trackAction = controller.updateComponents(reqs, Collections.<String, String>emptyMap());
     Assert.assertNull(trackAction);
   }
 
@@ -2799,7 +2814,7 @@ public class AmbariManagementControllerT
           componentName1, host1,
           null, State.STARTED.toString());
       reqs.add(req1);
-      controller.updateHostComponents(reqs);
+      controller.updateHostComponents(reqs, Collections.<String, String>emptyMap());
       fail("Expected failure for invalid transition");
     } catch (Exception e) {
       // Expected
@@ -2827,7 +2842,7 @@ public class AmbariManagementControllerT
       reqs.add(req3);
       reqs.add(req4);
       reqs.add(req5);
-      controller.updateHostComponents(reqs);
+      controller.updateHostComponents(reqs, Collections.<String, String>emptyMap());
       fail("Expected failure for invalid states");
     } catch (Exception e) {
       // Expected
@@ -2854,7 +2869,7 @@ public class AmbariManagementControllerT
     reqs.add(req3);
     reqs.add(req4);
     reqs.add(req5);
-    RequestStatusResponse trackAction = controller.updateHostComponents(reqs);
+    RequestStatusResponse trackAction = controller.updateHostComponents(reqs, Collections.<String, String>emptyMap());
     Assert.assertNotNull(trackAction);
 
     long requestId = trackAction.getRequestId();
@@ -2886,7 +2901,7 @@ public class AmbariManagementControllerT
         null, State.INSTALLED.toString());
     reqs.add(req1);
     reqs.add(req2);
-    trackAction = controller.updateHostComponents(reqs);
+    trackAction = controller.updateHostComponents(reqs, Collections.<String, String>emptyMap());
     Assert.assertNull(trackAction);
   }
 
@@ -2974,10 +2989,13 @@ public class AmbariManagementControllerT
     req2.setDesiredStackId("HDP-0.2");
     reqs.add(req2);
 
-    RequestStatusResponse resp = controller.updateHostComponents(reqs);
+    Map<String,String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "testServiceComponentHostUpdateStackId");
+    RequestStatusResponse resp = controller.updateHostComponents(reqs, mapRequestProps);
     List<Stage> stages = actionDB.getAllStages(resp.getRequestId());
     Assert.assertEquals(1, stages.size());
     Assert.assertEquals(2, stages.get(0).getOrderedHostRoleCommands().size());
+    Assert.assertEquals("testServiceComponentHostUpdateStackId", stages.get(0).getRequestContext());
     Assert.assertEquals(State.UPGRADING, sch1.getState());
     Assert.assertEquals(State.UPGRADING, sch2.getState());
     sch1.refresh();
@@ -3018,10 +3036,11 @@ public class AmbariManagementControllerT
     req3.setDesiredStackId("HDP-0.2");
     reqs.add(req3);
 
-    resp = controller.updateHostComponents(reqs);
+    resp = controller.updateHostComponents(reqs, Collections.<String, String>emptyMap());
     stages = actionDB.getAllStages(resp.getRequestId());
     Assert.assertEquals(2, stages.size());
     Assert.assertEquals(2, stages.get(0).getOrderedHostRoleCommands().size());
+    Assert.assertEquals("", stages.get(0).getRequestContext());
     Assert.assertEquals(State.UPGRADING, sch1.getState());
     Assert.assertEquals(State.UPGRADING, sch2.getState());
     Assert.assertEquals(State.UPGRADING, sch3.getState());
@@ -3191,7 +3210,8 @@ public class AmbariManagementControllerT
         null, null);
     req1.setDesiredStackId("HDP-0.2");
     reqs.add(req1);
-    RequestStatusResponse resp = controller.updateHostComponents(reqs);
+
+    RequestStatusResponse resp = controller.updateHostComponents(reqs, Collections.<String,String>emptyMap());
     Assert.assertNull(resp);
 
     c1.setCurrentStackVersion(new StackId("HDP-0.2"));
@@ -3203,14 +3223,14 @@ public class AmbariManagementControllerT
         null, State.INSTALLED.toString());
     req1.setDesiredStackId("HDP-0.2");
     reqs.add(req1);
-    resp = controller.updateHostComponents(reqs);
+    resp = controller.updateHostComponents(reqs, Collections.<String,String>emptyMap());
     Assert.assertNull(resp);
   }
 
   private void updateHostAndCompareExpectedFailure(Set<ServiceComponentHostRequest> reqs,
                                                    String expectedMessage) {
     try {
-      controller.updateHostComponents(reqs);
+      controller.updateHostComponents(reqs, Collections.<String,String>emptyMap());
       fail("Expected failure: " + expectedMessage);
     } catch (Exception e) {
       LOG.info("Actual exception message: " + e.getMessage());
@@ -3238,6 +3258,9 @@ public class AmbariManagementControllerT
     String clusterName = "c1";
     final String hostName1 = "h1";
     final String hostName2 = "h2";
+    String context = "Test invocation";
+
+
     clusters.addCluster(clusterName);
     clusters.getCluster(clusterName).setDesiredStackVersion(
         new StackId("HDP-0.1"));
@@ -3252,7 +3275,7 @@ public class AmbariManagementControllerT
 
 
     List<Stage> stages = new ArrayList<Stage>();
-    stages.add(new Stage(requestId, "/a1", clusterName));
+    stages.add(new Stage(requestId, "/a1", clusterName, context));
     stages.get(0).setStageId(stageId++);
     stages.get(0).addHostRoleExecutionCommand(hostName1, Role.HBASE_MASTER,
         RoleCommand.START,
@@ -3260,7 +3283,7 @@ public class AmbariManagementControllerT
             hostName1, System.currentTimeMillis(),
             new HashMap<String, String>()),
             clusterName, "HBASE");
-    stages.add(new Stage(requestId, "/a2", clusterName));
+    stages.add(new Stage(requestId, "/a2", clusterName, context));
     stages.get(1).setStageId(stageId);
     stages.get(1).addHostRoleExecutionCommand(hostName1, Role.HBASE_CLIENT,
         RoleCommand.START,
@@ -3277,6 +3300,7 @@ public class AmbariManagementControllerT
         requestStatusResponses.iterator().next();
     assertEquals(requestId, requestStatusResponse.getRequestId());
     assertEquals(2, requestStatusResponse.getTasks().size());
+    assertEquals(context, requestStatusResponse.getRequestContext());
 
     ShortTaskStatus task1 = requestStatusResponse.getTasks().get(0);
     ShortTaskStatus task2 = requestStatusResponse.getTasks().get(1);
@@ -3459,6 +3483,10 @@ public class AmbariManagementControllerT
     String componentName1 = "JOBTRACKER";
     String componentName2 = "TASKTRACKER";
     String componentName3 = "MAPREDUCE_CLIENT";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createServiceComponent(clusterName, serviceName, componentName1,
         State.INIT);
     createServiceComponent(clusterName, serviceName, componentName2,
@@ -3498,7 +3526,7 @@ public class AmbariManagementControllerT
     ClusterRequest cr = new ClusterRequest(null, clusterName, null, null);
     cr.setDesiredConfig(new ConfigurationRequest(clusterName, "global",
         "v1", configs));
-    controller.updateCluster(cr);
+    controller.updateCluster(cr, Collections.<String,String>emptyMap());
 
     Set<ServiceRequest> sReqs = new HashSet<ServiceRequest>();
     Map<String, String> configVersions = new HashMap<String, String>();
@@ -3506,7 +3534,7 @@ public class AmbariManagementControllerT
     sReqs.clear();
     sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
         "INSTALLED"));
-    RequestStatusResponse trackAction = controller.updateServices(sReqs);
+    RequestStatusResponse trackAction = controller.updateServices(sReqs, mapRequestProps);
     List<Stage> stages = actionDB.getAllStages(trackAction.getRequestId());
     for (ExecutionCommandWrapper cmd : stages.get(0)
         .getExecutionCommands(host1)) {
@@ -3526,289 +3554,293 @@ public class AmbariManagementControllerT
 
   @Test
   public void testUpdateConfigForRunningService() throws Exception {
-      String clusterName = "foo1";
-      createCluster(clusterName);
-      clusters.getCluster(clusterName)
-              .setDesiredStackVersion(new StackId("HDP-0.1"));
-      String serviceName = "HDFS";
-      createService(clusterName, serviceName, null);
-      String componentName1 = "NAMENODE";
-      String componentName2 = "DATANODE";
-      String componentName3 = "HDFS_CLIENT";
-      createServiceComponent(clusterName, serviceName, componentName1,
-              State.INIT);
-      createServiceComponent(clusterName, serviceName, componentName2,
-              State.INIT);
-      createServiceComponent(clusterName, serviceName, componentName3,
-              State.INIT);
-
-      String host1 = "h1";
-      clusters.addHost(host1);
-      clusters.getHost("h1").setOsType("centos5");
-      clusters.getHost("h1").persist();
-      String host2 = "h2";
-      clusters.addHost(host2);
-      clusters.getHost("h2").setOsType("centos6");
-      clusters.getHost("h2").persist();
-
-      clusters.mapHostToCluster(host1, clusterName);
-      clusters.mapHostToCluster(host2, clusterName);
-
-
-      // null service should work
-      createServiceComponentHost(clusterName, null, componentName1,
-              host1, null);
-      createServiceComponentHost(clusterName, serviceName, componentName2,
-              host1, null);
-      createServiceComponentHost(clusterName, serviceName, componentName2,
-              host2, null);
-      createServiceComponentHost(clusterName, serviceName, componentName3,
-              host1, null);
-      createServiceComponentHost(clusterName, serviceName, componentName3,
-              host2, null);
-
-      Assert.assertNotNull(clusters.getCluster(clusterName)
-              .getService(serviceName)
-              .getServiceComponent(componentName1)
-              .getServiceComponentHost(host1));
-      Assert.assertNotNull(clusters.getCluster(clusterName)
-              .getService(serviceName)
-              .getServiceComponent(componentName2)
-              .getServiceComponentHost(host1));
-      Assert.assertNotNull(clusters.getCluster(clusterName)
-              .getService(serviceName)
-              .getServiceComponent(componentName2)
-              .getServiceComponentHost(host2));
-      Assert.assertNotNull(clusters.getCluster(clusterName)
-              .getService(serviceName)
-              .getServiceComponent(componentName3)
-              .getServiceComponentHost(host1));
-      Assert.assertNotNull(clusters.getCluster(clusterName)
-              .getService(serviceName)
-              .getServiceComponent(componentName3)
-              .getServiceComponentHost(host2));
-
-      // Install
-      ServiceRequest r = new ServiceRequest(clusterName, serviceName, null,
-              State.INSTALLED.toString());
-      Set<ServiceRequest> requests = new HashSet<ServiceRequest>();
-      requests.add(r);
-
-      controller.updateServices(requests);
-      Assert.assertEquals(State.INSTALLED,
-              clusters.getCluster(clusterName).getService(serviceName)
-                      .getDesiredState());
-
-      // manually change live state to installed as no running action manager
-      for (ServiceComponent sc :
-              clusters.getCluster(clusterName).getService(serviceName)
-                      .getServiceComponents().values()) {
-          for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-              sch.setState(State.INSTALLED);
-          }
-      }
+    String clusterName = "foo1";
+    createCluster(clusterName);
+    clusters.getCluster(clusterName)
+            .setDesiredStackVersion(new StackId("HDP-0.1"));
+    String serviceName = "HDFS";
+    createService(clusterName, serviceName, null);
+    String componentName1 = "NAMENODE";
+    String componentName2 = "DATANODE";
+    String componentName3 = "HDFS_CLIENT";
 
-      // Start
-      r = new ServiceRequest(clusterName, serviceName, null,
-              State.STARTED.toString());
-      requests.clear();
-      requests.add(r);
-      controller.updateServices(requests);
-
-      // manually change live state to started as no running action manager
-      for (ServiceComponent sc :
-              clusters.getCluster(clusterName).getService(serviceName)
-                      .getServiceComponents().values()) {
-          for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-              sch.setState(State.STARTED);
-          }
-      }
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
 
-      Assert.assertEquals(State.STARTED,
-              clusters.getCluster(clusterName).getService(serviceName)
-                      .getDesiredState());
-      for (ServiceComponent sc :
-              clusters.getCluster(clusterName).getService(serviceName)
-                      .getServiceComponents().values()) {
-          if (sc.getName().equals("HDFS_CLIENT")) {
-              Assert.assertEquals(State.INSTALLED, sc.getDesiredState());
-          } else {
-              Assert.assertEquals(State.STARTED, sc.getDesiredState());
-          }
-          for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
-              if (sch.getServiceComponentName().equals("HDFS_CLIENT")) {
-                  Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
-              } else {
-                  Assert.assertEquals(State.STARTED, sch.getDesiredState());
-              }
-          }
-      }
+    createServiceComponent(clusterName, serviceName, componentName1,
+            State.INIT);
+    createServiceComponent(clusterName, serviceName, componentName2,
+            State.INIT);
+    createServiceComponent(clusterName, serviceName, componentName3,
+            State.INIT);
+
+    String host1 = "h1";
+    clusters.addHost(host1);
+    clusters.getHost("h1").setOsType("centos5");
+    clusters.getHost("h1").persist();
+    String host2 = "h2";
+    clusters.addHost(host2);
+    clusters.getHost("h2").setOsType("centos6");
+    clusters.getHost("h2").persist();
+
+    clusters.mapHostToCluster(host1, clusterName);
+    clusters.mapHostToCluster(host2, clusterName);
+
+
+    // null service should work
+    createServiceComponentHost(clusterName, null, componentName1,
+            host1, null);
+    createServiceComponentHost(clusterName, serviceName, componentName2,
+            host1, null);
+    createServiceComponentHost(clusterName, serviceName, componentName2,
+            host2, null);
+    createServiceComponentHost(clusterName, serviceName, componentName3,
+            host1, null);
+    createServiceComponentHost(clusterName, serviceName, componentName3,
+            host2, null);
+
+    Assert.assertNotNull(clusters.getCluster(clusterName)
+            .getService(serviceName)
+            .getServiceComponent(componentName1)
+            .getServiceComponentHost(host1));
+    Assert.assertNotNull(clusters.getCluster(clusterName)
+            .getService(serviceName)
+            .getServiceComponent(componentName2)
+            .getServiceComponentHost(host1));
+    Assert.assertNotNull(clusters.getCluster(clusterName)
+            .getService(serviceName)
+            .getServiceComponent(componentName2)
+            .getServiceComponentHost(host2));
+    Assert.assertNotNull(clusters.getCluster(clusterName)
+            .getService(serviceName)
+            .getServiceComponent(componentName3)
+            .getServiceComponentHost(host1));
+    Assert.assertNotNull(clusters.getCluster(clusterName)
+            .getService(serviceName)
+            .getServiceComponent(componentName3)
+            .getServiceComponentHost(host2));
+
+    // Install
+    ServiceRequest r = new ServiceRequest(clusterName, serviceName, null,
+            State.INSTALLED.toString());
+    Set<ServiceRequest> requests = new HashSet<ServiceRequest>();
+    requests.add(r);
+
+    controller.updateServices(requests, mapRequestProps);
+    Assert.assertEquals(State.INSTALLED,
+            clusters.getCluster(clusterName).getService(serviceName)
+                    .getDesiredState());
+
+    // manually change live state to installed as no running action manager
+    for (ServiceComponent sc :
+            clusters.getCluster(clusterName).getService(serviceName)
+                    .getServiceComponents().values()) {
+        for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
+            sch.setState(State.INSTALLED);
+        }
+    }
+
+    // Start
+    r = new ServiceRequest(clusterName, serviceName, null,
+            State.STARTED.toString());
+    requests.clear();
+    requests.add(r);
+    controller.updateServices(requests, mapRequestProps);
+
+    // manually change live state to started as no running action manager
+    for (ServiceComponent sc :
+            clusters.getCluster(clusterName).getService(serviceName)
+                    .getServiceComponents().values()) {
+        for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
+            sch.setState(State.STARTED);
+        }
+    }
+
+    Assert.assertEquals(State.STARTED,
+            clusters.getCluster(clusterName).getService(serviceName)
+                    .getDesiredState());
+    for (ServiceComponent sc :
+            clusters.getCluster(clusterName).getService(serviceName)
+                    .getServiceComponents().values()) {
+        if (sc.getName().equals("HDFS_CLIENT")) {
+            Assert.assertEquals(State.INSTALLED, sc.getDesiredState());
+        } else {
+            Assert.assertEquals(State.STARTED, sc.getDesiredState());
+        }
+        for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
+            if (sch.getServiceComponentName().equals("HDFS_CLIENT")) {
+                Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
+            } else {
+                Assert.assertEquals(State.STARTED, sch.getDesiredState());
+            }
+        }
+    }
+
+    Map<String, String> configs = new HashMap<String, String>();
+    configs.put("a", "b");
+
+    ConfigurationRequest cr1, cr2, cr3, cr4, cr5, cr6, cr7, cr8;
+    cr1 = new ConfigurationRequest(clusterName, "typeA","v1", configs);
+    cr2 = new ConfigurationRequest(clusterName, "typeB","v1", configs);
+    cr3 = new ConfigurationRequest(clusterName, "typeC","v1", configs);
+    cr4 = new ConfigurationRequest(clusterName, "typeD","v1", configs);
+    cr5 = new ConfigurationRequest(clusterName, "typeA","v2", configs);
+    cr6 = new ConfigurationRequest(clusterName, "typeB","v2", configs);
+    cr7 = new ConfigurationRequest(clusterName, "typeC","v2", configs);
+    cr8 = new ConfigurationRequest(clusterName, "typeE","v1", configs);
+    controller.createConfiguration(cr1);
+    controller.createConfiguration(cr2);
+    controller.createConfiguration(cr3);
+    controller.createConfiguration(cr4);
+    controller.createConfiguration(cr5);
+    controller.createConfiguration(cr6);
+    controller.createConfiguration(cr7);
+    controller.createConfiguration(cr8);
+
+    Cluster cluster = clusters.getCluster(clusterName);
+    Service s = cluster.getService(serviceName);
+    ServiceComponent sc1 = s.getServiceComponent(componentName1);
+    ServiceComponent sc2 = s.getServiceComponent(componentName2);
+    ServiceComponentHost sch1 = sc1.getServiceComponentHost(host1);
+
+    Set<ServiceComponentHostRequest> schReqs =
+            new HashSet<ServiceComponentHostRequest>();
+    Set<ServiceComponentRequest> scReqs =
+            new HashSet<ServiceComponentRequest>();
+    Set<ServiceRequest> sReqs = new HashSet<ServiceRequest>();
+    Map<String, String> configVersions = new HashMap<String, String>();
+
+    // update configs at SCH and SC level
+    configVersions.clear();
+    configVersions.put("typeA", "v1");
+    configVersions.put("typeB", "v1");
+    configVersions.put("typeC", "v1");
+    schReqs.clear();
+    schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
+            componentName1, host1, configVersions, null));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
+
+    Assert.assertEquals(0, s.getDesiredConfigs().size());
+    Assert.assertEquals(0, sc1.getDesiredConfigs().size());
+    Assert.assertEquals(3, sch1.getDesiredConfigs().size());
+
+    configVersions.clear();
+    configVersions.put("typeC", "v1");
+    configVersions.put("typeD", "v1");
+    scReqs.clear();
+    scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
+            componentName2, configVersions, null));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
+
+    Assert.assertEquals(0, s.getDesiredConfigs().size());
+    Assert.assertEquals(0, sc1.getDesiredConfigs().size());
+    Assert.assertEquals(2, sc2.getDesiredConfigs().size());
+    Assert.assertEquals(3, sch1.getDesiredConfigs().size());
+
+    // update configs at service level
+    configVersions.clear();
+    configVersions.put("typeA", "v2");
+    configVersions.put("typeC", "v2");
+    configVersions.put("typeE", "v1");
+    sReqs.clear();
+    sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
+            null));
+    Assert.assertNull(controller.updateServices(sReqs, mapRequestProps));
+
+    Assert.assertEquals(3, s.getDesiredConfigs().size());
+    Assert.assertEquals(3, sc1.getDesiredConfigs().size());
+    Assert.assertEquals(4, sc2.getDesiredConfigs().size());
+    Assert.assertEquals(4, sch1.getDesiredConfigs().size());
+
+    Assert.assertEquals("v2",
+            s.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            s.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            s.getDesiredConfigs().get("typeE").getVersionTag());
+
+    Assert.assertEquals("v2",
+            sc1.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            sc1.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sc1.getDesiredConfigs().get("typeE").getVersionTag());
+
+    Assert.assertEquals("v2",
+            sc2.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            sc2.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sc2.getDesiredConfigs().get("typeE").getVersionTag());
+    Assert.assertEquals("v1",
+            sc2.getDesiredConfigs().get("typeD").getVersionTag());
+
+    Assert.assertEquals("v2",
+            sch1.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            sch1.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeE").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeB").getVersionTag());
+
+    // update configs at SCH level
+    configVersions.clear();
+    configVersions.put("typeA", "v1");
+    configVersions.put("typeB", "v1");
+    configVersions.put("typeC", "v1");
+    schReqs.clear();
+    schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
+            componentName1, host1, configVersions, null));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
 
-      Map<String, String> configs = new HashMap<String, String>();
-      configs.put("a", "b");
+    Assert.assertEquals(3, s.getDesiredConfigs().size());
+    Assert.assertEquals(3, sc1.getDesiredConfigs().size());
+    Assert.assertEquals(4, sc2.getDesiredConfigs().size());
+    Assert.assertEquals(4, sch1.getDesiredConfigs().size());
+
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeE").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeB").getVersionTag());
 
-      ConfigurationRequest cr1, cr2, cr3, cr4, cr5, cr6, cr7, cr8;
-      cr1 = new ConfigurationRequest(clusterName, "typeA","v1", configs);
-      cr2 = new ConfigurationRequest(clusterName, "typeB","v1", configs);
-      cr3 = new ConfigurationRequest(clusterName, "typeC","v1", configs);
-      cr4 = new ConfigurationRequest(clusterName, "typeD","v1", configs);
-      cr5 = new ConfigurationRequest(clusterName, "typeA","v2", configs);
-      cr6 = new ConfigurationRequest(clusterName, "typeB","v2", configs);
-      cr7 = new ConfigurationRequest(clusterName, "typeC","v2", configs);
-      cr8 = new ConfigurationRequest(clusterName, "typeE","v1", configs);
-      controller.createConfiguration(cr1);
-      controller.createConfiguration(cr2);
-      controller.createConfiguration(cr3);
-      controller.createConfiguration(cr4);
-      controller.createConfiguration(cr5);
-      controller.createConfiguration(cr6);
-      controller.createConfiguration(cr7);
-      controller.createConfiguration(cr8);
-
-      Cluster cluster = clusters.getCluster(clusterName);
-      Service s = cluster.getService(serviceName);
-      ServiceComponent sc1 = s.getServiceComponent(componentName1);
-      ServiceComponent sc2 = s.getServiceComponent(componentName2);
-      ServiceComponentHost sch1 = sc1.getServiceComponentHost(host1);
-
-      Set<ServiceComponentHostRequest> schReqs =
-              new HashSet<ServiceComponentHostRequest>();
-      Set<ServiceComponentRequest> scReqs =
-              new HashSet<ServiceComponentRequest>();
-      Set<ServiceRequest> sReqs = new HashSet<ServiceRequest>();
-      Map<String, String> configVersions = new HashMap<String, String>();
-
-      // update configs at SCH and SC level
-      configVersions.clear();
-      configVersions.put("typeA", "v1");
-      configVersions.put("typeB", "v1");
-      configVersions.put("typeC", "v1");
-      schReqs.clear();
-      schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
-              componentName1, host1, configVersions, null));
-      Assert.assertNull(controller.updateHostComponents(schReqs));
-
-      Assert.assertEquals(0, s.getDesiredConfigs().size());
-      Assert.assertEquals(0, sc1.getDesiredConfigs().size());
-      Assert.assertEquals(3, sch1.getDesiredConfigs().size());
-
-      configVersions.clear();
-      configVersions.put("typeC", "v1");
-      configVersions.put("typeD", "v1");
-      scReqs.clear();
-      scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
-              componentName2, configVersions, null));
-      Assert.assertNull(controller.updateComponents(scReqs));
-
-      Assert.assertEquals(0, s.getDesiredConfigs().size());
-      Assert.assertEquals(0, sc1.getDesiredConfigs().size());
-      Assert.assertEquals(2, sc2.getDesiredConfigs().size());
-      Assert.assertEquals(3, sch1.getDesiredConfigs().size());
-
-      // update configs at service level
-      configVersions.clear();
-      configVersions.put("typeA", "v2");
-      configVersions.put("typeC", "v2");
-      configVersions.put("typeE", "v1");
-      sReqs.clear();
-      sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
-              null));
-      Assert.assertNull(controller.updateServices(sReqs));
-
-      Assert.assertEquals(3, s.getDesiredConfigs().size());
-      Assert.assertEquals(3, sc1.getDesiredConfigs().size());
-      Assert.assertEquals(4, sc2.getDesiredConfigs().size());
-      Assert.assertEquals(4, sch1.getDesiredConfigs().size());
-
-      Assert.assertEquals("v2",
-              s.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              s.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              s.getDesiredConfigs().get("typeE").getVersionTag());
-
-      Assert.assertEquals("v2",
-              sc1.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              sc1.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sc1.getDesiredConfigs().get("typeE").getVersionTag());
-
-      Assert.assertEquals("v2",
-              sc2.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              sc2.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sc2.getDesiredConfigs().get("typeE").getVersionTag());
-      Assert.assertEquals("v1",
-              sc2.getDesiredConfigs().get("typeD").getVersionTag());
-
-      Assert.assertEquals("v2",
-              sch1.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              sch1.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeE").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeB").getVersionTag());
-
-      // update configs at SCH level
-      configVersions.clear();
-      configVersions.put("typeA", "v1");
-      configVersions.put("typeB", "v1");
-      configVersions.put("typeC", "v1");
-      schReqs.clear();
-      schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
-              componentName1, host1, configVersions, null));
-      Assert.assertNull(controller.updateHostComponents(schReqs));
-
-      Assert.assertEquals(3, s.getDesiredConfigs().size());
-      Assert.assertEquals(3, sc1.getDesiredConfigs().size());
-      Assert.assertEquals(4, sc2.getDesiredConfigs().size());
-      Assert.assertEquals(4, sch1.getDesiredConfigs().size());
-
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeE").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeB").getVersionTag());
-
-      // update configs at SC level
-      configVersions.clear();
-      configVersions.put("typeC", "v2");
-      configVersions.put("typeD", "v1");
-      scReqs.clear();
-      scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
-              componentName1, configVersions, null));
-      Assert.assertNull(controller.updateComponents(scReqs));
-
-      Assert.assertEquals(3, s.getDesiredConfigs().size());
-      Assert.assertEquals(4, sc1.getDesiredConfigs().size());
-      Assert.assertEquals(4, sc2.getDesiredConfigs().size());
-      Assert.assertEquals(5, sch1.getDesiredConfigs().size());
-
-      Assert.assertEquals("v2",
-              sc1.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              sc1.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sc2.getDesiredConfigs().get("typeD").getVersionTag());
-      Assert.assertEquals("v1",
-              sc1.getDesiredConfigs().get("typeE").getVersionTag());
-
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeA").getVersionTag());
-      Assert.assertEquals("v2",
-              sch1.getDesiredConfigs().get("typeC").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeD").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeE").getVersionTag());
-      Assert.assertEquals("v1",
-              sch1.getDesiredConfigs().get("typeB").getVersionTag());
+    // update configs at SC level
+    configVersions.clear();
+    configVersions.put("typeC", "v2");
+    configVersions.put("typeD", "v1");
+    scReqs.clear();
+    scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
+            componentName1, configVersions, null));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
+
+    Assert.assertEquals(3, s.getDesiredConfigs().size());
+    Assert.assertEquals(4, sc1.getDesiredConfigs().size());
+    Assert.assertEquals(4, sc2.getDesiredConfigs().size());
+    Assert.assertEquals(5, sch1.getDesiredConfigs().size());
+
+    Assert.assertEquals("v2",
+            sc1.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            sc1.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sc2.getDesiredConfigs().get("typeD").getVersionTag());
+    Assert.assertEquals("v1",
+            sc1.getDesiredConfigs().get("typeE").getVersionTag());
+
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeA").getVersionTag());
+    Assert.assertEquals("v2",
+            sch1.getDesiredConfigs().get("typeC").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeD").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeE").getVersionTag());
+    Assert.assertEquals("v1",
+            sch1.getDesiredConfigs().get("typeB").getVersionTag());
   }
 
   @Test
@@ -3822,6 +3854,10 @@ public class AmbariManagementControllerT
     String componentName1 = "NAMENODE";
     String componentName2 = "DATANODE";
     String componentName3 = "HDFS_CLIENT";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createServiceComponent(clusterName, serviceName, componentName1,
         State.INIT);
     createServiceComponent(clusterName, serviceName, componentName2,
@@ -3917,7 +3953,7 @@ public class AmbariManagementControllerT
     schReqs.clear();
     schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
         componentName1, host1, configVersions, null));
-    Assert.assertNull(controller.updateHostComponents(schReqs));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
 
     Assert.assertEquals(0, s.getDesiredConfigs().size());
     Assert.assertEquals(0, sc1.getDesiredConfigs().size());
@@ -3929,7 +3965,7 @@ public class AmbariManagementControllerT
     scReqs.clear();
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
         componentName2, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
 
     Assert.assertEquals(0, s.getDesiredConfigs().size());
     Assert.assertEquals(0, sc1.getDesiredConfigs().size());
@@ -3944,7 +3980,7 @@ public class AmbariManagementControllerT
     sReqs.clear();
     sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
         null));
-    Assert.assertNull(controller.updateServices(sReqs));
+    Assert.assertNull(controller.updateServices(sReqs, mapRequestProps));
 
     Assert.assertEquals(3, s.getDesiredConfigs().size());
     Assert.assertEquals(3, sc1.getDesiredConfigs().size());
@@ -3991,7 +4027,7 @@ public class AmbariManagementControllerT
     schReqs.clear();
     schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
         componentName1, host1, configVersions, null));
-    Assert.assertNull(controller.updateHostComponents(schReqs));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
 
     Assert.assertEquals(3, s.getDesiredConfigs().size());
     Assert.assertEquals(3, sc1.getDesiredConfigs().size());
@@ -4014,7 +4050,7 @@ public class AmbariManagementControllerT
     scReqs.clear();
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
         componentName1, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
 
     Assert.assertEquals(3, s.getDesiredConfigs().size());
     Assert.assertEquals(4, sc1.getDesiredConfigs().size());
@@ -4054,6 +4090,10 @@ public class AmbariManagementControllerT
     String componentName1 = "NAMENODE";
     String componentName2 = "DATANODE";
     String componentName3 = "HDFS_CLIENT";
+
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createServiceComponent(clusterName, serviceName, componentName1,
       State.INIT);
     createServiceComponent(clusterName, serviceName, componentName2,
@@ -4092,7 +4132,7 @@ public class AmbariManagementControllerT
     Set<ServiceRequest> requests = new HashSet<ServiceRequest>();
     requests.add(r);
 
-    controller.updateServices(requests);
+    controller.updateServices(requests, mapRequestProps);
     Assert.assertEquals(State.INSTALLED,
       clusters.getCluster(clusterName).getService(serviceName)
         .getDesiredState());
@@ -4141,7 +4181,7 @@ public class AmbariManagementControllerT
     schReqs.clear();
     schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
       componentName1, host1, configVersions, null));
-    Assert.assertNull(controller.updateHostComponents(schReqs));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
     Assert.assertEquals(2, sch1.getDesiredConfigs().size());
 
     // Reconfigure SCH level
@@ -4150,7 +4190,7 @@ public class AmbariManagementControllerT
     schReqs.clear();
     schReqs.add(new ServiceComponentHostRequest(clusterName, serviceName,
       componentName1, host1, configVersions, null));
-    Assert.assertNull(controller.updateHostComponents(schReqs));
+    Assert.assertNull(controller.updateHostComponents(schReqs, Collections.<String, String>emptyMap()));
 
     // Clear Entity Manager
     entityManager.clear();
@@ -4165,11 +4205,11 @@ public class AmbariManagementControllerT
     configVersions.put("hdfs-site", "version1");
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
       componentName2, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
 
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
       componentName1, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
     Assert.assertEquals(2, sc1.getDesiredConfigs().size());
     Assert.assertEquals(2, sc2.getDesiredConfigs().size());
 
@@ -4180,7 +4220,7 @@ public class AmbariManagementControllerT
     scReqs.clear();
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
       componentName2, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
 
     Assert.assertEquals(2, sc2.getDesiredConfigs().size());
     Assert.assertEquals("version122", sc2.getDesiredConfigs().get
@@ -4188,7 +4228,7 @@ public class AmbariManagementControllerT
     scReqs.clear();
     scReqs.add(new ServiceComponentRequest(clusterName, serviceName,
       componentName1, configVersions, null));
-    Assert.assertNull(controller.updateComponents(scReqs));
+    Assert.assertNull(controller.updateComponents(scReqs, Collections.<String, String>emptyMap()));
 
     entityManager.clear();
 
@@ -4203,7 +4243,7 @@ public class AmbariManagementControllerT
     sReqs.clear();
     sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
       null));
-    Assert.assertNull(controller.updateServices(sReqs));
+    Assert.assertNull(controller.updateServices(sReqs, mapRequestProps));
     Assert.assertEquals(2, s.getDesiredConfigs().size());
 
     // Reconfigure S Level
@@ -4213,7 +4253,7 @@ public class AmbariManagementControllerT
     sReqs.clear();
     sReqs.add(new ServiceRequest(clusterName, serviceName, configVersions,
       null));
-    Assert.assertNull(controller.updateServices(sReqs));
+    Assert.assertNull(controller.updateServices(sReqs, mapRequestProps));
 
     entityManager.clear();
 
@@ -4246,6 +4286,9 @@ public class AmbariManagementControllerT
     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);
@@ -4258,7 +4301,7 @@ public class AmbariManagementControllerT
     requests.add(r);
 
     RequestStatusResponse trackAction =
-        controller.updateServices(requests);
+        controller.updateServices(requests, mapRequestProps);
     Assert.assertEquals(State.INSTALLED,
         clusters.getCluster(clusterName).getService(serviceName)
         .getDesiredState());
@@ -4277,6 +4320,7 @@ public class AmbariManagementControllerT
 
     List<Stage> stages = actionDB.getAllStages(trackAction.getRequestId());
     Assert.assertEquals(1, stages.size());
+    Assert.assertEquals("Called from a test", stages.get(0).getRequestContext());
 
     for (ServiceComponent sc :
       clusters.getCluster(clusterName).getService(serviceName)
@@ -4291,7 +4335,7 @@ public class AmbariManagementControllerT
     requests.clear();
     requests.add(r);
 
-    trackAction = controller.updateServices(requests);
+    trackAction = controller.updateServices(requests, mapRequestProps);
     Assert.assertNotNull(trackAction);
     Assert.assertEquals(State.INSTALLED,
         clusters.getCluster(clusterName).getService(serviceName)
@@ -4525,6 +4569,9 @@ public class AmbariManagementControllerT
     String componentName = "PIG";
     StackId currentStackId = new StackId("HDP-0.1");
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createCluster(clusterName);
     Cluster c = clusters.getCluster(clusterName);
     c.setDesiredStackVersion(currentStackId);
@@ -4559,7 +4606,7 @@ public class AmbariManagementControllerT
 
     ClusterRequest r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.0.1", null);
     try {
-      controller.updateCluster(r);
+      controller.updateCluster(r, mapRequestProps);
       fail("Update cluster creation should fail");
     } catch (AmbariException e) {
       Assert.assertTrue(e.getMessage().contains("must be greater than current version"));
@@ -4567,7 +4614,7 @@ public class AmbariManagementControllerT
 
     r = new ClusterRequest(c.getClusterId(), clusterName, "HDPLocal-1.2.2", null);
     try {
-      controller.updateCluster(r);
+      controller.updateCluster(r, mapRequestProps);
       fail("Update cluster creation should fail");
     } catch (AmbariException e) {
       Assert.assertTrue(e.getMessage().contains("Upgrade not possible between different stacks"));
@@ -4575,7 +4622,7 @@ public class AmbariManagementControllerT
 
     r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.2", null);
     try {
-      controller.updateCluster(r);
+      controller.updateCluster(r, mapRequestProps);
       fail("Update cluster creation should fail");
     } catch (AmbariException e) {
       Assert.assertTrue(e.getMessage().contains("Upgrade needs all services to be stopped"));
@@ -4583,7 +4630,7 @@ public class AmbariManagementControllerT
 
     c.getService(serviceName).getServiceComponent(componentName).getServiceComponentHost(host2)
         .setDesiredState(State.INSTALLED);
-    controller.updateCluster(r);
+    controller.updateCluster(r, mapRequestProps);
     StackId expectedStackId = new StackId("HDP-0.2");
     Assert.assertTrue(expectedStackId.equals(c.getDesiredStackVersion()));
     Assert.assertTrue(expectedStackId.equals(c.getService(serviceName).getDesiredStackVersion()));
@@ -4612,17 +4659,17 @@ public class AmbariManagementControllerT
         .setState(State.INSTALLED);
     c.setCurrentStackVersion(expectedStackId);
     r = new ClusterRequest(c.getClusterId(), clusterName, "", null);
-    controller.updateCluster(r);
+    controller.updateCluster(r, mapRequestProps);
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host1).getState());
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host2).getState());
 
     r = new ClusterRequest(c.getClusterId(), clusterName, null, null);
-    controller.updateCluster(r);
+    controller.updateCluster(r, mapRequestProps);
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host1).getState());
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host2).getState());
 
     r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.2", null);
-    controller.updateCluster(r);
+    controller.updateCluster(r, mapRequestProps);
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host1).getState());
     Assert.assertEquals(State.INSTALLED, sc.getServiceComponentHost(host2).getState());
   }
@@ -4632,12 +4679,15 @@ public class AmbariManagementControllerT
     String clusterName = "foo1";
     StackId currentStackId = new StackId("HDP-0.2");
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createCluster(clusterName);
     Cluster c = clusters.getCluster(clusterName);
     c.setDesiredStackVersion(currentStackId);
     ClusterRequest r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.3", null);
     try {
-      controller.updateCluster(r);
+      controller.updateCluster(r, mapRequestProps);
     } catch (AmbariException e) {
       Assert.assertTrue(e.getMessage().contains("Illegal request to upgrade to"));
     }
@@ -4648,7 +4698,7 @@ public class AmbariManagementControllerT
     c.refresh();
     r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.2", null);
     try {
-      controller.updateCluster(r);
+      controller.updateCluster(r, mapRequestProps);
     } catch (AmbariException e) {
       Assert.assertTrue(e.getMessage().contains("Upgrade is not allowed from"));
     }
@@ -4671,10 +4721,14 @@ public class AmbariManagementControllerT
     String hdfsClient = "HDFS_CLIENT";
     StackId currentStackId = new StackId("HDP-0.1");
     StackId desiredStackId = new StackId("HDP-0.2");
+
     List<String> hosts = new ArrayList<String>();
     hosts.add(host1);
     hosts.add(host2);
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     createCluster(clusterName);
     Cluster c = clusters.getCluster(clusterName);
     c.setDesiredStackVersion(currentStackId);
@@ -4699,7 +4753,7 @@ public class AmbariManagementControllerT
     resetServiceState(pigServiceName, currentStackId, c);
 
     ClusterRequest r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.2", null);
-    RequestStatusResponse trackAction = controller.updateCluster(r);
+    RequestStatusResponse trackAction = controller.updateCluster(r, mapRequestProps);
     List<Stage> stages = actionDB.getAllStages(trackAction.getRequestId());
 
     // Upgrade a cluster with one service
@@ -4724,7 +4778,7 @@ public class AmbariManagementControllerT
 
     // Upgrade a cluster with two service
     r = new ClusterRequest(c.getClusterId(), clusterName, "HDP-0.2", null);
-    trackAction = controller.updateCluster(r);
+    trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());
 
     expectedTasks.expectTask(Role.JOBTRACKER, host1);
@@ -4733,7 +4787,7 @@ public class AmbariManagementControllerT
     validateGeneratedStages(stages, 5, expectedTasks);
 
     // Upgrade again
-    trackAction = controller.updateCluster(r);
+    trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());
     validateGeneratedStages(stages, 5, expectedTasks);
 
@@ -4747,7 +4801,7 @@ public class AmbariManagementControllerT
     c.getService(pigServiceName).getServiceComponent(pigComponentName).getServiceComponentHost(host2)
         .setStackVersion(desiredStackId);
 
-    trackAction = controller.updateCluster(r);
+    trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());
     validateGeneratedStages(stages, 5, expectedTasks);
 
@@ -4755,7 +4809,7 @@ public class AmbariManagementControllerT
         .setState(State.UPGRADE_FAILED);
     c.getService(mrServiceName).getServiceComponent(mrTaskTrackerComp).getServiceComponentHost(host2)
         .setState(State.UPGRADE_FAILED);
-    trackAction = controller.updateCluster(r);
+    trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());
     validateGeneratedStages(stages, 5, expectedTasks);
 
@@ -4774,7 +4828,7 @@ public class AmbariManagementControllerT
     resetServiceState(mrServiceName, currentStackId, c);
     resetServiceState(pigServiceName, currentStackId, c);
 
-    trackAction = controller.updateCluster(r);
+    trackAction = controller.updateCluster(r, mapRequestProps);
     stages = actionDB.getAllStages(trackAction.getRequestId());
 
     expectedTasks.resetAll();
@@ -4970,6 +5024,8 @@ public class AmbariManagementControllerT
     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,
@@ -5011,7 +5067,7 @@ public class AmbariManagementControllerT
     requests.add(r);
 
     RequestStatusResponse trackAction =
-      controller.updateServices(requests);
+      controller.updateServices(requests, mapRequestProps);
     Assert.assertEquals(State.INSTALLED,
       clusters.getCluster(clusterName).getService(serviceName)
         .getDesiredState());
@@ -5030,7 +5086,7 @@ public class AmbariManagementControllerT
       State.STARTED.toString());
     requests.clear();
     requests.add(r);
-    trackAction = controller.updateServices(requests);
+    trackAction = controller.updateServices(requests, mapRequestProps);
 
     // manually change live state to started as no running action manager
     for (ServiceComponent sc :
@@ -5064,7 +5120,7 @@ public class AmbariManagementControllerT
           Set<ServiceComponentHostRequest> reqs1 = new
             HashSet<ServiceComponentHostRequest>();
           reqs1.add(r1);
-          controller.updateHostComponents(reqs1);
+          controller.updateHostComponents(reqs1, Collections.<String, String>emptyMap());
           Assert.assertEquals(State.INSTALLED, sch.getDesiredState());
         }
       }
@@ -5075,7 +5131,7 @@ public class AmbariManagementControllerT
       State.INSTALLED.toString());
     requests.clear();
     requests.add(r);
-    controller.updateServices(requests);
+    controller.updateServices(requests, mapRequestProps);
 
     for (ServiceComponent sc :
       clusters.getCluster(clusterName).getService(serviceName)

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerClusterProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerClusterProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerClusterProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerClusterProviderTest.java Tue Mar 19 20:20:27 2013
@@ -80,7 +80,7 @@ public class GSInstallerClusterProviderT
     GSInstallerResourceProvider provider = new GSInstallerClusterProvider(clusterDefinition);
 
     try {
-      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>()), null);
+      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
       Assert.fail("Expected UnsupportedOperationException.");
     } catch (UnsupportedOperationException e) {
       //expected

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerComponentProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerComponentProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerComponentProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerComponentProviderTest.java Tue Mar 19 20:20:27 2013
@@ -78,7 +78,7 @@ public class GSInstallerComponentProvide
     GSInstallerResourceProvider provider = new GSInstallerComponentProvider(clusterDefinition);
 
     try {
-      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>()), null);
+      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
       Assert.fail("Expected UnsupportedOperationException.");
     } catch (UnsupportedOperationException e) {
       //expected

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostComponentProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostComponentProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostComponentProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostComponentProviderTest.java Tue Mar 19 20:20:27 2013
@@ -125,7 +125,7 @@ public class GSInstallerHostComponentPro
     GSInstallerResourceProvider provider = new GSInstallerHostComponentProvider(clusterDefinition);
 
     try {
-      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>()), null);
+      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
       Assert.fail("Expected UnsupportedOperationException.");
     } catch (UnsupportedOperationException e) {
       //expected

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerHostProviderTest.java Tue Mar 19 20:20:27 2013
@@ -128,7 +128,7 @@ public class GSInstallerHostProviderTest
     GSInstallerResourceProvider provider = new GSInstallerHostProvider(clusterDefinition);
 
     try {
-      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>()), null);
+      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
       Assert.fail("Expected UnsupportedOperationException.");
     } catch (UnsupportedOperationException e) {
       //expected

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerServiceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerServiceProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerServiceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerServiceProviderTest.java Tue Mar 19 20:20:27 2013
@@ -128,7 +128,7 @@ public class GSInstallerServiceProviderT
     GSInstallerResourceProvider provider = new GSInstallerServiceProvider(clusterDefinition);
 
     try {
-      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>()), null);
+      provider.updateResources(PropertyHelper.getUpdateRequest(new HashMap<String, Object>(), null), null);
       Assert.fail("Expected UnsupportedOperationException.");
     } catch (UnsupportedOperationException e) {
       //expected

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java Tue Mar 19 20:20:27 2013
@@ -80,7 +80,7 @@ public class ActionResourceProviderTest 
     propertySet.add(properties);
 
     // create the request
-    Request request = PropertyHelper.getCreateRequest(propertySet);
+    Request request = PropertyHelper.getCreateRequest(propertySet, null);
 
     provider.createResources(request);
 
@@ -145,7 +145,7 @@ public class ActionResourceProviderTest 
     Map<String, Object> properties = new LinkedHashMap<String, Object>();
 
     // create the request
-    Request request = PropertyHelper.getUpdateRequest(properties);
+    Request request = PropertyHelper.getUpdateRequest(properties, null);
 
     Predicate predicate =
         new PredicateBuilder().property(ActionResourceProvider.ACTION_CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterControllerImplTest.java Tue Mar 19 20:20:27 2013
@@ -222,7 +222,7 @@ public class ClusterControllerImplTest {
 
     properties.add(propertyMap);
 
-    Request request = PropertyHelper.getCreateRequest(properties);
+    Request request = PropertyHelper.getCreateRequest(properties, null);
 
     controller.createResources(Resource.Type.Host, request);
 
@@ -244,7 +244,7 @@ public class ClusterControllerImplTest {
 
     properties.add(propertyMap);
 
-    Request request = PropertyHelper.getCreateRequest(properties);
+    Request request = PropertyHelper.getCreateRequest(properties, null);
 
     try {
       controller.createResources(Resource.Type.Host, request);
@@ -265,7 +265,7 @@ public class ClusterControllerImplTest {
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);
 
-    Request request = PropertyHelper.getUpdateRequest(propertyMap);
+    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);
 
     Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();
 
@@ -286,7 +286,7 @@ public class ClusterControllerImplTest {
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
     propertyMap.put(UNSUPPORTED_PROPERTY, 2);
 
-    Request request = PropertyHelper.getUpdateRequest(propertyMap);
+    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);
 
     Predicate predicate = new PredicateBuilder().property("c1/p2").equals(1).toPredicate();
 
@@ -308,7 +308,7 @@ public class ClusterControllerImplTest {
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);
 
-    Request request = PropertyHelper.getUpdateRequest(propertyMap);
+    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);
 
     Predicate predicate = new PredicateBuilder().property(UNSUPPORTED_PROPERTY).equals(1).toPredicate();
 
@@ -331,7 +331,7 @@ public class ClusterControllerImplTest {
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p1"), 99);
     propertyMap.put(PropertyHelper.getPropertyId("c1", "p2"), 2);
 
-    Request request = PropertyHelper.getUpdateRequest(propertyMap);
+    Request request = PropertyHelper.getUpdateRequest(propertyMap, null);
 
     Predicate predicate = new PredicateBuilder().property("c3/p6").equals(1).toPredicate();
 

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java?rev=1458497&r1=1458496&r2=1458497&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java (original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java Tue Mar 19 20:20:27 2013
@@ -20,15 +20,12 @@ package org.apache.ambari.server.control
 
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.ClusterRequest;
@@ -99,7 +96,7 @@ public class ClusterResourceProviderTest
     propertySet.add(properties);
 
     // create the request
-    Request request = PropertyHelper.getCreateRequest(propertySet);
+    Request request = PropertyHelper.getCreateRequest(propertySet, null);
 
     provider.createResources(request);
 
@@ -202,13 +199,16 @@ public class ClusterResourceProviderTest
     Set<ClusterResponse> nameResponse = new HashSet<ClusterResponse>();
     nameResponse.add(new ClusterResponse(102L, "Cluster102", null, null));
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     // set expectations
     expect(managementController.getClusters(EasyMock.<Set<ClusterRequest>>anyObject())).andReturn(nameResponse).once();
     expect(managementController.updateCluster(
-        AbstractResourceProviderTest.Matcher.getClusterRequest(102L, "Cluster102", "HDP-0.1", null))).
+        AbstractResourceProviderTest.Matcher.getClusterRequest(102L, "Cluster102", "HDP-0.1", null), eq(mapRequestProps))).
         andReturn(response).once();
     expect(managementController.updateCluster(
-        AbstractResourceProviderTest.Matcher.getClusterRequest(103L, null, "HDP-0.1", null))).
+        AbstractResourceProviderTest.Matcher.getClusterRequest(103L, null, "HDP-0.1", null), eq(mapRequestProps))).
         andReturn(response).once();
 
     // replay
@@ -229,7 +229,7 @@ public class ClusterResourceProviderTest
     properties.put(ClusterResourceProvider.CLUSTER_VERSION_PROPERTY_ID, "HDP-0.1");
 
     // create the request
-    Request request = PropertyHelper.getUpdateRequest(properties);
+    Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);
 
     // update the cluster named Cluster102
     Predicate  predicate = new PredicateBuilder().property(
@@ -254,16 +254,19 @@ public class ClusterResourceProviderTest
   
   @Test
   public void testUpdateWithConfiguration() throws Exception {
-
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
     RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
 
     Set<ClusterResponse> nameResponse = new HashSet<ClusterResponse>();
     nameResponse.add(new ClusterResponse(100L, "Cluster100", null, null));
 
+    Map<String, String> mapRequestProps = new HashMap<String, String>();
+    mapRequestProps.put("context", "Called from a test");
+
     // set expectations
     expect(managementController.getClusters(EasyMock.<Set<ClusterRequest>>anyObject())).andReturn(nameResponse).once();
-    expect(managementController.updateCluster(EasyMock.anyObject(ClusterRequest.class))).andReturn(response).once();
+    expect(managementController.updateCluster(EasyMock.anyObject(ClusterRequest.class),
+        eq(mapRequestProps))).andReturn(response).once();
 
     // replay
     replay(managementController, response);
@@ -277,7 +280,7 @@ public class ClusterResourceProviderTest
     properties.put(PropertyHelper.getPropertyId("Clusters.desired_config.properties", "x"), "y");
 
     // create the request
-    Request request = PropertyHelper.getUpdateRequest(properties);
+    Request request = PropertyHelper.getUpdateRequest(properties, mapRequestProps);
     
     Predicate  predicate = new PredicateBuilder().property(
         ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID).equals("Cluster100").toPredicate();