AutonomiccsSystemVmDeploymentService implements InitializingBean { protected NetworkVO getDefaultNetwork(long dataCenterId) { DataCenterVO dc = dataCenterDao.findById(dataCenterId); if (dc.getNetworkType() == NetworkType.Advanced && dc.isSecurityGroupEnabled()) { return getDefaultNetworkForAdvancedNetworkingWithSecurityGroupds(dataCenterId, dc); } return getDefaultNetwork(dc); }  HostVO searchForRandomHostInCloudToDeployAutonomiccsSystemVm(); HostVO searchForRandomHostInPodToDeployAutonomiccsSystemVm(HostPodVO pod); HostVO searchForAnotherRandomHostToStartSystemVm(VMInstanceVO vmInstance); AutonomiccsSystemVm deploySystemVmWithJava(Long hostId, SystemVmType systemVmType); @Override void afterPropertiesSet();  }
@Test public void getDefaultNetworkTest() { NetworkVO network = Mockito.mock(NetworkVO.class); NetworkVO network2 = Mockito.mock(NetworkVO.class); DataCenterVO dc = configureGetDefaultNetworkTest(NetworkType.Advanced, true, network, network2); NetworkVO result = spy.getDefaultNetwork(0l); verifyGetDefaultNetworkTest(dc, network, result, 1, 1, 0); }
@Test public void getDefaultNetworkTestNetworkTypeNotAdvanced() { NetworkVO network = Mockito.mock(NetworkVO.class); NetworkVO network2 = Mockito.mock(NetworkVO.class); DataCenterVO dc = configureGetDefaultNetworkTest(NetworkType.Basic, true, network, network2); NetworkVO result = spy.getDefaultNetwork(0l); verifyGetDefaultNetworkTest(dc, network2, result, 0, 0, 1); }
@Test public void getDefaultNetworkTestSecurityGroupDisabled() { NetworkVO network = Mockito.mock(NetworkVO.class); NetworkVO network2 = Mockito.mock(NetworkVO.class); DataCenterVO dc = configureGetDefaultNetworkTest(NetworkType.Advanced, false, network, network2); NetworkVO result = spy.getDefaultNetwork(0l); verifyGetDefaultNetworkTest(dc, network2, result, 1, 0, 1); }