AutonomiccsSystemVmDeploymentService implements InitializingBean { protected void validateParametersToDeployTheSystemVm(Long hostId, HostVO host) { if (host == null) { throw new CloudRuntimeException(String.format("Could not find a host with the provieded id [%d]", hostId)); } if (!autonomiccsSystemVmTemplateService.isTemplateRegisteredAndReadyForHypervisor(host.getHypervisorType())) { throw new CloudRuntimeException( String.format("There is no Autonomiccs system VM for hypervisor [%s], so we do not deploy a system Vm for it.", host.getHypervisorType())); } }  HostVO searchForRandomHostInCloudToDeployAutonomiccsSystemVm(); HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod); HostVO searchForAnotherRandomHostToStartSystemVm(VMInstanceVO vmInstance); AutonomiccsSystemVm deploySystemVmWithJava(Long hostId, SystemVmType systemVmType); @Override void afterPropertiesSet();  }
@Test public void validateParametersToDeployTheSystemVmTestTemplateRegisteredAndReadyForHypervisor() { HostVO host = Mockito.mock(HostVO.class); configureValidateParametersToDeployTheSystemVmTest(host, true); spy.validateParametersToDeployTheSystemVm(0l, host); verifyValidateParametersToDeployTheSystemVmTest(host); }
@Test(expected = CloudRuntimeException.class) public void validateParametersToDeployTheSystemVmTest() { HostVO host = Mockito.mock(HostVO.class); configureValidateParametersToDeployTheSystemVmTest(host, false); spy.validateParametersToDeployTheSystemVm(0l, host); verifyValidateParametersToDeployTheSystemVmTest(host); }
@Test(expected = CloudRuntimeException.class) public void validateParametersToDeployTheSystemVmTestCloudRuntimeException() { spy.validateParametersToDeployTheSystemVm(0l, null); }