use of com.cloud.storage.resource.StorageSubsystemCommandHandler in project cloudstack by apache.
the class LibvirtComputingResourceTest method testStorageSubSystemCommand.
@Test
public void testStorageSubSystemCommand() {
final DiskTO disk = Mockito.mock(DiskTO.class);
final String vmName = "Test";
final AttachCommand command = new AttachCommand(disk, vmName);
final StorageSubsystemCommandHandler handler = Mockito.mock(StorageSubsystemCommandHandler.class);
when(libvirtComputingResource.getStorageHandler()).thenReturn(handler);
when(handler.handleStorageCommands(command)).thenReturn(new AttachAnswer(disk));
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, libvirtComputingResource);
assertTrue(answer.getResult());
}
use of com.cloud.storage.resource.StorageSubsystemCommandHandler in project cloudstack by apache.
the class NotAValidCommand method testStorageSubSystemCommand.
@Test
public void testStorageSubSystemCommand() {
final DiskTO disk = Mockito.mock(DiskTO.class);
final String vmName = "Test";
final AttachCommand command = new AttachCommand(disk, vmName);
final StorageSubsystemCommandHandler handler = Mockito.mock(StorageSubsystemCommandHandler.class);
when(citrixResourceBase.getStorageHandler()).thenReturn(handler);
when(handler.handleStorageCommands(command)).thenReturn(new AttachAnswer(disk));
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, citrixResourceBase);
assertTrue(answer.getResult());
}
Aggregations