Search in sources :

Example 1 with JobHelper

use of com.cloud.vm.VirtualMachineManagerImpl.JobHelper in project cosmic by MissionCriticalCloud.

the class JobHelperTest method test_jobIsForSameNetwork_whenJobCmdInfoIsNull.

@Test
public void test_jobIsForSameNetwork_whenJobCmdInfoIsNull() throws Exception {
    final long networkId = 1L;
    final VmWorkJobVO vmWorkJobVO = new VmWorkJobVO("someContext");
    final NetworkVO networkVO = new NetworkVO();
    networkVO.setId(networkId);
    assertThat(new JobHelper().jobIsForSameNetwork(vmWorkJobVO, networkVO), is(false));
}
Also used : NetworkVO(com.cloud.network.dao.NetworkVO) JobHelper(com.cloud.vm.VirtualMachineManagerImpl.JobHelper) VmWorkJobVO(com.cloud.framework.jobs.impl.VmWorkJobVO) Test(org.junit.Test)

Example 2 with JobHelper

use of com.cloud.vm.VirtualMachineManagerImpl.JobHelper in project cosmic by MissionCriticalCloud.

the class JobHelperTest method test_jobIsForSameNetwork_whenJobIsForNetwork.

@Test
public void test_jobIsForSameNetwork_whenJobIsForNetwork() throws Exception {
    final long networkId = 1L;
    final VmWorkAddVmToNetwork vmWorkAddVmToNetwork = new VmWorkAddVmToNetwork(0, 0, 0, "someHandler", networkId, null);
    final VmWorkJobVO vmWorkJobVO = new VmWorkJobVO("someContext");
    vmWorkJobVO.setCmdInfo(VmWorkSerializer.serialize(vmWorkAddVmToNetwork));
    final NetworkVO networkVO = new NetworkVO();
    networkVO.setId(networkId);
    assertThat(new JobHelper().jobIsForSameNetwork(vmWorkJobVO, networkVO), is(true));
}
Also used : NetworkVO(com.cloud.network.dao.NetworkVO) JobHelper(com.cloud.vm.VirtualMachineManagerImpl.JobHelper) VmWorkJobVO(com.cloud.framework.jobs.impl.VmWorkJobVO) Test(org.junit.Test)

Example 3 with JobHelper

use of com.cloud.vm.VirtualMachineManagerImpl.JobHelper in project cosmic by MissionCriticalCloud.

the class JobHelperTest method test_jobIsForSameNetwork_whenJobCmdInfoNetworkIdIsNull.

@Test
public void test_jobIsForSameNetwork_whenJobCmdInfoNetworkIdIsNull() throws Exception {
    final long networkId = 1L;
    final VmWorkAddVmToNetwork vmWorkAddVmToNetwork = new VmWorkAddVmToNetwork(0, 0, 0, "someHandler", null, null);
    final VmWorkJobVO vmWorkJobVO = new VmWorkJobVO("someContext");
    vmWorkJobVO.setCmdInfo(VmWorkSerializer.serialize(vmWorkAddVmToNetwork));
    final NetworkVO networkVO = new NetworkVO();
    networkVO.setId(networkId);
    assertThat(new JobHelper().jobIsForSameNetwork(vmWorkJobVO, networkVO), is(false));
}
Also used : NetworkVO(com.cloud.network.dao.NetworkVO) JobHelper(com.cloud.vm.VirtualMachineManagerImpl.JobHelper) VmWorkJobVO(com.cloud.framework.jobs.impl.VmWorkJobVO) Test(org.junit.Test)

Example 4 with JobHelper

use of com.cloud.vm.VirtualMachineManagerImpl.JobHelper in project cosmic by MissionCriticalCloud.

the class JobHelperTest method test_jobIsForSameNetwork_whenJobIsNotForNetwork.

@Test
public void test_jobIsForSameNetwork_whenJobIsNotForNetwork() throws Exception {
    final long someNetworkId = 1L;
    final long anotherNetworkId = 2L;
    final VmWorkAddVmToNetwork vmWorkAddVmToNetwork = new VmWorkAddVmToNetwork(0, 0, 0, "someHandler", someNetworkId, null);
    final VmWorkJobVO vmWorkJobVO = new VmWorkJobVO("someContext");
    vmWorkJobVO.setCmdInfo(VmWorkSerializer.serialize(vmWorkAddVmToNetwork));
    final NetworkVO networkVO = new NetworkVO();
    networkVO.setId(anotherNetworkId);
    assertThat(new JobHelper().jobIsForSameNetwork(vmWorkJobVO, networkVO), is(false));
}
Also used : NetworkVO(com.cloud.network.dao.NetworkVO) JobHelper(com.cloud.vm.VirtualMachineManagerImpl.JobHelper) VmWorkJobVO(com.cloud.framework.jobs.impl.VmWorkJobVO) Test(org.junit.Test)

Aggregations

VmWorkJobVO (com.cloud.framework.jobs.impl.VmWorkJobVO)4 NetworkVO (com.cloud.network.dao.NetworkVO)4 JobHelper (com.cloud.vm.VirtualMachineManagerImpl.JobHelper)4 Test (org.junit.Test)4