use of com.cloud.hypervisor.xenserver.resource.XsHost in project cloudstack by apache.
the class NotAValidCommand method testSetupCommand.
@Test
public void testSetupCommand() {
final XsHost xsHost = Mockito.mock(XsHost.class);
final HostEnvironment env = Mockito.mock(HostEnvironment.class);
final SetupCommand setupCommand = new SetupCommand(env);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(citrixResourceBase.getHost()).thenReturn(xsHost);
final Answer answer = wrapper.execute(setupCommand, citrixResourceBase);
verify(citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.hypervisor.xenserver.resource.XsHost in project cloudstack by apache.
the class NotAValidCommand method testModifyStoragePoolCommand.
@Test
public void testModifyStoragePoolCommand() {
final StoragePoolVO poolVO = Mockito.mock(StoragePoolVO.class);
final XsHost xsHost = Mockito.mock(XsHost.class);
final ModifyStoragePoolCommand modifyStorageCommand = new ModifyStoragePoolCommand(false, poolVO);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(citrixResourceBase.getHost()).thenReturn(xsHost);
final Answer answer = wrapper.execute(modifyStorageCommand, citrixResourceBase);
verify(citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.hypervisor.xenserver.resource.XsHost in project cloudstack by apache.
the class XenServer56WrapperTest method testSetupCommand.
@Test
public void testSetupCommand() {
final XsHost xsHost = Mockito.mock(XsHost.class);
final HostEnvironment env = Mockito.mock(HostEnvironment.class);
final SetupCommand setupCommand = new SetupCommand(env);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(xenServer56Resource.getHost()).thenReturn(xsHost);
final Answer answer = wrapper.execute(setupCommand, xenServer56Resource);
verify(xenServer56Resource, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.hypervisor.xenserver.resource.XsHost in project cloudstack by apache.
the class NotAValidCommand method testClusterVMMetaDataSyncCommand.
@Test
public void testClusterVMMetaDataSyncCommand() {
final String uuid = "6172d8b7-ba10-4a70-93f9-ecaf41f51d53";
final Connection conn = Mockito.mock(Connection.class);
final XsHost xsHost = Mockito.mock(XsHost.class);
final Pool pool = PowerMockito.mock(Pool.class);
final Pool.Record poolr = Mockito.mock(Pool.Record.class);
final Host.Record hostr = Mockito.mock(Host.Record.class);
final Host master = Mockito.mock(Host.class);
final ClusterVMMetaDataSyncCommand vmDataSync = new ClusterVMMetaDataSyncCommand(10, 1l);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(citrixResourceBase.getConnection()).thenReturn(conn);
try {
when(citrixResourceBase.getHost()).thenReturn(xsHost);
when(citrixResourceBase.getHost().getUuid()).thenReturn(uuid);
PowerMockito.mockStatic(Pool.Record.class);
when(pool.getRecord(conn)).thenReturn(poolr);
poolr.master = master;
when(poolr.master.getRecord(conn)).thenReturn(hostr);
hostr.uuid = uuid;
} catch (final BadServerResponse e) {
fail(e.getMessage());
} catch (final XenAPIException e) {
fail(e.getMessage());
} catch (final XmlRpcException e) {
fail(e.getMessage());
}
final Answer answer = wrapper.execute(vmDataSync, citrixResourceBase);
verify(citrixResourceBase, times(1)).getConnection();
assertTrue(answer.getResult());
}
use of com.cloud.hypervisor.xenserver.resource.XsHost in project cloudstack by apache.
the class NotAValidCommand method testScaleVmCommand.
@Test
public void testScaleVmCommand() {
final String uuid = "6172d8b7-ba10-4a70-93f9-ecaf41f51d53";
final VirtualMachineTO machineTO = Mockito.mock(VirtualMachineTO.class);
final Connection conn = Mockito.mock(Connection.class);
final XsHost xsHost = Mockito.mock(XsHost.class);
final Host host = Mockito.mock(Host.class);
final ScaleVmCommand scaleVm = new ScaleVmCommand(machineTO);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(citrixResourceBase.getConnection()).thenReturn(conn);
when(citrixResourceBase.getHost()).thenReturn(xsHost);
when(citrixResourceBase.getHost().getUuid()).thenReturn(uuid);
try {
when(citrixResourceBase.isDmcEnabled(conn, host)).thenReturn(true);
} catch (final XenAPIException e) {
fail(e.getMessage());
} catch (final XmlRpcException e) {
fail(e.getMessage());
}
final Answer answer = wrapper.execute(scaleVm, citrixResourceBase);
verify(citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
Aggregations