@Test public void testRun() throws Exception { final EtmPoint point = mock(EtmPoint.class); mockStatic(PointFactory.class); when(PointFactory.getPoint(DropScriptCommand.class, "run")).thenReturn(point); final JSchSshTerminal sshTerminal = mock(JSchSshTerminal.class); whenNew(JSchSshTerminal.class).withNoArguments().thenReturn(sshTerminal); final CclCommandTerminal cclTerminal = mock(CclCommandTerminal.class); command.run(cclTerminal); verify(cclTerminal).executeCommands(sshTerminal, Collections.singletonList("drop program " + scriptName + " go"), false); verify(point).collect(); }
@Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); @Override void run(final CclCommandTerminal terminal); }
DropScriptCommand extends AbstractCclCommand { @Override public void run(final CclCommandTerminal terminal) { final EtmPoint point = PointFactory.getPoint(getClass(), "run"); try { try { terminal.executeCommands(new JSchSshTerminal(), Collections.singletonList("drop program " + scriptName + " go"), false); } catch (final SshException e) { throw new CclCommandException("Dropping script " + scriptName + " failed.", e); } } finally { point.collect(); } } DropScriptCommand(final String scriptName); @Override void run(final CclCommandTerminal terminal);  }