Search in sources :

Example 1 with StorageSubsystemCommandHandler

use of com.cloud.common.storageprocessor.resource.StorageSubsystemCommandHandler in project cosmic by MissionCriticalCloud.

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(this.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, this.citrixResourceBase);
    assertTrue(answer.getResult());
}
Also used : RebootAnswer(com.cloud.legacymodel.communication.answer.RebootAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) CreateAnswer(com.cloud.legacymodel.communication.answer.CreateAnswer) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) StorageSubsystemCommandHandler(com.cloud.common.storageprocessor.resource.StorageSubsystemCommandHandler) AttachCommand(com.cloud.legacymodel.communication.command.AttachCommand) DiskTO(com.cloud.legacymodel.to.DiskTO) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with StorageSubsystemCommandHandler

use of com.cloud.common.storageprocessor.resource.StorageSubsystemCommandHandler in project cosmic by MissionCriticalCloud.

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(this.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, this.libvirtComputingResource);
    assertTrue(answer.getResult());
}
Also used : Answer(com.cloud.legacymodel.communication.answer.Answer) CheckRouterAnswer(com.cloud.legacymodel.communication.answer.CheckRouterAnswer) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) LibvirtRequestWrapper(com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper) StorageSubsystemCommandHandler(com.cloud.common.storageprocessor.resource.StorageSubsystemCommandHandler) AttachCommand(com.cloud.legacymodel.communication.command.AttachCommand) DiskTO(com.cloud.legacymodel.to.DiskTO) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) Test(org.junit.Test)

Aggregations

StorageSubsystemCommandHandler (com.cloud.common.storageprocessor.resource.StorageSubsystemCommandHandler)2 Answer (com.cloud.legacymodel.communication.answer.Answer)2 AttachAnswer (com.cloud.legacymodel.communication.answer.AttachAnswer)2 AttachCommand (com.cloud.legacymodel.communication.command.AttachCommand)2 DiskTO (com.cloud.legacymodel.to.DiskTO)2 Test (org.junit.Test)2 LibvirtRequestWrapper (com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper)1 CheckRouterAnswer (com.cloud.legacymodel.communication.answer.CheckRouterAnswer)1 CreateAnswer (com.cloud.legacymodel.communication.answer.CreateAnswer)1 RebootAnswer (com.cloud.legacymodel.communication.answer.RebootAnswer)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1