ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [1/2] ambari git commit: AMBARI-12506. Server Side stages and tasks should not need server name (ncole)
Date Thu, 23 Jul 2015 13:01:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b8d2b2b64 -> 8e9f5e8da


http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9f5e8d/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index b0edc3e..cfbc38e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -46,10 +46,6 @@ import java.util.TreeMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import com.google.inject.Inject;
-import com.google.inject.persist.PersistService;
-import junit.framework.Assert;
-
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
 import org.apache.ambari.server.RoleCommand;
@@ -98,9 +94,13 @@ import org.slf4j.LoggerFactory;
 import com.google.common.reflect.TypeToken;
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
+import com.google.inject.Inject;
 import com.google.inject.Injector;
+import com.google.inject.persist.PersistService;
 import com.google.inject.persist.UnitOfWork;
 
+import junit.framework.Assert;
+
 public class TestActionScheduler {
 
   private static final Logger log = LoggerFactory.getLogger(TestActionScheduler.class);
@@ -113,7 +113,6 @@ public class TestActionScheduler {
 
   private static Injector injector;
 
-  private final String serverHostname = StageUtils.getHostName();
   private final String hostname = "ahost.ambari.apache.org";
   private final int MAX_CYCLE_ITERATIONS = 100;
 
@@ -291,9 +290,9 @@ public class TestActionScheduler {
     when(request.isExclusive()).thenReturn(false);
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         HostRoleCommand command = s.getHostRoleCommand(host, role);
@@ -371,9 +370,9 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         HostRoleCommand command = s.getHostRoleCommand(host, role);
@@ -466,9 +465,9 @@ public class TestActionScheduler {
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         //HostRoleCommand command = stages.get(0).getHostRoleCommand(host, role);
@@ -482,9 +481,9 @@ public class TestActionScheduler {
       }
     }).when(db).timeoutHostRole(anyString(), anyLong(), anyLong(), anyString());
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         Long requestId = (Long) invocation.getArguments()[0];
         for (Stage stage : stages) {
           if (requestId.equals(stage.getRequestId())) {
@@ -564,27 +563,7 @@ public class TestActionScheduler {
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
     Clusters fsm = mock(Clusters.class);
-    Cluster oneClusterMock = mock(Cluster.class);
-    Service serviceObj = mock(Service.class);
-    ServiceComponent scomp = mock(ServiceComponent.class);
-    ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    Host host = mock(Host.class);
-
-    when(host.getHostName()).thenReturn(serverHostname);
-    when(host.getState()).thenReturn(HostState.HEALTHY);
-
-    when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
-    when(fsm.getHost(anyString())).thenReturn(host);
-    when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
-    when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
-    when(scomp.getServiceComponentHost(anyString())).thenReturn(sch);
-    when(serviceObj.getCluster()).thenReturn(oneClusterMock);
-
-    HashMap<String, ServiceComponentHost> hosts =
-            new HashMap<String, ServiceComponentHost>();
-    hosts.put(serverHostname, sch);
-    when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
     List<Stage> stages = new ArrayList<Stage>();
     Map<String, String> payload = new HashMap<String, String>();
@@ -599,37 +578,44 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         CommandReport commandReport = (CommandReport) invocation.getArguments()[4];
-        HostRoleCommand command = s.getHostRoleCommand(host, role);
+
+        HostRoleCommand command = null;
+        if (null == host) {
+          command = s.getHostRoleCommand(null, role);
+        } else {
+          command = s.getHostRoleCommand(host, role);
+        }
+
         command.setStatus(HostRoleStatus.valueOf(commandReport.getStatus()));
         return null;
       }
     }).when(db).updateHostRoleState(anyString(), anyLong(), anyLong(), anyString(), any(CommandReport.class));
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<HostRoleCommand>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        return s.getHostRoleCommand(serverHostname, "AMBARI_SERVER_ACTION");
+      public HostRoleCommand answer(InvocationOnMock invocation) throws Throwable {
+        return s.getHostRoleCommand(null, "AMBARI_SERVER_ACTION");
       }
     }).when(db).getTask(anyLong());
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<List<HostRoleCommand>>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        String host = (String) invocation.getArguments()[0];
+      public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable
{
         String role = (String) invocation.getArguments()[1];
         HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
 
-        HostRoleCommand task = s.getHostRoleCommand(host, role);
+        HostRoleCommand task = s.getHostRoleCommand(null, role);
 
         if (task.getStatus() == status) {
           return Arrays.asList(task);
         } else {
-          return null;
+          return Collections.emptyList();
         }
       }
     }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
@@ -639,13 +625,13 @@ public class TestActionScheduler {
         new HostsMap((String) null), unitOfWork, null, conf);
 
     int cycleCount = 0;
-    while (!stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION")
+    while (!stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION")
         .equals(HostRoleStatus.COMPLETED) && cycleCount++ <= MAX_CYCLE_ITERATIONS)
{
       scheduler.doWork();
       scheduler.getServerActionExecutor().doWork();
     }
 
-    assertEquals(stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION"),
+    assertEquals(stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION"),
         HostRoleStatus.COMPLETED);
   }
 
@@ -658,26 +644,7 @@ public class TestActionScheduler {
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
     Clusters fsm = mock(Clusters.class);
-    Cluster oneClusterMock = mock(Cluster.class);
-    Service serviceObj = mock(Service.class);
-    ServiceComponent scomp = mock(ServiceComponent.class);
-    ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
-    when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
-    when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
-    when(scomp.getServiceComponentHost(anyString())).thenReturn(sch);
-    when(serviceObj.getCluster()).thenReturn(oneClusterMock);
-
-    Host host = mock(Host.class);
-    HashMap<String, ServiceComponentHost> hosts =
-            new HashMap<String, ServiceComponentHost>();
-    hosts.put(serverHostname, sch);
-    when(scomp.getServiceComponentHosts()).thenReturn(hosts);
-
-    when(fsm.getHost(anyString())).thenReturn(host);
-    when(host.getState()).thenReturn(HostState.HEALTHY);
-    when(host.getHostName()).thenReturn(serverHostname);
 
     List<Stage> stages = new ArrayList<Stage>();
     Map<String, String> payload = new HashMap<String, String>();
@@ -693,38 +660,46 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         CommandReport commandReport = (CommandReport) invocation.getArguments()[4];
-        HostRoleCommand command = s.getHostRoleCommand(host, role);
+
+        HostRoleCommand command = null;
+        if (null == host) {
+          command = s.getHostRoleCommand(null, role);
+        } else {
+          command = s.getHostRoleCommand(host, role);
+        }
+
         command.setStatus(HostRoleStatus.valueOf(commandReport.getStatus()));
         return null;
       }
     }).when(db).updateHostRoleState(anyString(), anyLong(), anyLong(), anyString(), any(CommandReport.class));
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<HostRoleCommand>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        return s.getHostRoleCommand(serverHostname, "AMBARI_SERVER_ACTION");
+      public HostRoleCommand answer(InvocationOnMock invocation) throws Throwable {
+        return s.getHostRoleCommand(null, "AMBARI_SERVER_ACTION");
       }
     }).when(db).getTask(anyLong());
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<List<HostRoleCommand>>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        String host = (String) invocation.getArguments()[0];
+      public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable
{
         String role = (String) invocation.getArguments()[1];
         HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
 
-        HostRoleCommand task = s.getHostRoleCommand(host, role);
+        HostRoleCommand task = s.getHostRoleCommand(null, role);
 
         if (task.getStatus() == status) {
           return Arrays.asList(task);
         } else {
-          return null;
+          return Collections.emptyList();
         }
+
       }
     }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
 
@@ -733,14 +708,14 @@ public class TestActionScheduler {
         new HostsMap((String) null), unitOfWork, null, conf);
 
     int cycleCount = 0;
-    while (!stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION").isCompletedState()
+    while (!stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION").isCompletedState()
         && cycleCount++ <= MAX_CYCLE_ITERATIONS) {
       scheduler.doWork();
       scheduler.getServerActionExecutor().doWork();
     }
 
     assertEquals(HostRoleStatus.TIMEDOUT,
-        stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION"));
+        stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION"));
   }
 
   @Test
@@ -749,21 +724,7 @@ public class TestActionScheduler {
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
     Clusters fsm = mock(Clusters.class);
-    Cluster oneClusterMock = mock(Cluster.class);
-    Service serviceObj = mock(Service.class);
-    ServiceComponent scomp = mock(ServiceComponent.class);
-    ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
-    when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
-    when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
-    when(scomp.getServiceComponentHost(anyString())).thenReturn(sch);
-    when(serviceObj.getCluster()).thenReturn(oneClusterMock);
-
-    HashMap<String, ServiceComponentHost> hosts =
-            new HashMap<String, ServiceComponentHost>();
-    hosts.put(serverHostname, sch);
-    when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
     List<Stage> stages = new ArrayList<Stage>();
     Map<String, String> payload = new HashMap<String, String>();
@@ -779,37 +740,45 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         CommandReport commandReport = (CommandReport) invocation.getArguments()[4];
-        HostRoleCommand command = s.getHostRoleCommand(host, role);
+
+        HostRoleCommand command = null;
+        if (null == host) {
+          command = s.getHostRoleCommand(null, role);
+        } else {
+          command = s.getHostRoleCommand(host, role);
+        }
+
         command.setStatus(HostRoleStatus.valueOf(commandReport.getStatus()));
         return null;
       }
     }).when(db).updateHostRoleState(anyString(), anyLong(), anyLong(), anyString(), any(CommandReport.class));
 
-    doAnswer(new Answer() {
+    doAnswer(new Answer<HostRoleCommand>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        return s.getHostRoleCommand(serverHostname, "AMBARI_SERVER_ACTION");
+      public HostRoleCommand answer(InvocationOnMock invocation) throws Throwable {
+        return s.getHostRoleCommand(null, "AMBARI_SERVER_ACTION");
       }
     }).when(db).getTask(anyLong());
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<List<HostRoleCommand>>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        String host = (String) invocation.getArguments()[0];
+      public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable
{
         String role = (String) invocation.getArguments()[1];
         HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
 
-        HostRoleCommand task = s.getHostRoleCommand(host, role);
+        HostRoleCommand task = s.getHostRoleCommand(null, role);
 
         if (task.getStatus() == status) {
           return Arrays.asList(task);
         } else {
-          return null;
+          return Collections.emptyList();
         }
       }
     }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
@@ -818,12 +787,12 @@ public class TestActionScheduler {
         new HostsMap((String) null), unitOfWork, null, conf);
 
     int cycleCount = 0;
-    while (!stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION")
+    while (!stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION")
         .equals(HostRoleStatus.FAILED) && cycleCount++ <= MAX_CYCLE_ITERATIONS)
{
       scheduler.doWork();
       scheduler.getServerActionExecutor().doWork();
     }
-    assertEquals(stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION"),
+    assertEquals(stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION"),
         HostRoleStatus.FAILED);
     assertEquals("test", stages.get(0).getRequestContext());
   }
@@ -831,14 +800,15 @@ public class TestActionScheduler {
   private Stage getStageWithServerAction(long requestId, long stageId,
                                                 Map<String, String> payload, String
requestContext,
                                                 int timeout) {
-    String serverHostname = StageUtils.getHostName();
+
     Stage stage = stageFactory.createNew(requestId, "/tmp", "cluster1", 1L, requestContext,
CLUSTER_HOST_INFO,
       "{}", "{}");
     stage.setStageId(stageId);
 
-    stage.addServerActionCommand(MockServerAction.class.getName(), Role.AMBARI_SERVER_ACTION,
+    stage.addServerActionCommand(MockServerAction.class.getName(), null,
+        Role.AMBARI_SERVER_ACTION,
         RoleCommand.EXECUTE, "cluster1",
-        new ServiceComponentHostServerActionEvent(serverHostname, System.currentTimeMillis()),
+        new ServiceComponentHostServerActionEvent(null, System.currentTimeMillis()),
         payload,
         null, null, timeout, false);
 
@@ -859,7 +829,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -917,10 +886,6 @@ public class TestActionScheduler {
     ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
             new HostsMap((String) null), unitOfWork, null, conf);
 
-    ActionManager am = new ActionManager(
-        2, 2, aq, fsm, db, new HostsMap((String) null),
-        unitOfWork, requestFactory, conf, null);
-
     scheduler.doWork();
 
     Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1,
"DATANODE"));
@@ -943,7 +908,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -1011,11 +975,6 @@ public class TestActionScheduler {
             new HostsMap((String) null),
             unitOfWork, null, conf);
 
-    ActionManager am = new ActionManager(
-        2, 2, aq, fsm, db, new HostsMap((String) null),
-        unitOfWork,
-        requestFactory, conf, null);
-
     scheduler.doWork();
 
     Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1,
"HIVE_CLIENT"));
@@ -1038,7 +997,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -1088,11 +1046,6 @@ public class TestActionScheduler {
         new HostsMap((String) null),
         unitOfWork, null, conf);
 
-    ActionManager am = new ActionManager(
-        2, 2, aq, fsm, db, new HostsMap((String) null),
-        unitOfWork,
-        requestFactory, conf, null);
-
     scheduler.doWork();
 
     Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1,
"NAMENODE"));
@@ -1143,16 +1096,15 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         List<CommandReport> reports = (List<CommandReport>) invocation.getArguments()[0];
         for (CommandReport report : reports) {
           String actionId = report.getActionId();
           long[] requestStageIds = StageUtils.getRequestStage(actionId);
           Long requestId = requestStageIds[0];
           Long stageId = requestStageIds[1];
-          String role = report.getRole();
           Long id = report.getTaskId();
           for (Stage stage : stages) {
             if (requestId.equals(stage.getRequestId()) && stageId.equals(stage.getStageId()))
{
@@ -1184,9 +1136,9 @@ public class TestActionScheduler {
         return null;
       }
     });
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         Long requestId = (Long) invocation.getArguments()[0];
         for (Stage stage : stages) {
           if (requestId.equals(stage.getRequestId())) {
@@ -1251,7 +1203,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -1332,9 +1283,9 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         Long requestId = (Long) invocation.getArguments()[1];
         Long stageId = (Long) invocation.getArguments()[2];
@@ -1365,9 +1316,9 @@ public class TestActionScheduler {
         return null;
       }
     });
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         Long requestId = (Long) invocation.getArguments()[0];
         for (Stage stage : stages) {
           if (requestId.equals(stage.getRequestId())) {
@@ -1390,8 +1341,6 @@ public class TestActionScheduler {
     ActionScheduler scheduler = new ActionScheduler(100, 10000, db, aq, fsm, 3,
         new HostsMap((String) null),
         unitOfWork, null, conf);
-    ActionManager am = new ActionManager(
-        2, 10000, aq, fsm, db, new HostsMap((String) null), unitOfWork, requestFactory, conf,
null);
 
     scheduler.doWork();
 
@@ -1511,16 +1460,15 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         List<CommandReport> reports = (List<CommandReport>) invocation.getArguments()[0];
         for (CommandReport report : reports) {
           String actionId = report.getActionId();
           long[] requestStageIds = StageUtils.getRequestStage(actionId);
           Long requestId = requestStageIds[0];
           Long stageId = requestStageIds[1];
-          String role = report.getRole();
           Long id = report.getTaskId();
           for (Stage stage : stages) {
             if (requestId.equals(stage.getRequestId()) && stageId.equals(stage.getStageId()))
{
@@ -1552,9 +1500,9 @@ public class TestActionScheduler {
         return null;
       }
     });
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         Long requestId = (Long) invocation.getArguments()[0];
         for (Stage stage : stages) {
           if (requestId.equals(stage.getRequestId())) {
@@ -1882,26 +1830,11 @@ public class TestActionScheduler {
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
     Clusters fsm = mock(Clusters.class);
-    Cluster oneClusterMock = mock(Cluster.class);
-    Service serviceObj = mock(Service.class);
-    ServiceComponent scomp = mock(ServiceComponent.class);
-    ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
-    when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
-    when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
-    when(scomp.getServiceComponentHost(anyString())).thenReturn(sch);
-    when(serviceObj.getCluster()).thenReturn(oneClusterMock);
-
-    HashMap<String, ServiceComponentHost> hosts =
-            new HashMap<String, ServiceComponentHost>();
-    hosts.put(serverHostname, sch);
-    when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
     List<Stage> stages = new ArrayList<Stage>();
     Map<String, String> payload = new HashMap<String, String>();
     final Stage s = getStageWithServerAction(1, 977, payload, "test", 300);
-    s.getExecutionCommands().get(serverHostname).get(0).getExecutionCommand().setServiceName(null);
     stages.add(s);
 
     ActionDBAccessor db = mock(ActionDBAccessor.class);
@@ -1912,37 +1845,45 @@ public class TestActionScheduler {
 
     when(db.getCommandsInProgressCount()).thenReturn(stages.size());
     when(db.getStagesInProgress()).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         String host = (String) invocation.getArguments()[0];
         String role = (String) invocation.getArguments()[3];
         CommandReport commandReport = (CommandReport) invocation.getArguments()[4];
-        HostRoleCommand command = s.getHostRoleCommand(host, role);
+
+        HostRoleCommand command = null;
+        if (null == host) {
+          command = s.getHostRoleCommand(null, role);
+        } else {
+          command = s.getHostRoleCommand(host, role);
+        }
+
         command.setStatus(HostRoleStatus.valueOf(commandReport.getStatus()));
         return null;
       }
     }).when(db).updateHostRoleState(anyString(), anyLong(), anyLong(), anyString(), any(CommandReport.class));
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<List<HostRoleCommand>>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        String host = (String) invocation.getArguments()[0];
+      public List<HostRoleCommand> answer(InvocationOnMock invocation) throws Throwable
{
         String role = (String) invocation.getArguments()[1];
         HostRoleStatus status = (HostRoleStatus) invocation.getArguments()[2];
 
-        HostRoleCommand task = s.getHostRoleCommand(host, role);
+        HostRoleCommand task = s.getHostRoleCommand(null, role);
 
         if (task.getStatus() == status) {
           return Arrays.asList(task);
         } else {
-          return null;
+          return Collections.emptyList();
         }
       }
     }).when(db).getTasksByHostRoleAndStatus(anyString(), anyString(), any(HostRoleStatus.class));
-    doAnswer(new Answer() {
+
+    doAnswer(new Answer<HostRoleCommand>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
-        return s.getHostRoleCommand(serverHostname, "AMBARI_SERVER_ACTION");
+      public HostRoleCommand answer(InvocationOnMock invocation) throws Throwable {
+        return s.getHostRoleCommand(null, "AMBARI_SERVER_ACTION");
       }
     }).when(db).getTask(anyLong());
 
@@ -1951,13 +1892,13 @@ public class TestActionScheduler {
         new HostsMap((String) null), unitOfWork, null, conf);
 
     int cycleCount = 0;
-    while (!stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION")
+    while (!stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION")
         .equals(HostRoleStatus.COMPLETED) && cycleCount++ <= MAX_CYCLE_ITERATIONS)
{
       scheduler.doWork();
       scheduler.getServerActionExecutor().doWork();
     }
 
-    assertEquals(stages.get(0).getHostRoleStatus(serverHostname, "AMBARI_SERVER_ACTION"),
+    assertEquals(stages.get(0).getHostRoleStatus(null, "AMBARI_SERVER_ACTION"),
             HostRoleStatus.COMPLETED);
   }
 
@@ -1970,7 +1911,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -2019,16 +1959,15 @@ public class TestActionScheduler {
     }
     when(db.getRequestTasks(anyLong())).thenReturn(requestTasks);
     when(db.getAllStages(anyLong())).thenReturn(stages);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         List<CommandReport> reports = (List<CommandReport>) invocation.getArguments()[0];
         for (CommandReport report : reports) {
           String actionId = report.getActionId();
           long[] requestStageIds = StageUtils.getRequestStage(actionId);
           Long requestId = requestStageIds[0];
           Long stageId = requestStageIds[1];
-          String role = report.getRole();
           Long id = report.getTaskId();
           for (Stage stage : stages) {
             if (requestId.equals(stage.getRequestId()) && stageId.equals(stage.getStageId()))
{
@@ -2060,9 +1999,9 @@ public class TestActionScheduler {
         return null;
       }
     });
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         Long requestId = (Long) invocation.getArguments()[0];
         for (Stage stage : stages) {
           if (requestId.equals(stage.getRequestId())) {
@@ -2086,10 +2025,6 @@ public class TestActionScheduler {
     ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf);
 
-    ActionManager am = new ActionManager(
-        2, 2, aq, fsm, db, new HostsMap((String) null),
-        unitOfWork, requestFactory, conf, null);
-
     scheduler.doWork();
 
     String reason = "Some reason";
@@ -2116,7 +2051,6 @@ public class TestActionScheduler {
     ServiceComponent scomp = mock(ServiceComponent.class);
     ServiceComponentHost sch = mock(ServiceComponentHost.class);
     UnitOfWork unitOfWork = mock(UnitOfWork.class);
-    RequestFactory requestFactory = mock(RequestFactory.class);
     when(fsm.getCluster(anyString())).thenReturn(oneClusterMock);
     when(oneClusterMock.getService(anyString())).thenReturn(serviceObj);
     when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
@@ -2184,16 +2118,15 @@ public class TestActionScheduler {
     }
     when(db.getRequestTasks(anyLong())).thenReturn(requestTasks);
     when(db.getAllStages(anyLong())).thenReturn(stagesInProgress);
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         List<CommandReport> reports = (List<CommandReport>) invocation.getArguments()[0];
         for (CommandReport report : reports) {
           String actionId = report.getActionId();
           long[] requestStageIds = StageUtils.getRequestStage(actionId);
           Long requestId = requestStageIds[0];
           Long stageId = requestStageIds[1];
-          String role = report.getRole();
           Long id = report.getTaskId();
           for (Stage stage : stagesInProgress) {
             if (requestId.equals(stage.getRequestId()) && stageId.equals(stage.getStageId()))
{
@@ -2227,9 +2160,9 @@ public class TestActionScheduler {
     });
 
     final Map<Long, Boolean> startedRequests = new HashMap<Long, Boolean>();
-    doAnswer(new Answer() {
+    doAnswer(new Answer<Void>() {
       @Override
-      public Object answer(InvocationOnMock invocation) throws Throwable {
+      public Void answer(InvocationOnMock invocation) throws Throwable {
         startedRequests.put((Long)invocation.getArguments()[0], true);
         return null;
       }
@@ -2252,10 +2185,6 @@ public class TestActionScheduler {
     ActionScheduler scheduler = new ActionScheduler(100, 50, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf);
 
-    ActionManager am = new ActionManager(
-        2, 2, aq, fsm, db, new HostsMap((String) null),
-        unitOfWork, requestFactory, conf, null);
-
     // Execution of request 1
 
     scheduler.doWork();

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9f5e8d/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 69f0be7..7d2c117 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -23,6 +23,7 @@ import static org.easymock.EasyMock.replay;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.Field;
@@ -33,6 +34,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.ambari.server.Role;
 import org.apache.ambari.server.actionmanager.ActionManager;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
@@ -568,6 +570,16 @@ public class UpgradeResourceProviderTest {
 
     List<HostRoleCommand> commands = am.getRequestTasks(id);
 
+    boolean foundOne = false;
+    for (HostRoleCommand hrc : commands) {
+      if (hrc.getRole().equals(Role.AMBARI_SERVER_ACTION)) {
+        assertEquals(-1L, hrc.getHostId());
+        assertNull(hrc.getHostName());
+        foundOne = true;
+      }
+    }
+    assertTrue("Expected at least one server-side action", foundOne);
+
     HostRoleCommand cmd = commands.get(commands.size()-1);
 
     HostRoleCommandDAO dao = injector.getInstance(HostRoleCommandDAO.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9f5e8d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
index 62b2fdf..193e3d5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/ServerActionExecutorTest.java
@@ -122,9 +122,7 @@ public class ServerActionExecutorTest {
         "{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
 
     stage.addServerActionCommand(ManualStageAction.class.getName(),
-        null, Role.AMBARI_SERVER_ACTION,
-        RoleCommand.EXECUTE,
-        "cluster1", SERVER_HOST_NAME,
+        null, Role.AMBARI_SERVER_ACTION, RoleCommand.EXECUTE, "cluster1",
         new ServiceComponentHostServerActionEvent(StageUtils.getHostName(), System.currentTimeMillis()),
         Collections.<String, String>emptyMap(), null, null, 1200, false);
 
@@ -321,8 +319,8 @@ public class ServerActionExecutorTest {
                 1L, requestContext, CLUSTER_HOST_INFO, "{}", "{}");
 
             stage.setStageId(stageId);
-            stage.addServerActionCommand(MockServerAction.class.getName(), Role.AMBARI_SERVER_ACTION,
-                RoleCommand.EXECUTE, "cluster1",
+            stage.addServerActionCommand(MockServerAction.class.getName(), null,
+                Role.AMBARI_SERVER_ACTION, RoleCommand.EXECUTE, "cluster1",
                 new ServiceComponentHostServerActionEvent(SERVER_HOST_NAME, System.currentTimeMillis()),
                 payload, "command detail", null, timeout, false);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9f5e8d/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java
b/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java
index 3f856bd..0d36048 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stageplanner/TestStagePlanner.java
@@ -17,10 +17,12 @@
  */
 package org.apache.ambari.server.stageplanner;
 
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.persist.PersistService;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.Role;
 import org.apache.ambari.server.RoleCommand;
@@ -38,11 +40,10 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.persist.PersistService;
 
 public class TestStagePlanner {
 
@@ -126,11 +127,11 @@ public class TestStagePlanner {
     Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L,  "execution command wrapper
test",
             "clusterHostInfo", "commandParamsStage", "hostParamsStage");
     stage.setStageId(1);
-    stage.addServerActionCommand("RESTART", Role.HIVE_METASTORE,
+    stage.addServerActionCommand("RESTART", null, Role.HIVE_METASTORE,
             RoleCommand.CUSTOM_COMMAND, "cluster1",
             new ServiceComponentHostServerActionEvent("host2", System.currentTimeMillis()),
             null, "command detail", null, null, false);
-    stage.addServerActionCommand("RESTART", Role.MYSQL_SERVER,
+    stage.addServerActionCommand("RESTART", null, Role.MYSQL_SERVER,
             RoleCommand.CUSTOM_COMMAND, "cluster1",
             new ServiceComponentHostServerActionEvent("host2", System.currentTimeMillis()),
             null, "command detail", null, null, false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/8e9f5e8d/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
new file mode 100644
index 0000000..505cf42
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.upgrade;
+
+import static org.easymock.EasyMock.capture;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Field;
+
+import org.apache.ambari.server.configuration.Configuration;
+import org.apache.ambari.server.orm.DBAccessor;
+import org.apache.ambari.server.state.stack.OsFamily;
+import org.easymock.Capture;
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.google.inject.Binder;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ * UpgradeCatalog220 tests.
+ */
+public class UpgradeCatalog220Test {
+
+
+  @Test
+  public void testExecuteDDLUpdates() throws Exception {
+
+    final DBAccessor dbAccessor = createNiceMock(DBAccessor.class);
+
+    Configuration configuration = createNiceMock(Configuration.class);
+    expect(configuration.getDatabaseUrl()).andReturn(Configuration.JDBC_IN_MEMORY_URL).anyTimes();
+
+    Capture<DBAccessor.DBColumnInfo> columnCapture = new Capture<DBAccessor.DBColumnInfo>();
+
+    dbAccessor.alterColumn(eq("host_role_command"), capture(columnCapture));
+    expectLastCall();
+
+
+    replay(dbAccessor, configuration);
+    AbstractUpgradeCatalog upgradeCatalog = getUpgradeCatalog(dbAccessor);
+    Class<?> c = AbstractUpgradeCatalog.class;
+    Field f = c.getDeclaredField("configuration");
+    f.setAccessible(true);
+    f.set(upgradeCatalog, configuration);
+
+    upgradeCatalog.executeDDLUpdates();
+    verify(dbAccessor, configuration);
+
+    assertTrue(columnCapture.getValue().isNullable());
+  }
+
+  @Test
+  public void testExecuteDMLUpdates() throws Exception {
+    final DBAccessor dbAccessor     = createNiceMock(DBAccessor.class);
+    UpgradeCatalog220 upgradeCatalog = (UpgradeCatalog220) getUpgradeCatalog(dbAccessor);
+
+    upgradeCatalog.executeDMLUpdates();
+  }
+
+  @Test
+  public void testGetTargetVersion() throws Exception {
+    final DBAccessor dbAccessor     = createNiceMock(DBAccessor.class);
+    UpgradeCatalog   upgradeCatalog = getUpgradeCatalog(dbAccessor);
+
+    Assert.assertEquals("2.2.0", upgradeCatalog.getTargetVersion());
+  }
+
+  @Test
+  public void testGetSourceVersion() {
+    final DBAccessor dbAccessor     = createNiceMock(DBAccessor.class);
+    UpgradeCatalog upgradeCatalog = getUpgradeCatalog(dbAccessor);
+    Assert.assertEquals("2.1.0", upgradeCatalog.getSourceVersion());
+  }
+
+  private AbstractUpgradeCatalog getUpgradeCatalog(final DBAccessor dbAccessor) {
+    Module module = new Module() {
+      @Override
+      public void configure(Binder binder) {
+        binder.bind(DBAccessor.class).toInstance(dbAccessor);
+        binder.bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
+      }
+    };
+    Injector injector = Guice.createInjector(module);
+    return injector.getInstance(UpgradeCatalog220.class);
+  }
+
+
+}


Mime
View raw message