1 package org
.eclipse
.linuxtools
.lttng
.stubs
.service
.shells
;
3 import java
.util
.ArrayList
;
6 import org
.eclipse
.core
.commands
.ExecutionException
;
7 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
8 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.service
.CommandResult
;
9 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.service
.ICommandResult
;
11 public class SessionCreationErrorsShell
extends TestCommandShell
{
12 @SuppressWarnings("nls")
14 public ICommandResult
executeCommand(String command
, IProgressMonitor monitor
, boolean checkReturnValue
) throws ExecutionException
{
15 if ("lttng create alreadyExist".equals(command
)) {
16 String
[] output
= new String
[1];
17 //Error: Session name already exist
18 output
[0] = String
.valueOf("Error: Session name already exist");
19 return new CommandResult(1, output
);
20 } else if("lttng create \"session with spaces\"".equals(command
)) {
21 List
<String
> list
= new ArrayList
<String
>();
22 list
.add("Session session with spaces created.");
23 list
.add("Traces will be written in /home/user/lttng-traces/session with spaces-20120209-095418");
24 return new CommandResult(0, list
.toArray(new String
[list
.size()]));
25 } else if ("lttng create wrongName".equals(command
)) {
26 List
<String
> list
= new ArrayList
<String
>();
27 list
.add("Session auto created.");
28 list
.add("Traces will be written in /home/user/lttng-traces/auto-20120209-095418");
29 return new CommandResult(0, list
.toArray(new String
[list
.size()]));
30 } else if ("lttng create wrongPath -o /home/user/hallo".equals(command
)) {
31 List
<String
> list
= new ArrayList
<String
>();
32 list
.add("Session wrongPath created.");
33 list
.add("Traces will be written in /home/user/lttng-traces/wrongPath-20120209-095418");
34 return new CommandResult(0, list
.toArray(new String
[list
.size()]));
35 } else if ("lttng create pathWithSpaces -o \"/home/user/hallo user/here\"".equals(command
)) {
36 List
<String
> list
= new ArrayList
<String
>();
37 list
.add("Session pathWithSpaces created.");
38 list
.add("Traces will be written in /home/user/hallo user/here/pathWithSpaces-20120209-095418");
39 return new CommandResult(0, list
.toArray(new String
[list
.size()]));
42 String
[] output
= new String
[1];
43 output
[0] = String
.valueOf("Command not found");
44 return new CommandResult(1, output
);