@Test public void testCreateDirectory() throws CommandFailureException { Jvm mockJvm = mock(Jvm.class); when(mockJvm.getHostName()).thenReturn("test-host"); when(Config.mockShellCommandFactory.executeRemoteCommand(anyString(), eq(Command.CREATE_DIR), anyString())).thenReturn(mock(RemoteCommandReturnInfo.class)); jvmControlService.executeCreateDirectoryCommand(mockJvm, "./target"); verify(Config.mockShellCommandFactory).executeRemoteCommand("test-host", Command.CREATE_DIR, "./target"); }
@Override public CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath) throws CommandFailureException { RemoteCommandReturnInfo remoteCommandReturnInfo = shellCommandFactory.executeRemoteCommand(jvm.getHostName(), Command.CREATE_DIR, dirAbsolutePath); return new CommandOutput(new ExecReturnCode(remoteCommandReturnInfo.retCode), remoteCommandReturnInfo.standardOuput, remoteCommandReturnInfo.errorOupout); }
JvmControlServiceImpl implements JvmControlService { @Override public CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath) throws CommandFailureException { RemoteCommandReturnInfo remoteCommandReturnInfo = shellCommandFactory.executeRemoteCommand(jvm.getHostName(), Command.CREATE_DIR, dirAbsolutePath); return new CommandOutput(new ExecReturnCode(remoteCommandReturnInfo.retCode), remoteCommandReturnInfo.standardOuput, remoteCommandReturnInfo.errorOupout); } }
JvmControlServiceImpl implements JvmControlService { @Override public CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath) throws CommandFailureException { RemoteCommandReturnInfo remoteCommandReturnInfo = shellCommandFactory.executeRemoteCommand(jvm.getHostName(), Command.CREATE_DIR, dirAbsolutePath); return new CommandOutput(new ExecReturnCode(remoteCommandReturnInfo.retCode), remoteCommandReturnInfo.standardOuput, remoteCommandReturnInfo.errorOupout); } JvmControlServiceImpl(final JvmPersistenceService jvmPersistenceService,
                                 final JvmStateService jvmStateService,
                                 final HistoryFacadeService historyFacadeService); }
JvmControlServiceImpl implements JvmControlService { @Override public CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath) throws CommandFailureException { RemoteCommandReturnInfo remoteCommandReturnInfo = shellCommandFactory.executeRemoteCommand(jvm.getHostName(), Command.CREATE_DIR, dirAbsolutePath); return new CommandOutput(new ExecReturnCode(remoteCommandReturnInfo.retCode), remoteCommandReturnInfo.standardOuput, remoteCommandReturnInfo.errorOupout); } JvmControlServiceImpl(final JvmPersistenceService jvmPersistenceService,
                                 final JvmStateService jvmStateService,
                                 final HistoryFacadeService historyFacadeService); @Override CommandOutput controlJvm(final ControlJvmRequest controlJvmRequest, final User aUser); @Override CommandOutput controlJvmSynchronously(final ControlJvmRequest controlJvmRequest, final long timeout,
                                                 final User user); @Override CommandOutput secureCopyFile(final ControlJvmRequest secureCopyRequest, final String sourcePath,
                                        final String destPath, String userId, boolean overwrite); @Override CommandOutput executeChangeFileModeCommand(final Jvm jvm, final String modifiedPermissions, final String targetAbsoluteDir, final String targetFile); @Override CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath); @Override CommandOutput executeCheckFileExistsCommand(final Jvm jvm, final String filename); @Override CommandOutput executeBackUpCommand(final Jvm jvm, final String filename); void setJvmCommandFactory(JvmCommandFactory jvmCommandFactory); }
JvmControlServiceImpl implements JvmControlService { @Override public CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath) throws CommandFailureException { RemoteCommandReturnInfo remoteCommandReturnInfo = shellCommandFactory.executeRemoteCommand(jvm.getHostName(), Command.CREATE_DIR, dirAbsolutePath); return new CommandOutput(new ExecReturnCode(remoteCommandReturnInfo.retCode), remoteCommandReturnInfo.standardOuput, remoteCommandReturnInfo.errorOupout); } JvmControlServiceImpl(final JvmPersistenceService jvmPersistenceService,
                                 final JvmStateService jvmStateService,
                                 final HistoryFacadeService historyFacadeService); @Override CommandOutput controlJvm(final ControlJvmRequest controlJvmRequest, final User aUser); @Override CommandOutput controlJvmSynchronously(final ControlJvmRequest controlJvmRequest, final long timeout,
                                                 final User user); @Override CommandOutput secureCopyFile(final ControlJvmRequest secureCopyRequest, final String sourcePath,
                                        final String destPath, String userId, boolean overwrite); @Override CommandOutput executeChangeFileModeCommand(final Jvm jvm, final String modifiedPermissions, final String targetAbsoluteDir, final String targetFile); @Override CommandOutput executeCreateDirectoryCommand(final Jvm jvm, final String dirAbsolutePath); @Override CommandOutput executeCheckFileExistsCommand(final Jvm jvm, final String filename); @Override CommandOutput executeBackUpCommand(final Jvm jvm, final String filename); void setJvmCommandFactory(JvmCommandFactory jvmCommandFactory);  }