Added some more JUnit tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui.tests / stubs / org / eclipse / linuxtools / lttng / stubs / service / TestRemoteSystemProxy.java
index 92efecaf9a317435a622f83b7cb2d4075cddcc05..b173597f379820c1d2bfe86849f3d6d0883fd6ac 100644 (file)
@@ -1,8 +1,19 @@
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ * 
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors: 
+ *   Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
 package org.eclipse.linuxtools.lttng.stubs.service;
 
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.TestCommandShell;
+import org.eclipse.linuxtools.lttng.stubs.service.shells.LTTngToolsFileShell;
 import org.eclipse.linuxtools.lttng.ui.views.control.remote.IRemoteSystemProxy;
 import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandShell;
 import org.eclipse.rse.core.model.IRSECallback;
@@ -10,8 +21,13 @@ import org.eclipse.rse.core.subsystems.ICommunicationsListener;
 import org.eclipse.rse.core.subsystems.ISubSystem;
 import org.eclipse.rse.services.shells.IShellService;
 import org.eclipse.rse.services.terminals.ITerminalService;
+import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
 
 public class TestRemoteSystemProxy implements IRemoteSystemProxy {
+    
+    private LTTngToolsFileShell fShell = null;
+    private String fTestFile = null;
+    private String fScenario = null;
 
     @Override
     public IShellService getShellService() {
@@ -32,6 +48,10 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
     public ISubSystem getTerminalServiceSubSystem() {
         return null;
     }
+    @Override
+    public IFileServiceSubSystem getFileServiceSubSystem() {
+        return null;
+    }
 
     @Override
     public void connect(IRSECallback callback) throws ExecutionException {
@@ -42,12 +62,23 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
 
     @Override
     public void disconnect() throws ExecutionException {
+        fShell = null;
     }
 
     @Override
     public ICommandShell createCommandShell() throws ExecutionException {
-        ICommandShell shell = CommandShellFactory.getInstance().getShellForSessionNames();
-        return shell;
+        if (fShell == null) { 
+            fShell = CommandShellFactory.getInstance().getFileShell();
+            if ((fTestFile != null) && (fScenario != null)) {
+                try {
+                    fShell.loadScenarioFile(fTestFile);
+                } catch (Exception e) {
+                    throw new ExecutionException(e.toString());
+                }
+                fShell.setScenario(fScenario);
+            }
+        }
+        return fShell;
     }
 
     @Override
@@ -57,5 +88,15 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy {
     @Override
     public void removeCommunicationListener(ICommunicationsListener listener) {
     }
-
+    
+    public void setTestFile(String testFile) {
+        fTestFile = testFile;
+    }
+    
+    public void setScenario(String scenario) {
+        fScenario = scenario;
+        if (fShell != null) {
+            fShell.setScenario(fScenario);
+        }
+    }
 }
This page took 0.024022 seconds and 5 git commands to generate.