1 /**********************************************************************
2 * Copyright (c) 2012, 2015 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE
12 **********************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.tmf
.remote
.core
.stubs
.shells
;
15 import org
.eclipse
.core
.commands
.ExecutionException
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
19 import org
.eclipse
.jdt
.annotation
.Nullable
;
20 import org
.eclipse
.tracecompass
.internal
.tmf
.remote
.core
.shell
.CommandInput
;
21 import org
.eclipse
.tracecompass
.internal
.tmf
.remote
.core
.shell
.CommandResult
;
22 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandInput
;
23 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandOutputListener
;
24 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandResult
;
25 import org
.eclipse
.tracecompass
.tmf
.remote
.core
.shell
.ICommandShell
;
31 public class TestCommandShell
implements ICommandShell
{
33 /** If the shell is connected */
34 protected boolean fIsConnected
= false;
37 public void dispose() {
42 public ICommandResult
executeCommand(ICommandInput command
, @Nullable IProgressMonitor monitor
) throws ExecutionException
{
43 return executeCommand(command
, monitor
, null);
47 public ICommandResult
executeCommand(ICommandInput command
, @Nullable IProgressMonitor monitor
,
48 @Nullable ICommandOutputListener listener
) throws ExecutionException
{
50 return createCommandResult(0, new @NonNull String
[0], new @NonNull String
[0]);
52 return createCommandResult(1, new @NonNull String
[0], new @NonNull String
[0]);
56 public ICommandInput
createCommand() {
57 return new CommandInput();
61 * Creates a command result
64 * The result of the command
66 * The output, as an array of strings
68 * THe error output as an array of strings
69 * @return {@link ICommandResult} instance
71 protected ICommandResult
createCommandResult(int result
, @NonNull String
[] output
, @NonNull String
[] errorOutput
) {
72 return new CommandResult(result
, output
, errorOutput
);