use of com.cloud.agent.resource.kvm.ha.KvmHaBase.NfsStoragePool in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResourceTest method testFenceCommand.
@Test
public void testFenceCommand() {
final VirtualMachine vm = Mockito.mock(VirtualMachine.class);
final Host host = Mockito.mock(Host.class);
final FenceCommand command = new FenceCommand(vm, host);
final KvmHaMonitor monitor = Mockito.mock(KvmHaMonitor.class);
final NfsStoragePool storagePool = Mockito.mock(NfsStoragePool.class);
final List<NfsStoragePool> pools = new ArrayList<>();
pools.add(storagePool);
when(this.libvirtComputingResource.getMonitor()).thenReturn(monitor);
when(monitor.getStoragePools()).thenReturn(pools);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, this.libvirtComputingResource);
assertFalse(answer.getResult());
verify(this.libvirtComputingResource, times(1)).getMonitor();
verify(monitor, times(1)).getStoragePools();
}
Aggregations