Package com.cisco.telnet.server.domain.response

Examples of com.cisco.telnet.server.domain.response.CommandResponse


  }

  private String executeCommand(String command, TelnetCommand telnetCommand) {
    String response;
    CommandRequest commandRequest = new StringCommandRequest(command);
    CommandResponse commandResponse = telnetCommand.execute(commandRequest, sessionContext);
    response = commandResponse.getResultAsString();
    return response;
  }
View Full Code Here


    when(connection.getRemoteSocketAddress()).thenReturn(new InetSocketAddress(1111));

    when(commandFactory.getCommand(PWD)).thenReturn(pwdCommand);
    anyRequest = Matchers.any();
    sessionContext = Matchers.any();
    CommandResponse anyResponse = new StringCommandResponse(TMP_DIR);
    when(pwdCommand.execute(anyRequest, sessionContext)).thenReturn(anyResponse);

    requestProcessorTask.call();
    // Should exist because the second call to the test reader will return
    // null
View Full Code Here

  @Test
  public void testExecuteNotFound() throws IOException {
    shellOperation = new ShellOperation(CommandFactory.CD, Arrays.asList(TMP_DIR));
    String currentUserDir = System.getProperty("user.dir");
    Mockito.when(sessionContext.getCurrentDirectory()).thenReturn(currentUserDir);
    CommandResponse commandResponse = cdCommand.executeOperation(shellOperation, sessionContext);

    assertEquals(ResponseStatusEnum.ERROR, commandResponse.getResponseStatus());
    Mockito.verify(sessionContext, Mockito.never()).setCurrentDirectory(
        new File(TMP_DIR).getAbsoluteFile().toString());
  }
View Full Code Here

TOP

Related Classes of com.cisco.telnet.server.domain.response.CommandResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.