@Test public void testSetFullDebugOutputStream() throws Exception { final OutputStream outStream = mock(OutputStream.class); final OutputStreamProxy proxy = mock(OutputStreamProxy.class); whenNew(OutputStreamProxy.class).withArguments(outStream).thenReturn(proxy); final OutputStreamConfiguration streamConfiguration = mock(OutputStreamConfiguration.class); when(streamConfiguration.getOutputStream()).thenReturn(outStream); when(streamConfiguration.getOutputType()).thenReturn(OutputType.FULL_DEBUG); final CclCommandTerminal terminal = new CclCommandTerminal( TerminalProperties.getNewBuilder().setOsPromptPattern("osPromptPattern").build(), streamConfiguration); terminal.executeCommands(sshTerminal, Collections.singletonList("a command go"), false); verify(sshTerminal).setOutputStream(proxy); verify(jetmMock).collect(); final ArgumentCaptor<List<CommandExpectationGroup>> commandGroupsCaptor = argumentCaptorListCommandExpectationGroup; verify(sshTerminal).executeCommandGroups(commandGroupsCaptor.capture()); final List<CommandExpectationGroup> commandExpectationGroups = commandGroupsCaptor.getValue(); assertThat(commandExpectationGroups.size()).isEqualTo(6); assertThat(commandExpectationGroups.get(0).getCommands()).isEqualTo(Arrays.asList("envset " + environmentName)); assertThat(commandExpectationGroups.get(1).getCommands()).isEqualTo(Arrays.asList("$cer_exe/cclora_dbg")); assertThat(commandExpectationGroups.get(2).getCommands()).isEqualTo(Arrays.asList("", "")); assertThat(commandExpectationGroups.get(3).getCommands()).isEqualTo(Arrays.asList("reset", "%t")); assertThat(commandExpectationGroups.get(4).getCommands()) .isEqualTo(Arrays.asList("set width 132 go", "a command go")); assertThat(commandExpectationGroups.get(5).getCommands()).isEqualTo(Arrays.asList("exit")); }
public void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate) throws SshException { final EtmPoint point = PointFactory.getPoint(getClass(), "executeCommands"); try { final boolean hasStreamConfiguration = streamConfiguration != null; final boolean hasCclOutputStream = hasStreamConfiguration && OutputType.CCL_SESSION.equals(streamConfiguration.getOutputType()); if (hasStreamConfiguration) { terminal.setOutputStream(hasCclOutputStream ? new CclOutputStreamProxy(streamConfiguration.getOutputStream(), OUTPUT_START, OUTPUT_END) : new OutputStreamProxy(streamConfiguration.getOutputStream())); } terminal.setExpectationTimeout(terminalProperties.getExpectationTimeout()); final List<String> nonMergedCommands = new ArrayList<String>(); for (String command : commands) { final String splitCommands[] = command.split("\\n"); for (int index = 0; index < splitCommands.length; index++) { nonMergedCommands.add(splitCommands[index]); } } final List<CommandExpectationGroup> commandExpectationGroups = new ArrayList<CommandExpectationGroup>(); commandExpectationGroups.add(getSessionStartupGroup()); commandExpectationGroups.add(getCclLaunchGroup()); if (authenticate) { commandExpectationGroups.addAll(getAuthenticationGroups()); } commandExpectationGroups.add(getFinalizeLoginGroup()); commandExpectationGroups.add(getWaitForCcclReadyGroup()); commandExpectationGroups.add(getCclSessionGroup(nonMergedCommands, hasCclOutputStream)); commandExpectationGroups.add(getCclExitGroup()); terminal.executeCommandGroups(commandExpectationGroups); } finally { point.collect(); } }
CclCommandTerminal { public void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate) throws SshException { final EtmPoint point = PointFactory.getPoint(getClass(), "executeCommands"); try { final boolean hasStreamConfiguration = streamConfiguration != null; final boolean hasCclOutputStream = hasStreamConfiguration && OutputType.CCL_SESSION.equals(streamConfiguration.getOutputType()); if (hasStreamConfiguration) { terminal.setOutputStream(hasCclOutputStream ? new CclOutputStreamProxy(streamConfiguration.getOutputStream(), OUTPUT_START, OUTPUT_END) : new OutputStreamProxy(streamConfiguration.getOutputStream())); } terminal.setExpectationTimeout(terminalProperties.getExpectationTimeout()); final List<String> nonMergedCommands = new ArrayList<String>(); for (String command : commands) { final String splitCommands[] = command.split("\\n"); for (int index = 0; index < splitCommands.length; index++) { nonMergedCommands.add(splitCommands[index]); } } final List<CommandExpectationGroup> commandExpectationGroups = new ArrayList<CommandExpectationGroup>(); commandExpectationGroups.add(getSessionStartupGroup()); commandExpectationGroups.add(getCclLaunchGroup()); if (authenticate) { commandExpectationGroups.addAll(getAuthenticationGroups()); } commandExpectationGroups.add(getFinalizeLoginGroup()); commandExpectationGroups.add(getWaitForCcclReadyGroup()); commandExpectationGroups.add(getCclSessionGroup(nonMergedCommands, hasCclOutputStream)); commandExpectationGroups.add(getCclExitGroup()); terminal.executeCommandGroups(commandExpectationGroups); } finally { point.collect(); } } }
CclCommandTerminal { public void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate) throws SshException { final EtmPoint point = PointFactory.getPoint(getClass(), "executeCommands"); try { final boolean hasStreamConfiguration = streamConfiguration != null; final boolean hasCclOutputStream = hasStreamConfiguration && OutputType.CCL_SESSION.equals(streamConfiguration.getOutputType()); if (hasStreamConfiguration) { terminal.setOutputStream(hasCclOutputStream ? new CclOutputStreamProxy(streamConfiguration.getOutputStream(), OUTPUT_START, OUTPUT_END) : new OutputStreamProxy(streamConfiguration.getOutputStream())); } terminal.setExpectationTimeout(terminalProperties.getExpectationTimeout()); final List<String> nonMergedCommands = new ArrayList<String>(); for (String command : commands) { final String splitCommands[] = command.split("\\n"); for (int index = 0; index < splitCommands.length; index++) { nonMergedCommands.add(splitCommands[index]); } } final List<CommandExpectationGroup> commandExpectationGroups = new ArrayList<CommandExpectationGroup>(); commandExpectationGroups.add(getSessionStartupGroup()); commandExpectationGroups.add(getCclLaunchGroup()); if (authenticate) { commandExpectationGroups.addAll(getAuthenticationGroups()); } commandExpectationGroups.add(getFinalizeLoginGroup()); commandExpectationGroups.add(getWaitForCcclReadyGroup()); commandExpectationGroups.add(getCclSessionGroup(nonMergedCommands, hasCclOutputStream)); commandExpectationGroups.add(getCclExitGroup()); terminal.executeCommandGroups(commandExpectationGroups); } finally { point.collect(); } } CclCommandTerminal(final TerminalProperties terminalProperties,
            final OutputStreamConfiguration streamConfiguration); }
CclCommandTerminal { public void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate) throws SshException { final EtmPoint point = PointFactory.getPoint(getClass(), "executeCommands"); try { final boolean hasStreamConfiguration = streamConfiguration != null; final boolean hasCclOutputStream = hasStreamConfiguration && OutputType.CCL_SESSION.equals(streamConfiguration.getOutputType()); if (hasStreamConfiguration) { terminal.setOutputStream(hasCclOutputStream ? new CclOutputStreamProxy(streamConfiguration.getOutputStream(), OUTPUT_START, OUTPUT_END) : new OutputStreamProxy(streamConfiguration.getOutputStream())); } terminal.setExpectationTimeout(terminalProperties.getExpectationTimeout()); final List<String> nonMergedCommands = new ArrayList<String>(); for (String command : commands) { final String splitCommands[] = command.split("\\n"); for (int index = 0; index < splitCommands.length; index++) { nonMergedCommands.add(splitCommands[index]); } } final List<CommandExpectationGroup> commandExpectationGroups = new ArrayList<CommandExpectationGroup>(); commandExpectationGroups.add(getSessionStartupGroup()); commandExpectationGroups.add(getCclLaunchGroup()); if (authenticate) { commandExpectationGroups.addAll(getAuthenticationGroups()); } commandExpectationGroups.add(getFinalizeLoginGroup()); commandExpectationGroups.add(getWaitForCcclReadyGroup()); commandExpectationGroups.add(getCclSessionGroup(nonMergedCommands, hasCclOutputStream)); commandExpectationGroups.add(getCclExitGroup()); terminal.executeCommandGroups(commandExpectationGroups); } finally { point.collect(); } } CclCommandTerminal(final TerminalProperties terminalProperties,
            final OutputStreamConfiguration streamConfiguration); void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate); TerminalProperties getTerminalProperties(); }
CclCommandTerminal { public void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate) throws SshException { final EtmPoint point = PointFactory.getPoint(getClass(), "executeCommands"); try { final boolean hasStreamConfiguration = streamConfiguration != null; final boolean hasCclOutputStream = hasStreamConfiguration && OutputType.CCL_SESSION.equals(streamConfiguration.getOutputType()); if (hasStreamConfiguration) { terminal.setOutputStream(hasCclOutputStream ? new CclOutputStreamProxy(streamConfiguration.getOutputStream(), OUTPUT_START, OUTPUT_END) : new OutputStreamProxy(streamConfiguration.getOutputStream())); } terminal.setExpectationTimeout(terminalProperties.getExpectationTimeout()); final List<String> nonMergedCommands = new ArrayList<String>(); for (String command : commands) { final String splitCommands[] = command.split("\\n"); for (int index = 0; index < splitCommands.length; index++) { nonMergedCommands.add(splitCommands[index]); } } final List<CommandExpectationGroup> commandExpectationGroups = new ArrayList<CommandExpectationGroup>(); commandExpectationGroups.add(getSessionStartupGroup()); commandExpectationGroups.add(getCclLaunchGroup()); if (authenticate) { commandExpectationGroups.addAll(getAuthenticationGroups()); } commandExpectationGroups.add(getFinalizeLoginGroup()); commandExpectationGroups.add(getWaitForCcclReadyGroup()); commandExpectationGroups.add(getCclSessionGroup(nonMergedCommands, hasCclOutputStream)); commandExpectationGroups.add(getCclExitGroup()); terminal.executeCommandGroups(commandExpectationGroups); } finally { point.collect(); } } CclCommandTerminal(final TerminalProperties terminalProperties,
            final OutputStreamConfiguration streamConfiguration); void executeCommands(final JSchSshTerminal terminal, final List<String> commands, final boolean authenticate); TerminalProperties getTerminalProperties(); static final String CCL_VIEWER_PATTERN; static final String CCL_ABORT_PATTERN; }