|
|
@@ -2892,41 +2892,6 @@ public class TestActionScheduler {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void testAbortHolding() throws AmbariException {
|
|
|
- UnitOfWork unitOfWork = EasyMock.createMock(UnitOfWork.class);
|
|
|
- ActionDBAccessor db = EasyMock.createMock(ActionDBAccessor.class);
|
|
|
- Clusters fsm = EasyMock.createMock(Clusters.class);
|
|
|
- Configuration conf = new Configuration(new Properties());
|
|
|
- HostEntity hostEntity1 = new HostEntity();
|
|
|
- hostEntity1.setHostName("h1");
|
|
|
- hostDAO.merge(hostEntity1);
|
|
|
-
|
|
|
- db.abortHostRole("h1", -1L, -1L, "AMBARI_SERVER_ACTION");
|
|
|
- EasyMock.expectLastCall();
|
|
|
-
|
|
|
- EasyMock.replay(db);
|
|
|
-
|
|
|
- ActionScheduler scheduler = new ActionScheduler(100, 50, db, fsm, 3,
|
|
|
- new HostsMap((String) null),
|
|
|
- unitOfWork, null, conf, entityManagerProviderMock,
|
|
|
- (HostRoleCommandDAO)null, (HostRoleCommandFactory)null, null);
|
|
|
-
|
|
|
- HostRoleCommand hrc1 = hostRoleCommandFactory.create("h1", Role.NAMENODE, null, RoleCommand.EXECUTE);
|
|
|
- hrc1.setStatus(HostRoleStatus.COMPLETED);
|
|
|
- HostRoleCommand hrc3 = hostRoleCommandFactory.create("h1", Role.AMBARI_SERVER_ACTION, null, RoleCommand.CUSTOM_COMMAND);
|
|
|
- hrc3.setStatus(HostRoleStatus.HOLDING);
|
|
|
- HostRoleCommand hrc4 = hostRoleCommandFactory.create("h1", Role.FLUME_HANDLER, null, RoleCommand.EXECUTE);
|
|
|
- hrc4.setStatus(HostRoleStatus.PENDING);
|
|
|
-
|
|
|
- List<HostRoleCommand> hostRoleCommands = Arrays.asList(hrc1, hrc3, hrc4);
|
|
|
-
|
|
|
- scheduler.cancelHostRoleCommands(hostRoleCommands, "foo");
|
|
|
-
|
|
|
- EasyMock.verify(db);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
@Test
|
|
|
public void testAbortAmbariServerAction() throws AmbariException {
|
|
|
UnitOfWork unitOfWork = EasyMock.createMock(UnitOfWork.class);
|