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());
}
Aggregations