Search in sources :

Example 1 with ListUnmanagedInstancesCmd

use of org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd in project cloudstack by apache.

the class UnmanagedVMsManagerImplTest method listUnmanagedInstancesInvalidHypervisorTest.

@Test(expected = InvalidParameterValueException.class)
public void listUnmanagedInstancesInvalidHypervisorTest() {
    ListUnmanagedInstancesCmd cmd = Mockito.mock(ListUnmanagedInstancesCmd.class);
    ClusterVO cluster = new ClusterVO(1, 1, "Cluster");
    cluster.setHypervisorType(Hypervisor.HypervisorType.KVM.toString());
    when(clusterDao.findById(Mockito.anyLong())).thenReturn(cluster);
    unmanagedVMsManager.listUnmanagedInstances(cmd);
}
Also used : ClusterVO(com.cloud.dc.ClusterVO) ListUnmanagedInstancesCmd(org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with ListUnmanagedInstancesCmd

use of org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd in project cloudstack by apache.

the class UnmanagedVMsManagerImplTest method listUnmanagedInstancesInvalidCallerTest.

@Test(expected = PermissionDeniedException.class)
public void listUnmanagedInstancesInvalidCallerTest() {
    CallContext.unregister();
    AccountVO account = new AccountVO("user", 1L, "", Account.ACCOUNT_TYPE_NORMAL, "uuid");
    UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
    CallContext.register(user, account);
    ListUnmanagedInstancesCmd cmd = Mockito.mock(ListUnmanagedInstancesCmd.class);
    unmanagedVMsManager.listUnmanagedInstances(cmd);
}
Also used : UserVO(com.cloud.user.UserVO) AccountVO(com.cloud.user.AccountVO) ListUnmanagedInstancesCmd(org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with ListUnmanagedInstancesCmd

use of org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd in project cloudstack by apache.

the class UnmanagedVMsManagerImplTest method listUnmanagedInstancesTest.

@Test
public void listUnmanagedInstancesTest() {
    ListUnmanagedInstancesCmd cmd = Mockito.mock(ListUnmanagedInstancesCmd.class);
    unmanagedVMsManager.listUnmanagedInstances(cmd);
}
Also used : ListUnmanagedInstancesCmd(org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

ListUnmanagedInstancesCmd (org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 ClusterVO (com.cloud.dc.ClusterVO)1 AccountVO (com.cloud.user.AccountVO)1 UserVO (com.cloud.user.UserVO)1