@Test public void testRebootCommand() { final Connect conn = Mockito.mock(Connect.class); final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito.mock(LibvirtUtilitiesHelper.class); final String vmName = "Test"; final RebootCommand command = new RebootCommand(vmName, true); when(this.libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper); try { when(libvirtUtilitiesHelper.getConnectionByVmName(vmName)).thenReturn(conn); } catch (final LibvirtException e) { fail(e.getMessage()); } final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance(); assertNotNull(wrapper); final Answer answer = wrapper.execute(command, this.libvirtComputingResource); assertTrue(answer.getResult()); verify(this.libvirtComputingResource, times(1)).getLibvirtUtilitiesHelper(); try { verify(libvirtUtilitiesHelper, times(1)).getConnectionByVmName(vmName); } catch (final LibvirtException e) { fail(e.getMessage()); } }
public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() { return this.libvirtUtilitiesHelper; }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() { return this.libvirtUtilitiesHelper; } }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() { return this.libvirtUtilitiesHelper; }  }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() { return this.libvirtUtilitiesHelper; }  @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args); @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout); @Override ExecutionResult createFileInVR(final String routerIp, final String path, final String filename,
                                          final String content); @Override ExecutionResult prepareCommand(final NetworkElementCommand cmd); @Override ExecutionResult cleanupCommand(final NetworkElementCommand cmd); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName, final String interfaceToExclude); List<VifDriver> getAllVifDrivers(); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName); String networkUsage(final String privateIpAddress, final String option, final String vif); Domain getDomain(final Connect conn, final String vmName); VifDriver getVifDriver(final TrafficType trafficType); boolean isInterface(final String fname); LibvirtUtilitiesHelper getLibvirtUtilitiesHelper(); CpuStat getCpuStat(); MemStat getMemStat(); VirtualRoutingResource getVirtRouterResource(); String getPublicBridgeName(); KvmStoragePoolManager getStoragePoolMgr(); String getPrivateIp(); int getMigrateDowntime(); int getMigratePauseAfter(); int getMigrateSpeed(); int getMigrateSpeedAcrossCluster(); int getVmBlockCopySpeed(); String getPingTestPath(); String getUpdateHostPasswdPath(); int getScriptsTimeout(); KvmHaMonitor getMonitor(); StorageLayer getStorage(); String createTmplPath(); int getCmdsTimeout(); String manageSnapshotPath(); String getGuestBridgeName(); String getOvsPvlanDhcpHostPath(); String getOvsPvlanVmPath(); StorageSubsystemCommandHandler getStorageHandler(); @Override boolean configure(final Map<String, Object> params); @Override void configure(final AgentConfiguration agentConfiguration); @Override Answer executeRequest(final Command cmd); @Override boolean stop(); boolean passCmdLine(final String vmName, final String cmdLine); boolean checkNetwork(final String networkName); KvmPhysicalDisk templateToPrimaryDownload(final String templateUrl, final KvmStoragePool primaryPool,
                                                     final String volUuid); PowerState getVmState(final Connect conn, final String vmName); long[] getNetworkStats(final String privateIp); long[] getVpcNetworkStats(final String privateIp, final String publicIp, final String option); String configureVpcNetworkUsage(final String privateIpAddress, final String publicIp, final String option,
                                           final String vpcCidr); void handleVmStartFailure(final LibvirtVmDef vm); String getCurrentLocalDateTimeStamp(); Long getCurrentEpoch(); LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo); boolean isGuestVirtIoCapable(final String guestOsName); void createVifs(final VirtualMachineTO vmSpec, final LibvirtVmDef vm); String getVolumePath(final Connect conn, final DiskTO volume); @Override PingCommand getCurrentStatus(final long id); void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVmDef vm); @Override HostType getType(); String diskUuidToSerial(final String uuid); @Override StartupCommand[] initialize(); synchronized String attachOrDetachIso(final Connect conn, final String vmName, String isoPath,
                                                 final boolean isAttach); List<LibvirtDiskDef> getDisks(final Connect conn, final String vmName); boolean cleanupDisk(final LibvirtDiskDef disk); String rebootVm(final Connect conn, final String vmName); String stopVm(final Connect conn, final String vmName, final boolean forceStop); String startVm(final Connect conn, final String vmName, final String domainXml); List<Ternary<String, Boolean, String>> cleanVMSnapshotMetadata(final Domain dm); void restoreVMSnapshotMetadata(final Domain dm, final String vmName, final List<Ternary<String, Boolean, String>> vmsnapshots); Integer getVncPort(final Connect conn, final String vmName); List<VmDiskStatsEntry> getVmDiskStat(final Connect conn, final String vmName); VmStatsEntry getVmStat(final Connect conn, final String vmName); Pair<Double, Double> getNicStats(final String nicName); @Override void setName(final String name); List<String> getCpuFeatures(); String getSystemTermpolicyCrash(); String getSystemTermpolicyPowerOff(); String getSystemTermpolicyReboot(); String getVmTermpolicyCrash(); String getVmTermpolicyPowerOff(); String getVmTermpolicyReboot(); String[] getIfNamePatterns(); long getTotalMemory(); }
LibvirtComputingResource extends AgentResourceBase implements AgentResource, VirtualRouterDeployer { public LibvirtUtilitiesHelper getLibvirtUtilitiesHelper() { return this.libvirtUtilitiesHelper; }  @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args); @Override ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout); @Override ExecutionResult createFileInVR(final String routerIp, final String path, final String filename,
                                          final String content); @Override ExecutionResult prepareCommand(final NetworkElementCommand cmd); @Override ExecutionResult cleanupCommand(final NetworkElementCommand cmd); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName, final String interfaceToExclude); List<VifDriver> getAllVifDrivers(); List<InterfaceDef> getInterfaces(final Connect conn, final String vmName); String networkUsage(final String privateIpAddress, final String option, final String vif); Domain getDomain(final Connect conn, final String vmName); VifDriver getVifDriver(final TrafficType trafficType); boolean isInterface(final String fname); LibvirtUtilitiesHelper getLibvirtUtilitiesHelper(); CpuStat getCpuStat(); MemStat getMemStat(); VirtualRoutingResource getVirtRouterResource(); String getPublicBridgeName(); KvmStoragePoolManager getStoragePoolMgr(); String getPrivateIp(); int getMigrateDowntime(); int getMigratePauseAfter(); int getMigrateSpeed(); int getMigrateSpeedAcrossCluster(); int getVmBlockCopySpeed(); String getPingTestPath(); String getUpdateHostPasswdPath(); int getScriptsTimeout(); KvmHaMonitor getMonitor(); StorageLayer getStorage(); String createTmplPath(); int getCmdsTimeout(); String manageSnapshotPath(); String getGuestBridgeName(); String getOvsPvlanDhcpHostPath(); String getOvsPvlanVmPath(); StorageSubsystemCommandHandler getStorageHandler(); @Override boolean configure(final Map<String, Object> params); @Override void configure(final AgentConfiguration agentConfiguration); @Override Answer executeRequest(final Command cmd); @Override boolean stop(); boolean passCmdLine(final String vmName, final String cmdLine); boolean checkNetwork(final String networkName); KvmPhysicalDisk templateToPrimaryDownload(final String templateUrl, final KvmStoragePool primaryPool,
                                                     final String volUuid); PowerState getVmState(final Connect conn, final String vmName); long[] getNetworkStats(final String privateIp); long[] getVpcNetworkStats(final String privateIp, final String publicIp, final String option); String configureVpcNetworkUsage(final String privateIpAddress, final String publicIp, final String option,
                                           final String vpcCidr); void handleVmStartFailure(final LibvirtVmDef vm); String getCurrentLocalDateTimeStamp(); Long getCurrentEpoch(); LibvirtVmDef createVmFromSpec(final VirtualMachineTO vmTo); boolean isGuestVirtIoCapable(final String guestOsName); void createVifs(final VirtualMachineTO vmSpec, final LibvirtVmDef vm); String getVolumePath(final Connect conn, final DiskTO volume); @Override PingCommand getCurrentStatus(final long id); void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVmDef vm); @Override HostType getType(); String diskUuidToSerial(final String uuid); @Override StartupCommand[] initialize(); synchronized String attachOrDetachIso(final Connect conn, final String vmName, String isoPath,
                                                 final boolean isAttach); List<LibvirtDiskDef> getDisks(final Connect conn, final String vmName); boolean cleanupDisk(final LibvirtDiskDef disk); String rebootVm(final Connect conn, final String vmName); String stopVm(final Connect conn, final String vmName, final boolean forceStop); String startVm(final Connect conn, final String vmName, final String domainXml); List<Ternary<String, Boolean, String>> cleanVMSnapshotMetadata(final Domain dm); void restoreVMSnapshotMetadata(final Domain dm, final String vmName, final List<Ternary<String, Boolean, String>> vmsnapshots); Integer getVncPort(final Connect conn, final String vmName); List<VmDiskStatsEntry> getVmDiskStat(final Connect conn, final String vmName); VmStatsEntry getVmStat(final Connect conn, final String vmName); Pair<Double, Double> getNicStats(final String nicName); @Override void setName(final String name); List<String> getCpuFeatures(); String getSystemTermpolicyCrash(); String getSystemTermpolicyPowerOff(); String getSystemTermpolicyReboot(); String getVmTermpolicyCrash(); String getVmTermpolicyPowerOff(); String getVmTermpolicyReboot(); String[] getIfNamePatterns(); long getTotalMemory(); static final String SSHKEYSPATH; static final String SSHPRVKEYPATH; static final String SSHPUBKEYPATH; static final String BASH_SCRIPT_PATH; }