Search in sources :

Example 1 with CancelHostAsDegradedCmd

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());
}
Also used : CancelHostAsDegradedCmd(org.apache.cloudstack.api.command.admin.host.CancelHostAsDegradedCmd) Host(com.cloud.host.Host) HostVO(com.cloud.host.HostVO)

Aggregations

Host (com.cloud.host.Host)1 HostVO (com.cloud.host.HostVO)1 CancelHostAsDegradedCmd (org.apache.cloudstack.api.command.admin.host.CancelHostAsDegradedCmd)1