Search in sources :

Example 1 with DeclareHostAsDegradedCmd

use of org.apache.cloudstack.api.command.admin.host.DeclareHostAsDegradedCmd in project cloudstack by apache.

the class ResourceManagerImplTest method prepareAndTestDeclareHostAsDegraded.

private void prepareAndTestDeclareHostAsDegraded(Status hostStatus, ResourceState originalState, ResourceState expectedResourceState) throws NoTransitionException {
    DeclareHostAsDegradedCmd declareHostAsDegradedCmd = Mockito.spy(new DeclareHostAsDegradedCmd());
    HostVO hostVo = createDummyHost(hostStatus);
    hostVo.setResourceState(originalState);
    when(declareHostAsDegradedCmd.getId()).thenReturn(0l);
    when(hostDao.findById(0l)).thenReturn(hostVo);
    Host result = resourceManager.declareHostAsDegraded(declareHostAsDegradedCmd);
    Assert.assertEquals(expectedResourceState, hostVo.getResourceState());
}
Also used : DeclareHostAsDegradedCmd(org.apache.cloudstack.api.command.admin.host.DeclareHostAsDegradedCmd) Host(com.cloud.host.Host) HostVO(com.cloud.host.HostVO)

Aggregations

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