use of org.apache.cloudstack.api.command.admin.host.CancelHostAsDegradedCmd in project cloudstack by apache.
the class ResourceManagerImplTest method prepareAndTestCancelHostAsDegraded.
private void prepareAndTestCancelHostAsDegraded(Status hostStatus, ResourceState originalState, ResourceState expectedResourceState) throws NoTransitionException {
CancelHostAsDegradedCmd cancelHostAsDegradedCmd = Mockito.spy(new CancelHostAsDegradedCmd());
HostVO hostVo = createDummyHost(hostStatus);
hostVo.setResourceState(originalState);
when(cancelHostAsDegradedCmd.getId()).thenReturn(0l);
when(hostDao.findById(0l)).thenReturn(hostVo);
Host result = resourceManager.cancelHostAsDegraded(cancelHostAsDegradedCmd);
Assert.assertEquals(expectedResourceState, hostVo.getResourceState());
}
Aggregations