Added some more JUnit tests
authorBernd Hufmann <bhufmann@gmail.com>
Thu, 15 Mar 2012 12:53:30 +0000 (08:53 -0400)
committerBernd Hufmann <bhufmann@gmail.com>
Thu, 15 Mar 2012 12:53:30 +0000 (08:53 -0400)
73 files changed:
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/AllTests.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlPropertiesTest.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlProviderTests.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTestFacility.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTreeModelTest.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/impl/AllTests.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/impl/ModelImplFactory.java
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/impl/ProbeEventInfoTest.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/service/LTTngControlServiceTest.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/CommandShellFactory.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/TestRemoteSystemProxy.java
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/GetSessionGarbageShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LTTngToolsFileShell.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LttngNotExistsShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoSessionNamesShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoUstProviderShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionCreationErrorsShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNamesShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNotExistsShell.java [deleted file]
org.eclipse.linuxtools.lttng.ui.tests/testfiles/CreateTreeTest.cfg [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui.tests/testfiles/LTTngServiceTest.cfg [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui.tests/testfiles/ListInfoTest.cfg [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/icons/elcl16/refresh.gif [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/plugin.properties
org.eclipse.linuxtools.lttng.ui/plugin.xml
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/ControlView.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/ConfirmDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/CreateChannelDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/CreateSessionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/EnableEventsDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/GetEventInfoDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IConfirmDialog.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/ICreateChannelDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/ICreateSessionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IEnableEventsDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IGetEventInfoDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/INewConnectionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/NewConnectionDialog.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/TraceControlDialogFactory.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/AssignEventHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/BaseEnableEventHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/ChangeEventStateHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateChannelOnDomainHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateChannelOnSessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/CreateSessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/DestroySessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnChannelHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnDomainHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/EnableEventOnSessionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/NewConnectionHandler.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/RefreshHandler.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/IProbeEventInfo.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/ITraceInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/BaseEventInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/ChannelInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/DomainInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/EventInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/ProbeEventInfo.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/SessionInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TargetNodeComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceEventComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceProbeEventComponent.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderInfo.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceEventPropertySource.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceProbeEventPropertySource.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/service/ILttngControlService.java
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/service/LTTngControlService.java

index 76064d27d300aed3940596962b126ad6312d5482..a6258d9f35becf32405470d3f7a58371a29be906 100644 (file)
@@ -22,6 +22,7 @@ public class AllTests {
         //$JUnit-BEGIN$
         suite.addTestSuite(TraceControlComponentTest.class);
         suite.addTestSuite(TraceControlTreeModelTest.class);
+        suite.addTestSuite(TraceControlProviderTests.class);
         suite.addTestSuite(TraceControlPropertiesTest.class);
         //$JUnit-END$
         return new ModelImplTestSetup(suite);
index ced2114e6e57270df3e792e5b4e6fe4f93d5b4b6..27e2329973a030dc8470350f9bb7d5e7a8d39dc0 100644 (file)
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.tests.control.model.component;
 
+import java.io.File;
+import java.net.URL;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.lttng.stubs.service.TestRemoteSystemProxy;
+import org.eclipse.linuxtools.lttng.ui.tests.LTTngUITestPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TargetNodeState;
@@ -29,6 +35,7 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeCompon
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProbeEventComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.BaseEventPropertySource;
@@ -37,6 +44,7 @@ import org.eclipse.linuxtools.lttng.ui.views.control.property.TargetNodeProperty
 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceChannelPropertySource;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceDomainPropertySource;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceEventPropertySource;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceProbeEventPropertySource;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceSessionPropertySource;
 import org.eclipse.linuxtools.lttng.ui.views.control.property.UstProviderPropertySource;
 import org.eclipse.rse.core.model.Host;
@@ -52,6 +60,14 @@ import org.junit.Before;
  */
 @SuppressWarnings("nls")
 public class TraceControlPropertiesTest extends TestCase {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    private static final String DIRECTORY   = "testfiles";
+    private static final String TEST_STREAM = "ListInfoTest.cfg";
+    private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
+
     
     // ------------------------------------------------------------------------
     // Test data
@@ -105,6 +121,11 @@ public class TraceControlPropertiesTest extends TestCase {
         
         TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
 
+        URL location = FileLocator.find(LTTngUITestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+        File testfile = new File(FileLocator.toFileURL(location).toURI());
+        proxy.setTestFile(testfile.getAbsolutePath());
+        proxy.setScenario(SCEN_LIST_INFO_TEST);
+            
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
         @SuppressWarnings("restriction")
@@ -266,7 +287,7 @@ public class TraceControlPropertiesTest extends TestCase {
         // ------------------------------------------------------------------------
         ITraceControlComponent[] channel0Events = channel.getChildren();
         assertNotNull(channel0Events);
-        assertEquals(2, channel0Events.length);
+        assertEquals(5, channel0Events.length);
         assertTrue(channel0Events[0] instanceof TraceEventComponent);
         
         TraceEventComponent event = (TraceEventComponent) channel0Events[0];
@@ -282,5 +303,44 @@ public class TraceControlPropertiesTest extends TestCase {
         assertEquals(TraceLogLevel.TRACE_EMERG.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_LOGLEVEL_PROPERTY_ID));
         assertEquals(TraceEventType.TRACEPOINT.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
         assertEquals(TraceEnablement.ENABLED.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
+        
+        // ------------------------------------------------------------------------
+        // Verify Probe Event Properties (adapter)
+        // ------------------------------------------------------------------------
+        assertTrue(channel0Events[2] instanceof TraceProbeEventComponent);
+        
+        TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2];
+        
+        adapter = probeEvent.getAdapter(IPropertySource.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof TraceProbeEventPropertySource);
+
+        TraceProbeEventPropertySource probeEventSource = (TraceProbeEventPropertySource)adapter;
+        assertNotNull(probeEventSource.getPropertyDescriptors());
+        assertEquals(4, probeEventSource.getPropertyDescriptors().length);
+        
+        assertEquals("myevent2", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
+        assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
+        assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
+        assertEquals("0xc0101340", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID));
+        
+        assertTrue(channel0Events[3] instanceof TraceProbeEventComponent);
+        
+        probeEvent = (TraceProbeEventComponent) channel0Events[3];
+        
+        adapter = probeEvent.getAdapter(IPropertySource.class);
+        assertNotNull(adapter);
+        assertTrue(adapter instanceof TraceProbeEventPropertySource);
+
+        probeEventSource = (TraceProbeEventPropertySource)adapter;
+        assertNotNull(probeEventSource.getPropertyDescriptors());
+        assertEquals(5, probeEventSource.getPropertyDescriptors().length);
+        
+        assertEquals("myevent0", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
+        assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
+        assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
+        assertEquals("0x0", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID));
+        assertEquals("init_post", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID));
+        
     }
 }
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlProviderTests.java b/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlProviderTests.java
new file mode 100644 (file)
index 0000000..ab9c43e
--- /dev/null
@@ -0,0 +1,948 @@
+/**********************************************************************
+ * 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.ui.tests.control.model.component;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.lttng.stubs.service.TestRemoteSystemProxy;
+import org.eclipse.linuxtools.lttng.ui.tests.LTTngUITestPlugin;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IConfirmDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateChannelOnSessionDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateSessionDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IGetEventInfoDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TargetNodeState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ChannelInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent;
+import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * The class <code>TraceControlTreeModelTest</code> contains tests for the tree component classes.
+ */
+@SuppressWarnings("nls")
+public class TraceControlProviderTests extends TestCase {
+    
+    private static final String DIRECTORY   = "testfiles";
+    private static final String TEST_STREAM = "CreateTreeTest.cfg";
+    private static final String SCEN_INIT_TEST = "Initialize";
+    private static final String SCEN_SCENARIO1_TEST = "Scenario1";
+    private static final String SCEN_SCENARIO2_TEST = "Scenario2";
+
+    // ------------------------------------------------------------------------
+    // Test data
+    // ------------------------------------------------------------------------
+    private TraceControlTestFacility fFacility;
+    private TestRemoteSystemProxy fProxy;
+    private String fTestFile; 
+    
+    // ------------------------------------------------------------------------
+    // Static methods
+    // ------------------------------------------------------------------------
+
+    /**
+     * Returns test setup used when executing test case stand-alone.
+     * @return Test setup class 
+     */
+    public static Test suite() {
+        return new ModelImplTestSetup(new TestSuite(TraceControlProviderTests.class));
+    }
+
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+
+    /**
+     * Perform pre-test initialization.
+     *
+     * @throws Exception
+     *         if the initialization fails for some reason
+     *
+     */
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        fFacility = TraceControlTestFacility.getInstance();
+        fProxy = new TestRemoteSystemProxy();
+        URL location = FileLocator.find(LTTngUITestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+        File testfile = new File(FileLocator.toFileURL(location).toURI());
+        fTestFile = testfile.getAbsolutePath();
+    }
+
+    /**
+     * Perform post-test clean-up.
+     *
+     * @throws Exception
+     *         if the clean-up fails for some reason
+     *
+     */
+    @Override
+    @After
+    public void tearDown()  throws Exception {
+    }
+    
+    /**
+     * Run the TraceControlComponent.
+     */
+    public void testTraceControlComponents()
+        throws Exception {
+        
+        fProxy.setTestFile(fTestFile);
+        fProxy.setScenario(SCEN_INIT_TEST);
+        
+        ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
+
+        @SuppressWarnings("restriction")
+        IHost host = new Host(new SystemProfile("myProfile", true));
+        host.setHostName("127.0.0.1");
+
+        TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
+
+        root.addChild(node);
+        node.connect();
+
+        fFacility.waitForJobs();
+
+        // Verify that node is connected
+        assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
+
+        // Get provider groups
+        ITraceControlComponent[] groups = node.getChildren();
+        assertNotNull(groups);
+        assertEquals(2, groups.length);
+
+        // Get kernel provider
+        ITraceControlComponent[] providers = groups[0].getChildren();
+        KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
+
+        // Get kernel provider events and select 2 events 
+        ITraceControlComponent[] events = kernelProvider.getChildren();
+        assertNotNull(events);
+        assertEquals(3, events.length);
+
+        BaseEventComponent baseEventInfo0 = (BaseEventComponent) events[0];
+        BaseEventComponent baseEventInfo1  = (BaseEventComponent) events[1];
+
+        // Initialize dialog implementations for command execution
+        TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
+        TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
+        TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
+
+        // Initialize scenario
+        fProxy.setScenario(SCEN_SCENARIO1_TEST);
+        // ------------------------------------------------------------------------
+        // Create session
+        // ------------------------------------------------------------------------
+        TraceSessionComponent session = createSession(groups[1]);
+        
+        // Verify that session was created
+        assertNotNull(session);
+        assertEquals("mysession", session.getName());
+        assertEquals("/home/user/lttng-traces/mysession-20120314-132824", session.getSessionPath());
+        assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+
+        // ------------------------------------------------------------------------
+        // Enable event on default channel on created session above
+        // ------------------------------------------------------------------------
+        ITraceControlComponent[] components =  { baseEventInfo0, baseEventInfo1 };
+
+        fFacility.getControlView().setSelection(components);
+        // Give GUI time to actually execute refresh
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        
+        fFacility.executeCommand("assign.event");
+        fFacility.waitForJobs();
+        
+        // Verify that kernel domain was created
+        ITraceControlComponent[] domains = session.getChildren();
+        assertNotNull(domains);
+        assertEquals(1, domains.length);
+
+        assertEquals("Kernel", domains[0].getName());
+        
+        // Verify that channel0 was created with default values
+        ITraceControlComponent[] channels =  domains[0].getChildren();
+        assertNotNull(channels);
+        assertEquals(1, channels.length);
+
+        assertTrue(channels[0] instanceof TraceChannelComponent);
+        TraceChannelComponent channel = (TraceChannelComponent) channels[0]; 
+        assertEquals("channel0", channel.getName());
+        assertEquals(4, channel.getNumberOfSubBuffers());
+        assertEquals("splice()", channel.getOutputType());
+        assertEquals(false, channel.isOverwriteMode());
+        assertEquals(200, channel.getReadTimer());
+        assertEquals(TraceEnablement.ENABLED, channel.getState());
+        assertEquals(262144, channel.getSubBufferSize());
+        assertEquals(0, channel.getSwitchTimer());
+
+        // Verify that event components were created
+        ITraceControlComponent[] channel0Events = channel.getChildren();
+        assertNotNull(channel0Events);
+        assertEquals(2, channel0Events.length);
+        assertTrue(channel0Events[0] instanceof TraceEventComponent);
+        assertTrue(channel0Events[1] instanceof TraceEventComponent);
+
+        TraceEventComponent event = (TraceEventComponent) channel0Events[0];
+        assertEquals("sched_kthread_stop_ret", event.getName());
+        assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
+        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+        assertEquals(TraceEnablement.ENABLED, event.getState());
+
+        TraceEventComponent event1 = (TraceEventComponent) channel0Events[1];
+        assertEquals("sched_kthread_stop", event1.getName());
+        assertEquals(TraceLogLevel.TRACE_EMERG, event1.getLogLevel());
+        assertEquals(TraceEventType.TRACEPOINT, event1.getEventType());
+        assertEquals(TraceEnablement.ENABLED, event1.getState());
+
+        // ------------------------------------------------------------------------
+        // Disable event components 
+        // ------------------------------------------------------------------------
+        ITraceControlComponent[] selection = { event, event1 };
+        fFacility.getControlView().setSelection(selection);
+        // Give GUI time to actually execute the selection
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        fFacility.executeCommand("disable.event");
+        fFacility.waitForJobs();
+        
+        assertEquals(TraceEnablement.DISABLED, event.getState());
+        assertEquals(TraceEnablement.DISABLED, event1.getState());
+
+        // ------------------------------------------------------------------------
+        // Enable event component 
+        // ------------------------------------------------------------------------
+        fFacility.getControlView().setSelection(event1);
+        fFacility.executeCommand("enable.event");
+        fFacility.waitForJobs();
+        
+        // Verify event state
+        assertEquals(TraceEnablement.ENABLED, event1.getState());
+        
+        // ------------------------------------------------------------------------
+        // Destroy session 
+        // ------------------------------------------------------------------------
+        destroySession(session);
+        
+        // Verify that no more session components exist
+        assertEquals(0, groups[1].getChildren().length);
+        
+
+        // ------------------------------------------------------------------------
+        // Create session
+        // ------------------------------------------------------------------------
+        fProxy.setScenario(SCEN_SCENARIO2_TEST);
+        
+        CreateSessionDialogStub sessionDialogStub = new CreateSessionDialogStub();
+        sessionDialogStub.setSessionPath("/home/user/temp");
+        TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
+
+        session = createSession(groups[1]);
+        
+        // Verify that session was created
+        assertNotNull(session);
+        assertEquals("mysession", session.getName());
+        assertEquals("/home/user/temp", session.getSessionPath());
+        assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+        
+        // ------------------------------------------------------------------------
+        // Create Channel on UST global domain
+        // ------------------------------------------------------------------------
+        TraceControlDialogFactory.getInstance().setCreateChannelOnSessionDialog(new CreateChannelOnSessionDialogStub());
+
+        fFacility.getControlView().setSelection(session);
+        // Give GUI time to actually execute refresh
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+
+        fFacility.executeCommand("createChannelOnSession");
+        fFacility.waitForJobs();
+        
+        // Verify that UST domain was created
+        domains = session.getChildren();
+        assertNotNull(domains);
+        assertEquals(1, domains.length);
+
+        assertEquals("UST global", domains[0].getName());
+        
+        // Verify that channel was created with correct data
+        channels =  domains[0].getChildren();
+        assertNotNull(channels);
+        assertEquals(1, channels.length);
+
+        assertTrue(channels[0] instanceof TraceChannelComponent);
+        channel = (TraceChannelComponent) channels[0]; 
+        assertEquals("mychannel", channel.getName());
+        assertEquals(2, channel.getNumberOfSubBuffers());
+        assertEquals("mmap()", channel.getOutputType());
+        assertEquals(false, channel.isOverwriteMode());
+        assertEquals(100, channel.getReadTimer());
+        assertEquals(TraceEnablement.ENABLED, channel.getState());
+        assertEquals(16384, channel.getSubBufferSize());
+        assertEquals(200, channel.getSwitchTimer());
+
+        // ------------------------------------------------------------------------
+        // Enable event on default channel on created session above
+        // ------------------------------------------------------------------------
+        // Get first UST provider
+        UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
+        assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName());
+        assertEquals(9379, ustProvider.getPid());
+
+        // Get events
+        events = ustProvider.getChildren();
+        assertNotNull(events);
+        assertEquals(2, events.length);
+
+        baseEventInfo0 = (BaseEventComponent) events[0];
+        baseEventInfo1 = (BaseEventComponent) events[1];
+
+        ITraceControlComponent[] ustSelection =  { baseEventInfo0, baseEventInfo1 };
+
+        fFacility.getControlView().setSelection(ustSelection);
+        // Give GUI time to actually execute refresh
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        fFacility.executeCommand("assign.event");
+        fFacility.waitForJobs();
+
+        // verify that events were created under the channel
+        // Note that domain and channel has to be re-read because the tree is re-created
+
+        domains = session.getChildren();
+
+        // Verify that channel was created with correct data
+        channels =  domains[0].getChildren();
+
+        ITraceControlComponent[] ustEvents = channels[0].getChildren();
+        assertEquals(2, ustEvents.length);
+
+        event = (TraceEventComponent) ustEvents[0];
+        assertEquals("ust_tests_hello:tptest_sighandler", event.getName());
+        assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel());
+        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+        assertEquals(TraceEnablement.ENABLED, event.getState());
+
+        event = (TraceEventComponent) ustEvents[1];
+        assertEquals("ust_tests_hello:tptest", ustEvents[1].getName());
+        assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel());
+        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+        assertEquals(TraceEnablement.ENABLED, event.getState());
+
+        // ------------------------------------------------------------------------
+        // Disable event components 
+        // ------------------------------------------------------------------------
+        fFacility.getControlView().setSelection(event);
+        // Give GUI time to actually execute the selection
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        fFacility.executeCommand("disable.event");
+        fFacility.waitForJobs();
+        
+        assertEquals(TraceEnablement.DISABLED, event.getState());
+
+        // ------------------------------------------------------------------------
+        // Enable event component 
+        // ------------------------------------------------------------------------
+        fFacility.getControlView().setSelection(event);
+        fFacility.executeCommand("enable.event");
+        fFacility.waitForJobs();
+        
+        // Verify event state
+        assertEquals(TraceEnablement.ENABLED, event.getState());
+        
+        // ------------------------------------------------------------------------
+        // Destroy session 
+        // ------------------------------------------------------------------------
+        destroySession(session);
+        
+        // Verify that no more session components exist
+        assertEquals(0, groups[1].getChildren().length);
+
+        
+//        fFacility.delay(60000);
+    }
+
+    private TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
+        fFacility.getControlView().setSelection(group);
+        // Give GUI time to actually execute the selection
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        fFacility.executeCommand("createSession");
+        fFacility.waitForJobs();
+        
+        ITraceControlComponent[] sessions = group.getChildren();
+        if ((sessions == null) || (sessions.length == 0)) {
+            return null;
+        }
+        return (TraceSessionComponent)sessions[0];
+    }
+
+    private void destroySession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
+        fFacility.getControlView().setSelection(session);
+        // Give GUI time to actually execute the selection
+        fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
+        fFacility.executeCommand("destroySession");
+        fFacility.waitForJobs();
+    }      
+        
+//        assertEquals("sched_kthread_stop_ret", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//
+//        baseEventInfo = (BaseEventComponent) events[2];
+//        assertEquals("sched_wakeup_new", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify UstProviderComponent
+//        // ------------------------------------------------------------------------
+//        UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
+//        assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName());
+//        assertEquals(9379, ustProvider.getPid());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (UST provider)
+//        // ------------------------------------------------------------------------
+//        events = ustProvider.getChildren();
+//        assertNotNull(events);
+//        assertEquals(2, events.length);
+//
+//        baseEventInfo = (BaseEventComponent) events[0];
+//        assertNotNull(baseEventInfo);
+//        assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_DEBUG_MODULE, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//
+//        baseEventInfo = (BaseEventComponent) events[1];
+//        assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_INFO, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify UstProviderComponent
+//        // ------------------------------------------------------------------------
+//        ustProvider = (UstProviderComponent) providers[2];
+//        assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName());
+//        assertEquals(4852, ustProvider.getPid());
+//        
+//        // verify getters and setter
+//        verifyUstProviderGettersSetters(ustProvider);
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (UST provider)
+//        // ------------------------------------------------------------------------
+//        events = ustProvider.getChildren();
+//        assertNotNull(events);
+//        assertEquals(2, events.length);
+//
+//        baseEventInfo = (BaseEventComponent) events[0];
+//        assertNotNull(baseEventInfo);
+//        assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_WARNING, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//
+//        baseEventInfo = (BaseEventComponent) events[1];
+//        assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
+//        assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
+//        
+//        // verify getters and setters
+//        verifyBaseEventGettersSetters(baseEventInfo);
+//        
+//        // ------------------------------------------------------------------------
+//        // Verify TraceSessionGroup
+//        // ------------------------------------------------------------------------
+//        ITraceControlComponent[] sessions = groups[1].getChildren();
+//        assertNotNull(sessions);
+//        assertEquals(2, sessions.length);
+//        for (int i = 0; i < sessions.length; i++) {
+//            assertTrue(sessions[i] instanceof TraceSessionComponent);
+//        }
+//        assertEquals("mysession1", sessions[0].getName());
+//        assertEquals("mysession", sessions[1].getName());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify TraceSessionComponent
+//        // ------------------------------------------------------------------------
+//        TraceSessionComponent session = (TraceSessionComponent)sessions[1];
+//        assertEquals("mysession", session.getName());
+//        assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session.getSessionPath());
+//        assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
+//
+//        // Verify setters and setters
+//        verifySessionGetterSetters(session);
+//        
+//        ITraceControlComponent[] domains = session.getChildren();
+//        assertNotNull(domains);
+//        assertEquals(2, domains.length);
+//        
+//        // ------------------------------------------------------------------------
+//        // Verify Kernel domain
+//        // ------------------------------------------------------------------------
+//        assertEquals("Kernel", domains[0].getName());
+//        ITraceControlComponent[] channels =  domains[0].getChildren();
+//        assertNotNull(channels);
+//        assertEquals(2, channels.length);
+//
+//        // ------------------------------------------------------------------------
+//        // Verify Kernel's channel0
+//        // ------------------------------------------------------------------------
+//        assertTrue(channels[0] instanceof TraceChannelComponent);
+//        TraceChannelComponent channel = (TraceChannelComponent) channels[0]; 
+//        assertEquals("channel0", channel.getName());
+//        assertEquals(4, channel.getNumberOfSubBuffers());
+//        assertEquals("splice()", channel.getOutputType());
+//        assertEquals(false, channel.isOverwriteMode());
+//        assertEquals(200, channel.getReadTimer());
+//        assertEquals(TraceEnablement.ENABLED, channel.getState());
+//        assertEquals(262144, channel.getSubBufferSize());
+//        assertEquals(0, channel.getSwitchTimer());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (kernel, channel0)
+//        // ------------------------------------------------------------------------
+//        ITraceControlComponent[] channel0Events = channel.getChildren();
+//        assertNotNull(channel0Events);
+//        assertEquals(5, channel0Events.length);
+//        assertTrue(channel0Events[0] instanceof TraceEventComponent);
+//        assertTrue(channel0Events[1] instanceof TraceEventComponent);
+//        assertTrue(channel0Events[2] instanceof TraceProbeEventComponent);
+//        assertTrue(channel0Events[3] instanceof TraceProbeEventComponent);
+//        assertTrue(channel0Events[4] instanceof TraceEventComponent);
+//        
+//        TraceEventComponent event = (TraceEventComponent) channel0Events[0];
+//        assertEquals("block_rq_remap", event.getName());
+//        assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        assertEquals(TraceEnablement.ENABLED, event.getState());
+//        
+//        event = (TraceEventComponent) channel0Events[1];
+//        assertEquals("block_bio_remap", event.getName());
+//        assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        assertEquals(TraceEnablement.DISABLED, event.getState());
+//
+//        TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2];
+//        assertEquals("myevent2", probeEvent.getName());
+//        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
+//        assertEquals(TraceEventType.PROBE, probeEvent.getEventType());
+//        assertEquals(TraceEnablement.ENABLED, probeEvent.getState());
+//        assertEquals("0xc0101340", probeEvent.getAddress());
+//        assertNull(probeEvent.getOffset());
+//        assertNull(probeEvent.getSymbol());
+//
+//        probeEvent = (TraceProbeEventComponent) channel0Events[3];
+//        assertEquals("myevent0", probeEvent.getName());
+//        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
+//        assertEquals(TraceEventType.PROBE, probeEvent.getEventType());
+//        assertEquals(TraceEnablement.ENABLED, probeEvent.getState());
+//        assertNull(probeEvent.getAddress());
+//        assertEquals("0x0", probeEvent.getOffset());
+//        assertEquals("init_post", probeEvent.getSymbol());
+//        
+//        event = (TraceEventComponent) channel0Events[4];
+//        assertEquals("syscalls", event.getName());
+//        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
+//        assertEquals(TraceEventType.SYSCALL, event.getEventType());
+//        assertEquals(TraceEnablement.ENABLED, event.getState());
+//        
+//        // ------------------------------------------------------------------------
+//        // Verify Kernel's channel1
+//        // ------------------------------------------------------------------------
+//        assertEquals("channel1", channels[1].getName());
+//        channel = (TraceChannelComponent) channels[1]; 
+//        assertEquals(4, channel.getNumberOfSubBuffers());
+//        assertEquals("splice()", channel.getOutputType());
+//        assertEquals(true, channel.isOverwriteMode());
+//        assertEquals(400, channel.getReadTimer());
+//        assertEquals(TraceEnablement.DISABLED, channel.getState());
+//        assertEquals(524288, channel.getSubBufferSize());
+//        assertEquals(100, channel.getSwitchTimer());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (kernel, channel1)
+//        // ------------------------------------------------------------------------
+//        ITraceControlComponent[] channel1Events = channels[1].getChildren();
+//        assertEquals(0, channel1Events.length);
+//
+//        // ------------------------------------------------------------------------
+//        // Verify domain UST global
+//        // ------------------------------------------------------------------------
+//        assertEquals("UST global", domains[1].getName());
+//        
+//        ITraceControlComponent[] ustChannels = domains[1].getChildren();
+//        
+//        for (int i = 0; i < ustChannels.length; i++) {
+//            assertTrue(ustChannels[i] instanceof TraceChannelComponent);
+//        }
+//
+//        // ------------------------------------------------------------------------
+//        // Verify UST global's mychannel1
+//        // ------------------------------------------------------------------------
+//        channel = (TraceChannelComponent) ustChannels[0]; 
+//        assertEquals("mychannel1", channel.getName());
+//        assertEquals(8, channel.getNumberOfSubBuffers());
+//        assertEquals("mmap()", channel.getOutputType());
+//        assertEquals(true, channel.isOverwriteMode());
+//        assertEquals(100, channel.getReadTimer());
+//        assertEquals(TraceEnablement.DISABLED, channel.getState());
+//        assertEquals(8192, channel.getSubBufferSize());
+//        assertEquals(200, channel.getSwitchTimer());
+//        
+//        // verify getters and setters 
+//        verifyChannelGettersSetters(channel);
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (UST global, mychannel1)
+//        // ------------------------------------------------------------------------
+//        ITraceControlComponent[] ustEvents = channel.getChildren();
+//        assertEquals(0, ustEvents.length);
+//
+//        // ------------------------------------------------------------------------
+//        // Verify UST global's channel0
+//        // ------------------------------------------------------------------------
+//        channel = (TraceChannelComponent) ustChannels[1];
+//        assertEquals("channel0", channel.getName());
+//        assertEquals(4, channel.getNumberOfSubBuffers());
+//        assertEquals("mmap()", channel.getOutputType());
+//        assertEquals(false, channel.isOverwriteMode());
+//        assertEquals(200, channel.getReadTimer());
+//        assertEquals(TraceEnablement.ENABLED, channel.getState());
+//        assertEquals(4096, channel.getSubBufferSize());
+//        assertEquals(0, channel.getSwitchTimer());
+//
+//        // ------------------------------------------------------------------------
+//        // Verify event info (UST global, channel0)
+//        // ------------------------------------------------------------------------
+//        ustEvents = channel.getChildren();
+//        assertEquals(2, ustEvents.length);
+//        
+//        event = (TraceEventComponent) ustEvents[0];
+//        assertEquals("ust_tests_hello:tptest_sighandler", event.getName());
+//        assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        assertEquals(TraceEnablement.DISABLED, event.getState());
+//        
+//        event = (TraceEventComponent) ustEvents[1];
+//        assertEquals("*", ustEvents[1].getName());
+//        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        assertEquals(TraceEnablement.ENABLED, event.getState());
+//        
+//        // verify getters and setters
+//        verifyEventGettersSetters(event);
+//        
+//        // disconnect
+//        node.disconnect();
+//        assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
+//        assertNotNull(node.getImage());
+//        assertNotSame(connectedImage, node.getImage());
+//    }
+//    
+//    private void verifySessionGetterSetters(TraceSessionComponent session) {
+//        // save original values
+//        String name = session.getName();
+//        String origPath = session.getSessionPath();
+//        TraceSessionState origState = session.getSessionState();
+//
+//        // test cases
+//        session.setName("newName");
+//        assertEquals("newName", session.getName());
+//        
+//        session.setSessionPath("/home/user/tmp");
+//        assertEquals("/home/user/tmp", session.getSessionPath());
+//
+//        session.setSessionState(TraceSessionState.INACTIVE);
+//        assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
+//        Image inactiveImage = session.getImage();
+//        assertNotNull(inactiveImage);
+//        
+//        session.setSessionState("active");
+//        assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
+//
+//        Image activeImage = session.getImage();
+//        assertNotNull(activeImage);
+//        assertNotSame(activeImage, inactiveImage);
+//
+//        
+//        // restore original values      
+//        session.setName(name);
+//        session.setSessionPath(origPath);
+//        session.setSessionState(origState);
+//    }
+//
+//    private void verifyBaseEventGettersSetters(BaseEventComponent event) {
+//        // save original values
+//        String name =  event.getName();
+//        TraceLogLevel level = event.getLogLevel();
+//        TraceEventType type = event.getEventType();
+//        
+//        // test cases
+//        event.setName("newName");
+//        assertEquals("newName", event.getName());
+//        
+//        event.setLogLevel(TraceLogLevel.TRACE_INFO);
+//        assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel());
+//        event.setLogLevel("TRACE_ALERT");
+//        assertEquals(TraceLogLevel.TRACE_ALERT, event.getLogLevel());
+//
+//        event.setEventType(TraceEventType.UNKNOWN);
+//        assertEquals(TraceEventType.UNKNOWN, event.getEventType());
+//        event.setEventType("tracepoint");
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        
+//        // restore original values
+//        event.setName(name);
+//        event.setLogLevel(level);
+//        event.setEventType(type);
+//    }
+//    
+//    private void verifyEventGettersSetters(TraceEventComponent event) {
+//        // save original values
+//        String name =  event.getName();
+//        TraceLogLevel level = event.getLogLevel();
+//        TraceEventType type = event.getEventType();
+//        TraceEnablement state = event.getState();
+//        
+//        // test cases
+//        event.setName("newName");
+//        assertEquals("newName", event.getName());
+//        
+//        event.setLogLevel(TraceLogLevel.TRACE_INFO);
+//        assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel());
+//        event.setLogLevel("TRACE_ALERT");
+//        assertEquals(TraceLogLevel.TRACE_ALERT, event.getLogLevel());
+//
+//        event.setEventType(TraceEventType.UNKNOWN);
+//        assertEquals(TraceEventType.UNKNOWN, event.getEventType());
+//        event.setEventType("tracepoint");
+//        assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
+//        
+//        event.setState("disabled");
+//        assertEquals(TraceEnablement.DISABLED, event.getState());
+//        
+//        Image disabledImage = event.getImage();
+//        assertNotNull(disabledImage);
+//
+//        event.setState(TraceEnablement.ENABLED);
+//        assertEquals(TraceEnablement.ENABLED, event.getState());
+//
+//        Image enabledImage = event.getImage();
+//        assertNotNull(enabledImage);
+//        assertNotSame(enabledImage, disabledImage);
+//
+//        // restore original values
+//        event.setName(name);
+//        event.setLogLevel(level);
+//        event.setEventType(type);
+//        event.setState(state);
+//    }
+//    
+//    private void verifyChannelGettersSetters(TraceChannelComponent channel) {
+//        // save original values
+//        String name = channel.getName();
+//        int nbSubBuffers = channel.getNumberOfSubBuffers();
+//        String type = channel.getOutputType();
+//        boolean mode = channel.isOverwriteMode();
+//        long readTimer = channel.getReadTimer();
+//        TraceEnablement state =  channel.getState();
+//        long subBufferSize = channel.getSubBufferSize();
+//        long switchTimer = channel.getSwitchTimer();
+//        
+//        // test cases
+//        channel.setName("newName");
+//        assertEquals("newName", channel.getName());
+//        
+//        channel.setNumberOfSubBuffers(2);
+//        assertEquals(2, channel.getNumberOfSubBuffers());
+//        
+//        channel.setOutputType("splice()");
+//        assertEquals("splice()", channel.getOutputType());
+//        
+//        channel.setOverwriteMode(false);
+//        assertEquals(false, channel.isOverwriteMode());
+//        
+//        channel.setReadTimer(250);
+//        assertEquals(250, channel.getReadTimer());
+//        
+//        channel.setState("enabled");
+//        assertEquals(TraceEnablement.ENABLED, channel.getState());
+//        
+//        Image enabledImage = channel.getImage();
+//        assertNotNull(enabledImage);
+//        channel.setState(TraceEnablement.DISABLED);
+//        assertEquals(TraceEnablement.DISABLED, channel.getState());
+//
+//        Image disabledImage = channel.getImage();
+//        assertNotNull(disabledImage);
+//        assertNotSame(enabledImage, disabledImage);
+//        
+//        channel.setSubBufferSize(1024);
+//        assertEquals(1024, channel.getSubBufferSize());
+//        
+//        channel.setSwitchTimer(1000);
+//        assertEquals(1000, channel.getSwitchTimer());
+//
+//        // restore original values
+//        channel.setName(name);
+//        channel.setNumberOfSubBuffers(nbSubBuffers);
+//        channel.setOutputType(type);
+//        channel.setOverwriteMode(mode);
+//        channel.setReadTimer(readTimer);
+//        channel.setState(state);
+//        channel.setSubBufferSize(subBufferSize);
+//        channel.setSwitchTimer(switchTimer);
+//    }
+//    
+//    private void verifyUstProviderGettersSetters(UstProviderComponent ustProvider) {
+//        // save original values
+//        String name = ustProvider.getName();
+//        int pid = ustProvider.getPid();
+//        
+//        // test cases
+//        ustProvider.setName("newName");
+//        assertEquals("newName", ustProvider.getName());
+//
+//        ustProvider.setPid(9876);
+//        assertEquals(9876, ustProvider.getPid());
+//        
+//        // restore original values
+//        ustProvider.setName(name);
+//        ustProvider.setPid(pid);
+//    }
+
+    public class CreateSessionDialogStub implements ICreateSessionDialog {
+        public String fPath = null;
+        
+        @Override
+        public String getSessionName() {
+            return "mysession";
+        }
+
+        @Override
+        public String getSessionPath() {
+            return fPath;
+        }
+
+        @Override
+        public boolean isDefaultSessionPath() {
+            return fPath == null;
+        }
+
+        @Override
+        public void setTraceSessionGroup(TraceSessionGroup group) {
+
+        }
+
+        @Override
+        public int open() {
+            return 0;
+        }
+        
+        public void setSessionPath(String path) {
+            fPath = path;
+        }
+    }
+
+    public class GetEventInfoDialogStub implements IGetEventInfoDialog {
+
+        private TraceSessionComponent[] fSessions;
+        
+        @Override
+        public TraceSessionComponent getSession() {
+            return fSessions[0];
+        }
+
+        @Override
+        public TraceChannelComponent getChannel() {
+            return null;
+        }
+
+        @Override
+        public void setIsKernel(boolean isKernel) {
+        }
+
+        @Override
+        public void setSessions(TraceSessionComponent[] sessions) {
+            fSessions = sessions;
+        }
+
+        @Override
+        public int open() {
+            return 0;
+        }
+    }
+    
+    public class DestroyConfirmDialogStub implements IConfirmDialog {
+
+        @Override
+        public boolean openConfirm(Shell parent, String title, String message) {
+            return true;
+        }
+    }
+    
+    public class CreateChannelOnSessionDialogStub implements ICreateChannelOnSessionDialog {
+
+        @Override
+        public IChannelInfo getChannelInfo() {
+            ChannelInfo info = new ChannelInfo("mychannel");
+            info.setNumberOfSubBuffers(2);
+            info.setOverwriteMode(false);
+            info.setReadTimer(100);
+            info.setSwitchTimer(200);
+            info.setSubBufferSize(16384);
+            return info;
+        }
+
+        @Override
+        public void setDomainComponent(TraceDomainComponent domain) {
+        }
+
+        @Override
+        public int open() {
+            return 0;
+        }
+
+        @Override
+        public boolean isKernel() {
+            return false;
+        }
+        
+    }
+}
\ No newline at end of file
index 9dc19ae41e3e3f74448274844d00a100bddb049c..45331790bf5696da72ee7c0bf8559003d33024c0 100644 (file)
  *******************************************************************************/
 package org.eclipse.linuxtools.lttng.ui.tests.control.model.component;
 
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
 
 /**
  *  Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides
@@ -31,6 +38,8 @@ public class TraceControlTestFacility {
     final static public int WAIT_FOR_JOBS_DELAY = 1000; 
     final static public int GUI_REFESH_DELAY = 500;
     
+    final static public String COMMAND_CATEGORY_PREFIX = "org.eclipse.linuxtools.lttng.ui.commands.control."; //$NON-NLS-1$
+    
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -124,4 +133,11 @@ public class TraceControlTestFacility {
     public ControlView getControlView() {
         return fControlView;
     }
+
+    public void executeCommand(String commandId) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
+//        ICommandService commandService = (ICommandService) fControlView.getSite().getService(ICommandService.class);
+        IHandlerService handlerService = (IHandlerService) fControlView.getSite().getService(IHandlerService.class);
+        handlerService.executeCommand(COMMAND_CATEGORY_PREFIX + commandId, null);
+    }
+
 }
index 48764a198e5a48735a99e414b376ff632fe80cfc..691c7b15a32045257e1b72e95bdc6113f0901625 100644 (file)
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.tests.control.model.component;
 
+import java.io.File;
+import java.net.URL;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.lttng.stubs.service.TestRemoteSystemProxy;
-import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.lttng.ui.tests.LTTngUITestPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TargetNodeState;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
@@ -27,20 +32,18 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventCompone
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComponent;
-import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProbeEventComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProviderGroup;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent;
-import org.eclipse.linuxtools.lttng.ui.views.control.property.TargetNodePropertySource;
 import org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService;
 import org.eclipse.linuxtools.lttng.ui.views.control.service.LTTngControlService;
 import org.eclipse.rse.core.model.Host;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.rse.internal.core.model.SystemProfile;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.views.properties.IPropertySource;
 import org.junit.After;
 import org.junit.Before;
 
@@ -50,10 +53,17 @@ import org.junit.Before;
 @SuppressWarnings("nls")
 public class TraceControlTreeModelTest extends TestCase {
     
+    private static final String DIRECTORY   = "testfiles";
+    private static final String TEST_STREAM = "ListInfoTest.cfg";
+    private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
+    
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
     
+    private TestRemoteSystemProxy fProxy;
+    private String fTestFile; 
+    
     // ------------------------------------------------------------------------
     // Static methods
     // ------------------------------------------------------------------------
@@ -80,6 +90,10 @@ public class TraceControlTreeModelTest extends TestCase {
     @Override
     @Before
     public void setUp() throws Exception {
+        fProxy = new TestRemoteSystemProxy();
+        URL location = FileLocator.find(LTTngUITestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+        File testfile = new File(FileLocator.toFileURL(location).toURI());
+        fTestFile = testfile.getAbsolutePath();
     }
 
     /**
@@ -100,15 +114,16 @@ public class TraceControlTreeModelTest extends TestCase {
     public void testTraceControlComponents()
         throws Exception {
         
-        TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
-
+        fProxy.setTestFile(fTestFile);
+        fProxy.setScenario(SCEN_LIST_INFO_TEST);
+        
         ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
 
         @SuppressWarnings("restriction")
         IHost host = new Host(new SystemProfile("myProfile", true));
         host.setHostName("127.0.0.1");
 
-        TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, proxy);
+        TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
 
         root.addChild(node);
         node.connect();
@@ -290,9 +305,12 @@ public class TraceControlTreeModelTest extends TestCase {
         // ------------------------------------------------------------------------
         ITraceControlComponent[] channel0Events = channel.getChildren();
         assertNotNull(channel0Events);
-        assertEquals(2, channel0Events.length);
+        assertEquals(5, channel0Events.length);
         assertTrue(channel0Events[0] instanceof TraceEventComponent);
         assertTrue(channel0Events[1] instanceof TraceEventComponent);
+        assertTrue(channel0Events[2] instanceof TraceProbeEventComponent);
+        assertTrue(channel0Events[3] instanceof TraceProbeEventComponent);
+        assertTrue(channel0Events[4] instanceof TraceEventComponent);
         
         TraceEventComponent event = (TraceEventComponent) channel0Events[0];
         assertEquals("block_rq_remap", event.getName());
@@ -306,6 +324,30 @@ public class TraceControlTreeModelTest extends TestCase {
         assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
         assertEquals(TraceEnablement.DISABLED, event.getState());
 
+        TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2];
+        assertEquals("myevent2", probeEvent.getName());
+        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
+        assertEquals(TraceEventType.PROBE, probeEvent.getEventType());
+        assertEquals(TraceEnablement.ENABLED, probeEvent.getState());
+        assertEquals("0xc0101340", probeEvent.getAddress());
+        assertNull(probeEvent.getOffset());
+        assertNull(probeEvent.getSymbol());
+
+        probeEvent = (TraceProbeEventComponent) channel0Events[3];
+        assertEquals("myevent0", probeEvent.getName());
+        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
+        assertEquals(TraceEventType.PROBE, probeEvent.getEventType());
+        assertEquals(TraceEnablement.ENABLED, probeEvent.getState());
+        assertNull(probeEvent.getAddress());
+        assertEquals("0x0", probeEvent.getOffset());
+        assertEquals("init_post", probeEvent.getSymbol());
+        
+        event = (TraceEventComponent) channel0Events[4];
+        assertEquals("syscalls", event.getName());
+        assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
+        assertEquals(TraceEventType.SYSCALL, event.getEventType());
+        assertEquals(TraceEnablement.ENABLED, event.getState());
+        
         // ------------------------------------------------------------------------
         // Verify Kernel's channel1
         // ------------------------------------------------------------------------
index 69d35da7ba569a470fd98c08a7064d77b9898c19..059bc9b6e386b9f8c401420a0368d671d2bb3d74 100644 (file)
@@ -23,6 +23,7 @@ public class AllTests {
         suite.addTestSuite(BaseEventInfoTest.class);
         suite.addTestSuite(DomainInfoTest.class);
         suite.addTestSuite(EventInfoTest.class);
+        suite.addTestSuite(ProbeEventInfoTest.class);
         suite.addTestSuite(ChannelInfoTest.class);
         suite.addTestSuite(SessionInfoTest.class);
         suite.addTestSuite(TraceInfoTest.class);
index 581cb12d626ff02fcb0db8345541ccddedfcb39f..305f48c2c00a2f0ba8bf7acd2061f604ab4a6b7d 100644 (file)
@@ -15,6 +15,7 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IUstProviderInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
@@ -25,6 +26,7 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.DomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.EventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ProbeEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.SessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderInfo;
 
@@ -47,6 +49,8 @@ public class ModelImplFactory {
     private IBaseEventInfo fBaseEventInfo2 = null;
     private IUstProviderInfo fUstProviderInfo1 = null;
     private IUstProviderInfo fUstProviderInfo2 = null;
+    private IProbeEventInfo fProbeEventInfo1 = null;
+    private IProbeEventInfo fProbeEventInfo2 = null;
     
     public ModelImplFactory() {
         fBaseEventInfo1 = new BaseEventInfo("event1");
@@ -115,6 +119,17 @@ public class ModelImplFactory {
         fSessionInfo2.setSessionState(TraceSessionState.INACTIVE);
         fSessionInfo2.addDomain(fDomainInfo1);
         fSessionInfo2.addDomain(fDomainInfo2);
+
+        fProbeEventInfo1 = new ProbeEventInfo("probeEvent1");
+        fProbeEventInfo1.setEventType(TraceEventType.TRACEPOINT);
+        fProbeEventInfo1.setState(TraceEnablement.ENABLED);
+        fProbeEventInfo1.setAddress("0xc1231234");
+
+        fProbeEventInfo2 = new ProbeEventInfo("probeEvent2");
+        fProbeEventInfo2.setEventType(TraceEventType.UNKNOWN);
+        fProbeEventInfo2.setState(TraceEnablement.DISABLED);
+        fProbeEventInfo2.setOffset("0x100");
+        fProbeEventInfo2.setSymbol("init_post");
     }
     
     public ISessionInfo getSessionInfo1() {
@@ -168,4 +183,13 @@ public class ModelImplFactory {
     public IUstProviderInfo getUstProviderInfo2() {
         return fUstProviderInfo2;
     }
+    
+    public IProbeEventInfo getProbeEventInfo1() {
+        return fProbeEventInfo1;
+    }
+
+    public IProbeEventInfo getProbeEventInfo2() {
+        return fProbeEventInfo2;
+    }
+
 }
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/impl/ProbeEventInfoTest.java b/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/impl/ProbeEventInfoTest.java
new file mode 100644 (file)
index 0000000..6476561
--- /dev/null
@@ -0,0 +1,208 @@
+/**********************************************************************
+ * 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.ui.tests.control.model.impl;
+
+import junit.framework.TestCase;
+
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.EventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ProbeEventInfo;
+
+/**
+ * The class <code>BaseEventInfoTest</code> contains test for the class <code>{@link BaseEventInfo}</code>.
+ */
+@SuppressWarnings("nls")
+public class ProbeEventInfoTest extends TestCase {
+
+    // ------------------------------------------------------------------------
+    // Test data
+    // ------------------------------------------------------------------------
+    private IProbeEventInfo fEventInfo1 = null;
+    private IProbeEventInfo fEventInfo2 = null;
+   
+    // ------------------------------------------------------------------------
+    // Housekeeping
+    // ------------------------------------------------------------------------
+    /**
+     * Perform pre-test initialization.
+     *
+     * @throws Exception if the initialization fails for some reason
+     *
+     */
+    @Override
+    public void setUp() throws Exception {
+        ModelImplFactory factory = new ModelImplFactory();
+        fEventInfo1 = factory.getProbeEventInfo1();
+        fEventInfo2 = factory.getProbeEventInfo2();
+    }
+
+    /**
+     * Perform post-test clean-up.
+     *
+     * @throws Exception if the clean-up fails for some reason
+     *
+     */
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    // ------------------------------------------------------------------------
+    // Tests
+    // ------------------------------------------------------------------------
+
+    /**
+     * Run the BaseEventInfo() constructor test.
+     *
+     */
+    public void testBaseEventInfo() {
+        ProbeEventInfo fixture = new ProbeEventInfo("event");
+        assertNotNull(fixture);
+        
+        TraceEventType result = fixture.getEventType();
+        
+        assertEquals("event", fixture.getName());
+        assertEquals("unknown", result.getInName());
+        assertEquals("UNKNOWN", result.name());
+        assertEquals("UNKNOWN", result.toString());
+        assertEquals(3, result.ordinal());
+        
+        TraceEnablement state = fixture.getState();
+        assertEquals("disabled", state.getInName());
+        assertEquals("DISABLED", state.name());
+        assertEquals("DISABLED", state.toString());
+        assertEquals(0, state.ordinal());
+        
+        assertNull(fixture.getAddress());
+        assertNull(fixture.getOffset());
+        assertNull(fixture.getSymbol());
+    }
+
+    /**
+     * Test Copy Constructor
+     */
+    public void testEventInfoCopy() {
+        ProbeEventInfo info = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+        
+        assertEquals(fEventInfo1.getName(), info.getName());
+        assertEquals(fEventInfo1.getEventType(), info.getEventType());
+        assertEquals(fEventInfo1.getState(), info.getState());
+        assertEquals(fEventInfo1.getAddress(), info.getAddress());
+        assertEquals(fEventInfo1.getOffset(), info.getOffset());
+        assertEquals(fEventInfo1.getSymbol(), info.getSymbol());
+    }
+
+    /**
+     * Test Copy Constructor
+     */
+    public void testEventCopy2() {
+        try {
+            ProbeEventInfo info = null;
+            new ProbeEventInfo(info);
+            fail("null copy");
+        }
+        catch (IllegalArgumentException e) {
+            // Success
+        }
+    }
+    
+    /**
+     *  Getter/Setter tests 
+     */
+    public void testGetAndSetter() {
+        ProbeEventInfo fixture = new ProbeEventInfo("event");
+        
+        // Make sure that ProbeEventInfo extends EventInfo
+        // -> so we don't need to re-test common parts
+        assertTrue(fixture instanceof EventInfo);
+        
+        fixture.setAddress("0xc12344321");
+        String result = fixture.getAddress();
+
+        assertNotNull(result);
+        assertEquals("0xc12344321", result);
+
+        fixture.setOffset("0x1000");
+        result = fixture.getOffset();
+
+        assertNotNull(result);
+        assertEquals("0x1000", result);
+
+        fixture.setSymbol("cpu_idle");
+        result = fixture.getSymbol();
+
+        assertNotNull(result);
+        assertEquals("cpu_idle", result);
+    }
+
+    /**
+     * Run the String toString() method test.
+     */
+    public void testToString_1() {
+        assertEquals("[ProbeEventInfo([EventInfo([BaseEventInfo([TraceInfo(Name=probeEvent1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)],fAddress=0xc1231234)]", fEventInfo1.toString());
+        assertEquals("[ProbeEventInfo([EventInfo([BaseEventInfo([TraceInfo(Name=probeEvent2)],type=UNKNOWN,level=TRACE_DEBUG)],State=DISABLED)],fOffset=0x100,fSymbol=init_post)]", fEventInfo2.toString());
+    }
+
+    // ------------------------------------------------------------------------
+    // equals
+    // ------------------------------------------------------------------------
+    public void testEqualsReflexivity() {
+        assertTrue("equals", fEventInfo1.equals(fEventInfo1));
+        assertTrue("equals", fEventInfo2.equals(fEventInfo2));
+
+        assertTrue("equals", !fEventInfo1.equals(fEventInfo2));
+        assertTrue("equals", !fEventInfo2.equals(fEventInfo1));
+    }
+    
+    public void testEqualsSymmetry() {
+        ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+        ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo2);
+
+        assertTrue("equals", info1.equals(fEventInfo1));
+        assertTrue("equals", fEventInfo1.equals(info1));
+
+        assertTrue("equals", info2.equals(fEventInfo2));
+        assertTrue("equals", fEventInfo2.equals(info2));
+    }
+    
+    public void testEqualsTransivity() {
+        ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+        ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+        ProbeEventInfo info3 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+
+        assertTrue("equals", info1.equals(info2));
+        assertTrue("equals", info2.equals(info3));
+        assertTrue("equals", info1.equals(info3));
+    }
+    
+    public void testEqualsNull() {
+        assertTrue("equals", !fEventInfo1.equals(null));
+        assertTrue("equals", !fEventInfo2.equals(null));
+    }
+    
+    // ------------------------------------------------------------------------
+    // hashCode
+    // ------------------------------------------------------------------------
+
+    public void testHashCode() {
+        ProbeEventInfo info1 = new ProbeEventInfo((ProbeEventInfo)fEventInfo1);
+        ProbeEventInfo info2 = new ProbeEventInfo((ProbeEventInfo)fEventInfo2);
+
+        assertTrue("hashCode", fEventInfo1.hashCode() == info1.hashCode());
+        assertTrue("hashCode", fEventInfo2.hashCode() == info2.hashCode());
+
+        assertTrue("hashCode", fEventInfo1.hashCode() != info2.hashCode());
+        assertTrue("hashCode", fEventInfo2.hashCode() != info1.hashCode());
+    }
+}
\ No newline at end of file
index e4b979a42d787528cd76362e320734bc23554221..b7bfb701363d3b3129aa0d314c3aaf73aab97f70 100644 (file)
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.tests.control.service;
 
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.TestCase;
 
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.lttng.stubs.service.CommandShellFactory;
+import org.eclipse.linuxtools.lttng.stubs.service.shells.LTTngToolsFileShell;
+import org.eclipse.linuxtools.lttng.ui.tests.LTTngUITestPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IUstProviderInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService;
 import org.eclipse.linuxtools.lttng.ui.views.control.service.LTTngControlService;
 /**
@@ -36,10 +44,33 @@ import org.eclipse.linuxtools.lttng.ui.views.control.service.LTTngControlService
  */
 @SuppressWarnings("nls")
 public class LTTngControlServiceTest extends TestCase {
+
+    private static final String DIRECTORY   = "testfiles";
+    private static final String TEST_STREAM = "LTTngServiceTest.cfg";
+    
+    private static final String SCEN_LTTNG_NOT_INSTALLED = "LttngNotInstalled";
+    private static final String SCEN_NO_SESSION_AVAILABLE = "NoSessionAvailable";
+    private static final String SCEN_GET_SESSION_NAMES1 = "GetSessionNames1";
+    private static final String SCEN_GET_SESSION_NAME_NOT_EXIST = "GetSessionNameNotExist";
+    private static final String SCEN_GET_SESSION_GARBAGE_OUT = "GetSessionGarbageOut";
+    private static final String SCEN_GET_SESSION1 = "GetSession1";
+    private static final String SCEN_GET_KERNEL_PROVIDER1 = "GetKernelProvider1";
+    private static final String SCEN_GET_UST_PROVIDER1 = "GetUstProvider1";
+    private static final String SCEN_GET_UST_PROVIDER2 = "GetUstProvider2";
+    private static final String SCEN_CREATE_SESSION1 = "CreateSession1";
+    private static final String SCEN_CREATE_SESSION_VARIANTS = "CreateSessionVariants";
+    private static final String SCEN_DESTROY_SESSION1 = "DestroySession1";
+    private static final String SCEN_CHANNEL_HANDLING = "ChannelHandling";
+    private static final String SCEN_EVENT_HANDLING = "EventHandling";
+
     // ------------------------------------------------------------------------
     // Test data
     // ------------------------------------------------------------------------
-    private CommandShellFactory fShellFactory; 
+    private CommandShellFactory fShellFactory;
+    private String fTestfile;
+    private LTTngToolsFileShell fShell;
+    private ILttngControlService fService;
+
     
    // ------------------------------------------------------------------------
     // Static methods
@@ -58,6 +89,14 @@ public class LTTngControlServiceTest extends TestCase {
     public void setUp() throws Exception {
         super.setUp();
         fShellFactory = CommandShellFactory.getInstance();
+
+        URL location = FileLocator.find(LTTngUITestPlugin.getDefault().getBundle(), new Path(DIRECTORY + File.separator + TEST_STREAM), null);
+        File testfile = new File(FileLocator.toFileURL(location).toURI());
+        fTestfile = testfile.getAbsolutePath();
+        
+        fShell = fShellFactory.getFileShell();
+        fShell.loadScenarioFile(fTestfile);
+        fService = new LTTngControlService(fShell);
     }
 
     /**
@@ -76,10 +115,9 @@ public class LTTngControlServiceTest extends TestCase {
     
     public void testGetSessionNames() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForLttngNotExistsShell());
-            service.getSessionNames(new NullProgressMonitor());
+            fShell.setScenario(SCEN_LTTNG_NOT_INSTALLED);
+            fService.getSessionNames(new NullProgressMonitor());
             fail("No exeption thrown");
-            
         } catch (ExecutionException e) {
          // success
         }
@@ -87,8 +125,8 @@ public class LTTngControlServiceTest extends TestCase {
     
     public void testGetSessionNames1() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForNoSessionNames());
-            String[] result = service.getSessionNames(new NullProgressMonitor());
+            fShell.setScenario(SCEN_NO_SESSION_AVAILABLE);
+            String[] result = fService.getSessionNames(new NullProgressMonitor());
 
             assertNotNull(result);
             assertEquals(0, result.length);
@@ -97,11 +135,11 @@ public class LTTngControlServiceTest extends TestCase {
             fail(e.toString());
         }
     }
-    
+
     public void testGetSessionNames2() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            String[] result = service.getSessionNames(new NullProgressMonitor());
+            fShell.setScenario(SCEN_GET_SESSION_NAMES1);
+            String[] result = fService.getSessionNames(new NullProgressMonitor());
 
             assertNotNull(result);
             assertEquals(2, result.length);
@@ -112,11 +150,11 @@ public class LTTngControlServiceTest extends TestCase {
             fail(e.toString());
         }
     }
-    
+
     public void testGetSessionNotExist() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNotExists());
-            service.getSessionNames(new NullProgressMonitor());
+            fShell.setScenario(SCEN_GET_SESSION_NAME_NOT_EXIST);
+            fService.getSessionNames(new NullProgressMonitor());
             fail("No exeption thrown");
             
         } catch (ExecutionException e) {
@@ -126,8 +164,8 @@ public class LTTngControlServiceTest extends TestCase {
     
     public void testGetSessionNameGarbage() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionGarbage());
-            String[] result = service.getSessionNames(new NullProgressMonitor());
+            fShell.setScenario(SCEN_GET_SESSION_GARBAGE_OUT);
+            String[] result = fService.getSessionNames(new NullProgressMonitor());
 
             assertNotNull(result);
             assertEquals(0, result.length);
@@ -139,8 +177,8 @@ public class LTTngControlServiceTest extends TestCase {
     
     public void testGetSession1() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            ISessionInfo session = service.getSession("mysession", new NullProgressMonitor());
+            fShell.setScenario(SCEN_GET_SESSION1);
+            ISessionInfo session = fService.getSession("mysession", new NullProgressMonitor());
 
             // Verify Session
             assertNotNull(session);
@@ -240,7 +278,7 @@ public class LTTngControlServiceTest extends TestCase {
             assertEquals(TraceEnablement.ENABLED, ustEvents[1].getState());
             
             // next session (no detailed information available)
-            session = service.getSession("mysession1", new NullProgressMonitor());
+            session = fService.getSession("mysession1", new NullProgressMonitor());
             assertNotNull(session);
             assertEquals("mysession1", session.getName());
             assertEquals("/home/user/lttng-traces/mysession1-20120203-133225", session.getSessionPath());
@@ -256,8 +294,8 @@ public class LTTngControlServiceTest extends TestCase {
 
     public void testGetKernelProvider() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            List<IBaseEventInfo> events = service.getKernelProvider(new NullProgressMonitor());
+            fShell.setScenario(SCEN_GET_KERNEL_PROVIDER1);
+            List<IBaseEventInfo> events = fService.getKernelProvider(new NullProgressMonitor());
 
             // Verify event info
             assertNotNull(events);
@@ -286,8 +324,8 @@ public class LTTngControlServiceTest extends TestCase {
 
     public void testGetUstProvider() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            List<IUstProviderInfo> providers = service.getUstProvider();
+            fShell.setScenario(SCEN_GET_UST_PROVIDER1);
+            List<IUstProviderInfo> providers = fService.getUstProvider();
 
             // Check all providers
             assertNotNull(providers);
@@ -337,11 +375,11 @@ public class LTTngControlServiceTest extends TestCase {
             fail(e.toString());
         }
     }
-    
+
     public void testUstProvider2() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForNoUstProvider());
-            List<IUstProviderInfo> providers = service.getUstProvider();
+            fShell.setScenario(SCEN_GET_UST_PROVIDER2);
+            List<IUstProviderInfo> providers = fService.getUstProvider();
 
             assertNotNull(providers);
             assertEquals(0, providers.size());
@@ -350,11 +388,12 @@ public class LTTngControlServiceTest extends TestCase {
             fail(e.toString());
         }
     }
-    
+
     public void testCreateSession() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            ISessionInfo info = service.createSession("mysession2", null, new NullProgressMonitor());
+            fShell.setScenario(SCEN_CREATE_SESSION1);
+
+            ISessionInfo info = fService.createSession("mysession2", null, new NullProgressMonitor());
             assertNotNull(info);
             assertEquals("mysession2", info.getName());
             assertNotNull(info.getSessionPath());
@@ -364,32 +403,34 @@ public class LTTngControlServiceTest extends TestCase {
             fail(e.toString());
         }
     }
-    
-    public void testCreateSessionErrors() {
-        ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionErrors());
+
+    public void testCreateSessionVariants() {
+
+        fShell.setScenario(SCEN_CREATE_SESSION_VARIANTS);
+
         try {
-            service.createSession("alreadyExist", null, new NullProgressMonitor());
+            fService.createSession("alreadyExist", null, new NullProgressMonitor());
             fail("No exeption thrown");
         } catch (ExecutionException e) {
             // success
         }
         
         try {
-            service.createSession("wrongName", null, new NullProgressMonitor());
+            fService.createSession("wrongName", null, new NullProgressMonitor());
             fail("No exeption thrown");
         } catch (ExecutionException e) {
             // success
         } 
 
         try {
-            service.createSession("wrongPath", "/home/user/hallo", new NullProgressMonitor());
+            fService.createSession("withPath", "/home/user/hallo", new NullProgressMonitor());
             fail("No exeption thrown");
         } catch (ExecutionException e) {
             // success
         } 
 
         try {
-            ISessionInfo info = service.createSession("session with spaces", null, new NullProgressMonitor());
+            ISessionInfo info = fService.createSession("session with spaces", null, new NullProgressMonitor());
             assertNotNull(info);
             assertEquals("session with spaces", info.getName());
             assertNotNull(info.getSessionPath());
@@ -401,7 +442,7 @@ public class LTTngControlServiceTest extends TestCase {
         } 
 
         try {
-            ISessionInfo info = service.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor());
+            ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor());
             assertNotNull(info);
             assertEquals("pathWithSpaces", info.getName());
             assertNotNull(info.getSessionPath());
@@ -415,31 +456,202 @@ public class LTTngControlServiceTest extends TestCase {
 
     public void testDestroySession() {
         try {
-            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-            service.destroySession("mysession2", new NullProgressMonitor());
+            fShell.setScenario(SCEN_DESTROY_SESSION1);
+            fService.destroySession("mysession2", new NullProgressMonitor());
         } catch (ExecutionException e) {
             fail(e.toString());
         } 
     }
+
+    public void testCreateChannel() {
+        try {
+
+            String sessionName = "mysession2";
+            List<String> list = new ArrayList<String>();
+            String kernelChannel0 = "mychannel0";
+            String kernelChannel1 = "mychannel1";
+            list.add(kernelChannel0);
+            list.add(kernelChannel1);
+            
+            fShell.setScenario(SCEN_CHANNEL_HANDLING);
+            
+            // Create/enable/configure 2 kernel channels
+            ChannelInfo chanInfo = new ChannelInfo("");
+            chanInfo.setOverwriteMode(true);
+            chanInfo.setSubBufferSize(16384);
+            chanInfo.setReadTimer(100);
+            chanInfo.setSwitchTimer(200);
+            chanInfo.setNumberOfSubBuffers(2);
+            fService.enableChannels(sessionName, list, true, chanInfo, new NullProgressMonitor());
+            
+            // Create/enable/configure 1 UST channel
+            list.clear();
+            list.add("ustChannel");
+            
+            chanInfo = new ChannelInfo("");
+            chanInfo.setOverwriteMode(true);
+            chanInfo.setSubBufferSize(32768);
+            chanInfo.setReadTimer(200);
+            chanInfo.setSwitchTimer(100);
+            chanInfo.setNumberOfSubBuffers(1);
+            fService.enableChannels(sessionName, list, false, chanInfo, new NullProgressMonitor());
+
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
+
+    public void testDisableChannel() {
+        try {
+
+            String sessionName = "mysession2";
+            List<String> list = new ArrayList<String>();
+            String kernelChannel0 = "mychannel0";
+            String kernelChannel1 = "mychannel1";
+            list.add(kernelChannel0);
+            list.add(kernelChannel1);
+            
+            fShell.setScenario(SCEN_CHANNEL_HANDLING);
+            fService.disableChannels(sessionName, list, true, new NullProgressMonitor());
+            
+            list.clear();
+            list.add("ustChannel");
+            fService.disableChannels(sessionName, list, false, new NullProgressMonitor());
+
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
     
-//    public void testCreateChannel() {
+    public void testEnableChannel() {
+        try {
+
+            String sessionName = "mysession2";
+            List<String> list = new ArrayList<String>();
+            String kernelChannel0 = "mychannel0";
+            String kernelChannel1 = "mychannel1";
+            list.add(kernelChannel0);
+            list.add(kernelChannel1);
+            
+            fShell.setScenario(SCEN_CHANNEL_HANDLING);
+            fService.enableChannels(sessionName, list, true, null, new NullProgressMonitor());
+            
+            // Create/enable/configure 1 UST channel
+            list.clear();
+            list.add("ustChannel");
+            
+            fService.enableChannels(sessionName, list, false, null, new NullProgressMonitor());
+
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
+    
+//    public void tesEnableChannelNoTracer() {
 //        try {
+//            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForChannelNoTracer());
+//            service.getSessionNames(new NullProgressMonitor());
+//            fail("No exeption thrown");
 //            
-////            public void enableChannel(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor);
-//            ILttngControlService service = new LTTngControlService(fShellFactory.getShellForSessionNames());
-//            
-//            
-//            ISessionInfo info = service.createSession("mysession2", null, new NullProgressMonitor());
-//            assertNotNull(info);
-//            assertEquals("mysession2", info.getName());
-//            assertNotNull(info.getSessionPath());
-//            assertTrue(info.getSessionPath().contains("mysession2"));
-//            assertEquals(TraceSessionState.INACTIVE, info.getSessionState());
 //        } catch (ExecutionException e) {
-//            fail(e.toString());
+//            // success
 //        }
-//    }
+//    }    
+    
+    public void testEnableEvents() {
+        try {
+            // 1) session name, channel = null, 3 event names, kernel
+            String sessionName = "mysession2";
+            List<String> list = new ArrayList<String>();
+            String eventName0 = "block_rq_remap";
+            String eventName1 = "block_bio_remap";
+            String eventName2 = "softirq_entry";
+            list.add(eventName0);
+            list.add(eventName1);
+            list.add(eventName2);
+            fShell.setScenario(SCEN_EVENT_HANDLING);
+            fService.enableEvents(sessionName, null, list, true, new NullProgressMonitor());
+            
+            // 2) session name, channel=mychannel, event name= null, kernel
+            String channelName = "mychannel";
+            fService.enableEvents(sessionName, channelName, null, true, new NullProgressMonitor());
 
+            // 3) session name, channel=mychannel, 1 event name, ust
+            String ustEventName = "ust_tests_hello:tptest_sighandler";
+            list.clear();
+            list.add(ustEventName);
+            fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
+            
+            // 4) session name, channel = mychannel, no event name, ust
+            list.clear();
+            fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor());
+            
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
     
+    public void testEnableSyscalls() {
+        try {
+            // 1) session name, channel = null, 3 event names, kernel
+            String sessionName = "mysession2";
+            String channelName = "mychannel";
+            
+            fShell.setScenario(SCEN_EVENT_HANDLING);
+
+            // 1) session name, channel = null 
+            fService.enableSyscalls(sessionName, null, new NullProgressMonitor());
+
+            // 2) session name, channel = mychannel
+            fService.enableSyscalls(sessionName, channelName, new NullProgressMonitor());
+                        
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
+
+    public void testDynamicProbe() {
+        try {
+            // 1) session name, channel = null, 3 event names, kernel
+            String sessionName = "mysession2";
+            String channelName = "mychannel";
+            String eventName0 = "myevent0";
+            String eventName1 = "myevent1";
+            String functionProbe = "0xc0101340";
+            String dynProbe = "init_post";
+            
+            fShell.setScenario(SCEN_EVENT_HANDLING);
+
+            // 1) session name, channel = null, event name, function probe, probe 
+            fService.enableProbe(sessionName, null, eventName0, true, functionProbe, new NullProgressMonitor());
+
+            // 2) session name, channel = mychannel
+            fService.enableProbe(sessionName, channelName, eventName1, false, dynProbe, new NullProgressMonitor());
+                        
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
+
+    public void testEnableLogLevel() {
+        try {
+            // 1) session name, channel = null, 3 event names, kernel
+            String sessionName = "mysession2";
+            String channelName = "mychannel";
+            String eventName4 = "myevent4";
+            String eventName5 = "myevent5";
+            
+            fShell.setScenario(SCEN_EVENT_HANDLING);
+            
+            // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
+            fService.enableLogLevel(sessionName, null, eventName4, LogLevelType.LOGLEVEL_ONLY, TraceLogLevel.TRACE_DEBUG, new NullProgressMonitor());
+
+            // 2) session name, channel = mychannel, null, loglevel, TRACE_DEBUG_FUNCTION
+            fService.enableLogLevel(sessionName, channelName, eventName5, LogLevelType.LOGLEVEL, TraceLogLevel.TRACE_DEBUG_FUNCTION, new NullProgressMonitor());
+
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
     
 }
index c461ae6334ad724f80d5fae77671a9b7fde06836..e10b595ed2d1b80084d33d1ef7913ac6acab087d 100644 (file)
@@ -1,13 +1,17 @@
+/**********************************************************************
+ * 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.linuxtools.lttng.stubs.service.shells.GetSessionGarbageShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.LttngNotExistsShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.NoSessionNamesShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.NoUstProviderShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.SessionCreationErrorsShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.SessionNotExistsShell;
-import org.eclipse.linuxtools.lttng.stubs.service.shells.SessionNamesShell;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandShell;
+import org.eclipse.linuxtools.lttng.stubs.service.shells.LTTngToolsFileShell;
 
 public class CommandShellFactory {
 
@@ -22,31 +26,15 @@ public class CommandShellFactory {
         return fInstance;
     }
 
-    public ICommandShell getShellForNoSessionNames() {
-        return new NoSessionNamesShell();
-    }
-
-    public ICommandShell getShellForSessionNames() {
-        return new SessionNamesShell();
-    }
-
-    public ICommandShell getShellForLttngNotExistsShell() {
-        return new LttngNotExistsShell();
-    }
-    
-    public ICommandShell getShellForSessionNotExists() {
-        return new SessionNotExistsShell();
-    }
-    
-    public ICommandShell getShellForSessionGarbage() {
-        return new GetSessionGarbageShell();
-    }
-
-    public ICommandShell getShellForNoUstProvider() {
-        return new NoUstProviderShell();
-    }
+//    public ICommandShell getRealShell() {
+//        ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+//        IHost host = registry.getLocalHost();
+//        RemoteSystemProxy proxy = new RemoteSystemProxy(host);
+//        ICommandShell shell = new LTTngToolsSimulatorShell(proxy);
+//        return shell;
+//    }
     
-    public ICommandShell getShellForSessionErrors() {
-        return new SessionCreationErrorsShell();
+    public LTTngToolsFileShell getFileShell() {
+        return new LTTngToolsFileShell();
     }
 }
index 52ab21d45b3914b0be0ed3157d9599f9d3f0adc1..b173597f379820c1d2bfe86849f3d6d0883fd6ac 100644 (file)
@@ -1,7 +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.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;
@@ -12,6 +24,10 @@ 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() {
@@ -46,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
@@ -61,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);
+        }
+    }
 }
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/GetSessionGarbageShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/GetSessionGarbageShell.java
deleted file mode 100644 (file)
index 478b4d5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class GetSessionGarbageShell extends TestCommandShell {
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        String[] output = new String[2];
-        //Session test not found
-        //Error: Session name not found
-        output[0] = String.valueOf("asdfaereafsdcv 12333456434&*89**(())(^%$*");
-        output[1] = String.valueOf("@#$%^&*()@#$%^&*()0834523094578kj;djkfs");
-        return new CommandResult(0, output);
-    }
-}
-
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LTTngToolsFileShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LTTngToolsFileShell.java
new file mode 100644 (file)
index 0000000..2d5f96f
--- /dev/null
@@ -0,0 +1,259 @@
+/**********************************************************************
+ * 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.shells;
+
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
+import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
+
+public class LTTngToolsFileShell extends TestCommandShell {
+
+    // ------------------------------------------------------------------------
+    // CONSTANTS
+    // ------------------------------------------------------------------------
+    private final static String SCENARIO_KEY = "<SCENARIO>"; //$NON-NLS-1$
+    private final static String SCENARIO_END_KEY = "</SCENARIO>"; //$NON-NLS-1$
+    private final static String INPUT_KEY = "<COMMAND_INPUT>"; //$NON-NLS-1$
+    private final static String INPUT_END_KEY = "</COMMAND_INPUT>"; //$NON-NLS-1$
+    private final static String RESULT_KEY = "<COMMAND_RESULT>"; //$NON-NLS-1$
+    @SuppressWarnings("unused")
+    private final static String RESULT_END_KEY = "</COMMAND_RESULT>"; //$NON-NLS-1$
+    private final static String OUTPUT_KEY = "<COMMAND_OUTPUT>"; //$NON-NLS-1$
+    private final static String OUTPUT_END_KEY = "</COMMAND_OUTPUT>"; //$NON-NLS-1$
+    private final static String COMMENT_KEY = "#.*"; //$NON-NLS-1$
+    
+    private final static Pattern LTTNG_LIST_SESSION_PATTERN =  Pattern.compile("lttng\\s+list\\s+(.+)"); //$NON-NLS-1$
+    private final static String LTTNG_LIST_PROVIDER_PATTERN = "lttng\\s+list\\s+(-u|-k)"; //$NON-NLS-1$
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    private String fScenariofile;
+    private String fScenario;
+
+    private Map<String, Map<String, ICommandResult>> fScenarioMap = new HashMap<String, Map<String, ICommandResult>>();
+    private Map<String, Integer> fSessionNameMap = new HashMap<String, Integer>();
+
+    /**
+     * Parse a scenario file with the format:
+     * <SCENARIO>
+     * ScenarioName
+     * 
+     * <COMMAND_INPUT>
+     * Command
+     * </COMAND_INPUT>
+     * 
+     * <COMMAND_RESULT>
+     * CommandResult
+     * </COMMAND_RESULT>
+     * 
+     * <COMMAND_OUTPUT>
+     * CommandOutput
+     * </COMMAND_OUTPUT>
+     * 
+     * </SCENARIO>
+     * 
+     * Where: ScenarioName - is the scenario name
+     *        Command - the command line string
+     *        CommandResult - the result integer of the command (0 for success, 1 for failure)
+     *        ComandOutput - the command output string (multi-line possible)
+     *        
+     * Note: 1) There can be many scenarios per file
+     *       2) There can be many (Command-CommandResult-CommandOutput) triples per scenario
+     *       3) Lines starting with # will be ignored (comments)
+     *                 
+     * @param scenariofile - path to scenario file
+     * @throws Exception
+     */
+    public void loadScenarioFile(String scenariofile) throws Exception {
+        fScenariofile = scenariofile;
+        
+        // clean up map
+        Collection<Map<String, ICommandResult>> values = fScenarioMap.values();
+        for (Iterator<Map<String, ICommandResult>> iterator = values.iterator(); iterator.hasNext();) {
+            Map<String, ICommandResult> map = (Map<String, ICommandResult>) iterator.next();
+            map.clear();
+        }
+        fScenarioMap.clear();
+        
+        // load from file
+        
+        // Open the file
+        FileInputStream fstream = new FileInputStream(fScenariofile);
+        
+        // Get the object of DataInputStream
+        DataInputStream in = new DataInputStream(fstream);
+        BufferedReader br = new BufferedReader(new InputStreamReader(in));
+        String strLine;
+        
+        // Read File Line by Line
+        
+        // Temporary map for generating instance numbers for lttng list <session> commands. 
+        // The numbers are per scenario.
+        Map<String, Integer> tmpSessionNameMap = new HashMap<String, Integer>();
+        while ((strLine = br.readLine()) != null) {
+
+            // Ignore comments
+            if(isComment(strLine)) {
+                continue;
+            }
+
+            if (SCENARIO_KEY.equals(strLine)) {
+                // scenario start
+
+                // Ignore comments
+                strLine = br.readLine();
+                while (isComment(strLine)) {
+                    strLine = br.readLine();
+                }
+
+                String scenario = strLine;
+                Map<String, ICommandResult> commandMap = new HashMap<String, ICommandResult>();
+                fScenarioMap.put(scenario, commandMap);
+                List<String> output = null;
+                String input = null;
+                boolean inOutput = false;
+                int result = 0;
+                tmpSessionNameMap.clear();
+                while ((strLine = br.readLine()) != null) {
+                    // Ignore comments 
+                    if(isComment(strLine)) {
+                        continue;
+                    }
+
+                    if (SCENARIO_END_KEY.equals(strLine)) {
+                        // Scenario is finished
+                        break;
+                    } 
+                    if (INPUT_KEY.equals(strLine)) {
+                        strLine = br.readLine();
+                        // Ignore comments
+                        while (isComment(strLine)) {
+                            strLine = br.readLine();
+                        }
+                        // Read command
+                        input = strLine;
+                        
+                        // Handle instances of 'lttng list <session"-comamand
+                        Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(strLine);
+                        if (matcher.matches() && !input.matches(LTTNG_LIST_PROVIDER_PATTERN)) {
+                            String sessionName = matcher.group(1).trim();
+                            Integer i = tmpSessionNameMap.get(sessionName);
+                            if (i != null) {
+                                i++;
+                            } else {
+                                i = 0;
+                            }
+                            tmpSessionNameMap.put(sessionName, i);
+                            input += String.valueOf(i);
+                        }
+                    } else if (INPUT_END_KEY.equals(strLine)) {
+                        // Initialize output array
+                        output = new ArrayList<String>();
+                    } else if (RESULT_KEY.equals(strLine)) {
+                        strLine = br.readLine();
+                        // Ignore comments
+                        while (isComment(strLine)) {
+                            strLine = br.readLine();
+                        }
+                        // Save result value
+                        result = Integer.parseInt(strLine);
+                    }  else if (OUTPUT_END_KEY.equals(strLine)) {
+                        // Save output/result in command map
+                        commandMap.put(input, new CommandResult(result, output.toArray(new String[output.size()])));
+                        inOutput = false;
+                    } else if (OUTPUT_KEY.equals(strLine)) {
+                        // first line of output
+                        inOutput = true;
+                        strLine = br.readLine();
+
+                        // Ignore comments
+                        while (isComment(strLine)) {
+                            strLine = br.readLine();
+                        }
+                        output.add(strLine);
+                    } else if (inOutput) {
+                        // subsequent lines of output
+                        output.add(strLine);
+                    } 
+//                    else { 
+//                        if (RESULT_END_KEY.equals(strLine)) {
+                        // nothing to do
+//                    }
+                }
+            }
+        }
+        //Close the input stream
+        in.close();
+    }
+
+    // Set the scenario to consider in executeCommand()
+    public synchronized void setScenario(String scenario) {
+        fScenario = scenario;
+        fSessionNameMap.clear();
+        if (!fScenarioMap.containsKey(fScenario)) {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.stubs.service.shells.TestCommandShell#executeCommand(java.lang.String, org.eclipse.core.runtime.IProgressMonitor, boolean)
+     */
+    @SuppressWarnings("nls")
+    @Override
+   public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
+        Map<String, ICommandResult> commands = fScenarioMap.get(fScenario);
+
+        Matcher matcher = LTTNG_LIST_SESSION_PATTERN.matcher(command);
+        if (matcher.matches() && !command.matches(LTTNG_LIST_PROVIDER_PATTERN)) {
+            String sessionName = matcher.group(1).trim();
+            Integer i = fSessionNameMap.get(sessionName);
+            if (i != null) {
+                i++;
+            } else {
+                i = 0;
+            }
+            fSessionNameMap.put(sessionName, i);
+            command += String.valueOf(i);
+        }
+
+        if (commands.containsKey(command)) {
+            return commands.get(command);
+        } 
+
+        String[] output = new String[1];
+        output[0] = String.valueOf("Command not found");
+        return new CommandResult(1, output);
+   }
+    
+    // ------------------------------------------------------------------------
+    // Helper methods
+    // ------------------------------------------------------------------------
+    private boolean isComment(String line) {
+        return line.matches(COMMENT_KEY);
+    }
+}
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LttngNotExistsShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/LttngNotExistsShell.java
deleted file mode 100644 (file)
index 66aa0fd..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class LttngNotExistsShell extends TestCommandShell {
-
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        String[] output = new String[1];
-        output[0] = String.valueOf("Command not found");
-        return new CommandResult(1, output);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoSessionNamesShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoSessionNamesShell.java
deleted file mode 100644 (file)
index 1a4b483..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class NoSessionNamesShell extends TestCommandShell {
-
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        String[] output = new String[1];
-        output[0] = String.valueOf("Currently no available tracing session");
-        return new CommandResult(0, output);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoUstProviderShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/NoUstProviderShell.java
deleted file mode 100644 (file)
index d02935a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class NoUstProviderShell extends TestCommandShell {
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        String[] output = new String[4];
-        //Session test not found
-        //Error: Session name not found
-        output[0] = String.valueOf("UST events:");
-        output[1] = String.valueOf("-------------");
-        output[2] = String.valueOf("None");
-        output[3] = String.valueOf("");
-        CommandResult result = new CommandResult(0, output);
-        result.setResult(0);
-        return result;
-    }
-}
-
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionCreationErrorsShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionCreationErrorsShell.java
deleted file mode 100644 (file)
index 32ff74c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class SessionCreationErrorsShell extends TestCommandShell {
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        if ("lttng create alreadyExist".equals(command)) {
-            String[] output = new String[1];
-            //Error: Session name already exist
-            output[0] = String.valueOf("Error: Session name already exist");
-            return new CommandResult(1, output);
-        } else if("lttng create \"session with spaces\"".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session session with spaces created.");
-            list.add("Traces will be written in /home/user/lttng-traces/session with spaces-20120209-095418");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng create wrongName".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session auto created.");
-            list.add("Traces will be written in /home/user/lttng-traces/auto-20120209-095418");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng create wrongPath -o /home/user/hallo".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session wrongPath created.");
-            list.add("Traces will be written in /home/user/lttng-traces/wrongPath-20120209-095418");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng create pathWithSpaces -o \"/home/user/hallo user/here\"".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session pathWithSpaces created.");
-            list.add("Traces will be written in /home/user/hallo user/here/pathWithSpaces-20120209-095418");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        }
-        
-        String[] output = new String[1];
-        output[0] = String.valueOf("Command not found");
-        return new CommandResult(1, output);
-    }
-}
-
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNamesShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNamesShell.java
deleted file mode 100644 (file)
index 173986d..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class SessionNamesShell extends TestCommandShell {
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        if ("lttng list ".equals(command)) {
-            String[] output = new String[5];
-            output[0] = String.valueOf("Available tracing sessions:");
-            output[1] = String.valueOf("  1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]");
-            output[2] = String.valueOf("  2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]");
-            output[3] = String.valueOf("");
-            output[4] = String.valueOf(" Use lttng list <session_name> for more details");
-            // test constructor with null pointer parameter
-            CommandResult result = new CommandResult(0, null);
-            // test setOutput!!!
-            result.setOutput(output);
-            return result; 
-        } else if ("lttng list mysession".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Tracing session mysession: [active]");
-            list.add("    Trace path: /home/user/lttng-traces/mysession-20120129-084256");
-            list.add("");
-            list.add("=== Domain: Kernel ===");
-            list.add("");
-            list.add("Channels:");
-            list.add("-------------");
-            list.add("- channel0: [enabled]");
-            list.add("");
-            list.add("    Attributes:");
-            list.add("      overwrite mode: 0");
-            list.add("      subbufers size: 262144");
-            list.add("      number of subbufers: 4");
-            list.add("      switch timer interval: 0");
-            list.add("      read timer interval: 200");
-            list.add("      output: splice()");
-            list.add("");
-            list.add("    Events:");
-            list.add("      block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]");
-            list.add("      block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [disabled]");
-            list.add("");
-            list.add("- channel1: [disabled]");
-            list.add("");
-            list.add("    Attributes:");
-            list.add("      overwrite mode: 1");
-            list.add("      subbufers size: 524288");
-            list.add("      number of subbufers: 4");
-            list.add("      switch timer interval: 100");
-            list.add("      read timer interval: 400");
-            list.add("      output: splice()");
-            list.add("");
-            list.add("    Events:");
-            list.add("      None");
-            list.add("");
-            list.add("=== Domain: UST global ===");
-            list.add("");
-            list.add("Channels:");
-            list.add("-------------");
-            list.add("- mychannel1: [disabled]");
-            list.add("");
-            list.add("    Attributes:");
-            list.add("     overwrite mode: 1");
-            list.add("     subbufers size: 8192");
-            list.add("      number of subbufers: 8");
-            list.add("      switch timer interval: 200");
-            list.add("      read timer interval: 100");
-            list.add("      output: mmap()");
-            list.add("");
-            list.add("    Events:");
-            list.add("      None");
-            list.add("");
-            list.add("- channel0: [enabled]");
-            list.add("");
-            list.add("    Attributes:");
-            list.add("      overwrite mode: 0");
-            list.add("      subbufers size: 4096");
-            list.add("      number of subbufers: 4");
-            list.add("      switch timer interval: 0");
-            list.add("      read timer interval: 200");
-            list.add("      output: mmap()");
-            list.add("");
-            list.add("    Events:");
-            list.add("      ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled]");
-            list.add("      * (type: tracepoint) [enabled]");
-            list.add("");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng list -u".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("UST events:");
-            list.add("-------------");
-            list.add("");
-            list.add("PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello");
-            list.add("    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)");
-            list.add("    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)");
-            list.add("");
-            list.add("PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello");
-            list.add("    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)");
-            list.add("    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)");
-            list.add("");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng list -k".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Kernel events:");
-            list.add("-------------");
-            list.add("      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)");
-            list.add("      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)");
-            list.add("      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)");
-            list.add("");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng list mysession1".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Tracing session mysession1: [inactive]");
-            list.add("    Trace path: /home/user/lttng-traces/mysession1-20120203-133225");
-            list.add("");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng create mysession2".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session mysession2 created.");
-            list.add("Traces will be written in /home/user/lttng-traces/mysession2-20120209-095418");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        } else if ("lttng destroy mysession2".equals(command)) {
-            List<String> list = new ArrayList<String>();
-            list.add("Session mysession2 destrioyed.");
-            return new CommandResult(0, list.toArray(new String[list.size()]));
-        }
-
-        String[] output = new String[1];
-        output[0] = String.valueOf("Command not found");
-        return new CommandResult(1, output);
-    }
-}
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNotExistsShell.java b/org.eclipse.linuxtools.lttng.ui.tests/stubs/org/eclipse/linuxtools/lttng/stubs/service/shells/SessionNotExistsShell.java
deleted file mode 100644 (file)
index 3aeac83..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.linuxtools.lttng.stubs.service.shells;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.CommandResult;
-import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandResult;
-
-public class SessionNotExistsShell extends TestCommandShell {
-    @SuppressWarnings("nls")
-    @Override
-    public ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkReturnValue) throws ExecutionException {
-        String[] output = new String[2];
-        //Session test not found
-        //Error: Session name not found
-        output[0] = String.valueOf("Session test not found");
-        output[1] = String.valueOf("Error: Session name not found");
-        return new CommandResult(1, output);
-    }
-}
-
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/testfiles/CreateTreeTest.cfg b/org.eclipse.linuxtools.lttng.ui.tests/testfiles/CreateTreeTest.cfg
new file mode 100644 (file)
index 0000000..3b08795
--- /dev/null
@@ -0,0 +1,306 @@
+####################################################################
+# 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
+####################################################################
+####################################################################
+# Scenario: Test no sessions available
+####################################################################
+<SCENARIO>
+Initialize
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Currently no available tracing session
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel events
+-------------
+      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+
+PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Enable events from kernel provider events
+####################################################################
+<SCENARIO>
+Scenario1
+<COMMAND_INPUT>
+lttng create mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in /home/user/lttng-traces/mysession-20120314-132824
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+    Trace path: /home/user/lttng-traces/mysession-20120314-132824
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event sched_kthread_stop,sched_kthread_stop_ret -k  -s mysession --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event sched_kthread_stop created in channel channel0
+kernel sched_kthread_stop_ret created in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+    Trace path: /home/user/lttng-traces/mysession-20120314-132824
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- channel0: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 262144
+      number of subbufers: 4
+      switch timer interval: 0
+      read timer interval: 200
+      output: splice()
+
+    Events:
+      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng disable-event sched_kthread_stop_ret,sched_kthread_stop -k  -s mysession -c channel0
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event sched_kthread_stop_ret disabled in channel channel0
+kernel event sched_kthread_stop disabled in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event sched_kthread_stop -k  -s mysession -c channel0 --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event sched_kthread_stop enabled in channel channel0
+</COMMAND_OUTPUT>
+
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+
+</SCENARIO>
+
+####################################################################
+# Scenario: Enable events from UST provider events
+####################################################################
+<SCENARIO>
+Scenario2
+<COMMAND_INPUT>
+lttng create mysession -o /home/user/temp
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession created.
+Traces will be written in /home/user/temp
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+    Trace path: /home/user/temp
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-channel mychannel -u  -s mysession --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST channel mychannel enabled for session mysession
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+    Trace path: /home/user/temp
+
+=== Domain: UST global ===
+
+Channels:
+-------------
+- mychannel: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 16384
+      number of subbufers: 2
+      switch timer interval: 200
+      read timer interval: 100
+      output: mmap()
+
+    Events:
+      None
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event ust_tests_hello:tptest_sighandler,ust_tests_hello:tptest -u  -s mysession --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST event ust_tests_hello:tptest_sighandler in channel channel0
+UST sched_ust_tests_hello:tptest created in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+    Trace path: /home/user/temp
+
+=== Domain: UST global ===
+
+Channels:
+-------------
+- mychannel: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 16384
+      number of subbufers: 2
+      switch timer interval: 200
+      read timer interval: 100
+      output: mmap()
+
+    Events:
+      ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [enabled]
+      ust_tests_hello:tptest (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng disable-event ust_tests_hello:tptest -u  -s mysession -c mychannel
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event ust_tests_hello:tptest in channel mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event ust_tests_hello:tptest -u  -s mysession -c mychannel --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event ust_tests_hello:tptest enabled in channel mychannel
+</COMMAND_OUTPUT>
+
+
+<COMMAND_INPUT>
+lttng destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession destroyed.
+</COMMAND_OUTPUT>
+
+</SCENARIO>
+
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/testfiles/LTTngServiceTest.cfg b/org.eclipse.linuxtools.lttng.ui.tests/testfiles/LTTngServiceTest.cfg
new file mode 100644 (file)
index 0000000..7a540a5
--- /dev/null
@@ -0,0 +1,541 @@
+####################################################################
+# 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
+####################################################################
+####################################################################
+# Scenario: Test lttng not installed
+####################################################################
+<SCENARIO>
+LttngNotInstalled
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Command not found
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test no sessions available
+####################################################################
+<SCENARIO>
+NoSessionAvailable
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Currently no available tracing session
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test get sessions
+####################################################################
+<SCENARIO>
+GetSessionNames1
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Available tracing sessions:
+  1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]
+  2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]
+
+ Use lttng list <session_name> for more details
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test lttng list <name> where session doesn't exist 
+####################################################################
+<SCENARIO>
+GetSessionNameNotExist
+<COMMAND_INPUT>
+lttng list test
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session test not found
+Error: Session name not found
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test lttng list with garbage output 
+####################################################################
+<SCENARIO>
+GetSessionGarbageOut
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+asdfaereafsdcv 12333456434&*89**(())(^%$*
+@#$%^&*()@#$%^&*()0834523094578kj;djkfs
+a;sdf094v5u dsafj;sd9
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test lttng list <name> with sample outputs 
+####################################################################
+<SCENARIO>
+GetSession1
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [active]                                                                    
+    Trace path: /home/user/lttng-traces/mysession-20120129-084256
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- channel0: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 262144
+      number of subbufers: 4
+      switch timer interval: 0
+      read timer interval: 200
+      output: splice()
+
+    Events:
+      block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+      block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [disabled]
+
+- channel1: [disabled]
+
+    Attributes:
+      overwrite mode: 1
+      subbufers size: 524288
+      number of subbufers: 4
+      switch timer interval: 100
+      read timer interval: 400
+      output: splice()
+
+    Events:
+      None
+
+=== Domain: UST global ===
+
+Channels:
+-------------
+- mychannel1: [disabled]
+
+    Attributes:
+     overwrite mode: 1
+     subbufers size: 8192
+      number of subbufers: 8
+      switch timer interval: 200
+      read timer interval: 100
+      output: mmap()
+
+    Events:
+      None
+
+- channel0: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 4096
+      number of subbufers: 4
+      switch timer interval: 0
+      read timer interval: 200
+      output: mmap()
+
+    Events:
+      ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled]
+      * (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng list mysession1
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession1: [inactive]
+    Trace path: /home/user/lttng-traces/mysession1-20120203-133225
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+
+####################################################################
+# Scenario: Test "lttng list -k" with sample output 
+####################################################################
+<SCENARIO>
+GetKernelProvider1
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel events
+-------------
+      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng list -u" with sample output 
+####################################################################
+<SCENARIO>
+GetUstProvider1
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+
+PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng list -u" with no UST provider available 
+####################################################################
+<SCENARIO>
+GetUstProvider2
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+None
+
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session>  
+####################################################################
+<SCENARIO>
+CreateSession1
+<COMMAND_INPUT>
+lttng create mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession2 created.
+Traces will be written in /home/user/lttng-traces/mysession2-20120209-095418
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng create <session> with different variants 
+# and errors
+####################################################################
+<SCENARIO>
+CreateSessionVariants
+<COMMAND_INPUT>
+lttng create alreadyExist
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Error: Session name already exist
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create "session with spaces"
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session session with spaces created.
+Traces will be written in /home/user/lttng-traces/session with spaces-20120209-095418
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create wrongName
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session auto created.
+Traces will be written in /home/user/lttng-traces/auto-20120209-095418
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create wrongPath -o /home/user/hallo
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session wrongPath created.
+Traces will be written in /home/user/lttng-traces/wrongPath-20120209-095418
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng create pathWithSpaces -o "/home/user/hallo user/here"
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session pathWithSpaces created.
+Traces will be written in /home/user/hallo user/here/pathWithSpaces-20120209-095418
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng destroy <session> 
+####################################################################
+
+<SCENARIO>
+DestroySession1
+<COMMAND_INPUT>
+lttng destroy mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession2 destroyed.
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng enable-channel ..." with different inputs 
+####################################################################
+
+<SCENARIO>
+ChannelHandling
+<COMMAND_INPUT>
+lttng enable-channel mychannel0,mychannel1 -k  -s mysession2 --overwrite  --subbuf-size 16384 --num-subbuf 2 --switch-timer 200 --read-timer 100
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel channel mychannel0 enabled for session mysession2
+Kernel channel mychannel1 enabled for session mysession2
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-channel ustChannel -u  -s mysession2 --overwrite  --subbuf-size 32768 --num-subbuf 1 --switch-timer 100 --read-timer 200
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST channel channel0 enabled for session mysession2
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-channel mychannel0,mychannel1 -k  -s mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel channel mychannel0 enabled for session mysession2
+Kernel channel mychannel1 enabled for session mysession2
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-channel ustChannel -u  -s mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST channel mychannel0 enabled for session mysession2
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng disable-channel mychannel0,mychannel1 -k  -s mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel channel mychannel0 disabled for session mysession2
+Kernel channel mychannel1 disabled for session mysession2
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng disable-channel ustChannel -u  -s mysession2
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST channel mychannel0 enabled for session mysession2
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+
+####################################################################
+# Scenario: Test "lttng enable-events ..." with different inputs 
+####################################################################
+<SCENARIO>
+EventHandling
+
+# Tracepoint test cases
+<COMMAND_INPUT>
+lttng enable-event block_rq_remap,block_bio_remap,softirq_entry -k  -s mysession2 --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event block_rq_remap created in channel channel0
+kernel event block_bio_remap created in channel channel0
+kernel event softirq_entry created in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event  -a  -k  -s mysession2 -c mychannel --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All kernel tracepoints are enabled in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event ust_tests_hello:tptest_sighandler -u  -s mysession2 -c mychannel --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST event ust_tests_hello:tptest_sighandler created in channel mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event  -a  -u  -s mysession2 -c mychannel --tracepoint 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All UST tracepoints are enabled in channel mychannel
+</COMMAND_OUTPUT>
+
+# Syscall test cases
+
+<COMMAND_INPUT>
+lttng enable-event  -a  -k  -s mysession2 --syscall 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All kernel system calls are enabled in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event  -a  -k  -s mysession2 -c mychannel --syscall 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All kernel system calls are enabled in channel mychannel
+</COMMAND_OUTPUT>
+
+# dynamic probe/function probe test cases
+
+<COMMAND_INPUT>
+lttng enable-event myevent0 -k  -s mysession2 --function 0xc0101340
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event myevent0 created in channel mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event myevent1 -k  -s mysession2 -c mychannel --probe init_post
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel event myevent1 created in channel mychannel
+</COMMAND_OUTPUT>
+
+# log level test cases
+
+<COMMAND_INPUT>
+lttng enable-event myevent4 -u  -s mysession2 --loglevel-only TRACE_DEBUG
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST event myevent4 created in channel channel0
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng enable-event myevent5 -u  -s mysession2 -c mychannel --loglevel TRACE_DEBUG_FUNCTION
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST event myevent5 created in channel mychannel
+</COMMAND_OUTPUT>
+
+</SCENARIO>
+
+
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/testfiles/ListInfoTest.cfg b/org.eclipse.linuxtools.lttng.ui.tests/testfiles/ListInfoTest.cfg
new file mode 100644 (file)
index 0000000..52b0d3a
--- /dev/null
@@ -0,0 +1,157 @@
+####################################################################
+# 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
+####################################################################
+####################################################################
+# Scenario: Test lttng list <name> with sample outputs 
+####################################################################
+<SCENARIO>
+ListInfoTest
+<COMMAND_INPUT>
+lttng list 
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Available tracing sessions:
+  1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive]
+  2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive]
+
+ Use lttng list <session_name> for more details
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [active]                                                                    
+    Trace path: /home/user/lttng-traces/mysession-20120129-084256
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- channel0: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 262144
+      number of subbufers: 4
+      switch timer interval: 0
+      read timer interval: 200
+      output: splice()
+
+    Events:
+      block_rq_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+      block_bio_remap (loglevel: TRACE_EMERG (0)) (type: tracepoint) [disabled]
+      myevent2 (type: probe) [enabled]
+        addr: 0xc0101340
+      myevent0 (type: probe) [enabled]
+        offset: 0x0
+        symbol: init_post
+      syscalls (type: syscall) [enabled]
+
+- channel1: [disabled]
+
+    Attributes:
+      overwrite mode: 1
+      subbufers size: 524288
+      number of subbufers: 4
+      switch timer interval: 100
+      read timer interval: 400
+      output: splice()
+
+    Events:
+      None
+
+=== Domain: UST global ===
+
+Channels:
+-------------
+- mychannel1: [disabled]
+
+    Attributes:
+     overwrite mode: 1
+     subbufers size: 8192
+      number of subbufers: 8
+      switch timer interval: 200
+      read timer interval: 100
+      output: mmap()
+
+    Events:
+      None
+
+- channel0: [enabled]
+
+    Attributes:
+      overwrite mode: 0
+      subbufers size: 4096
+      number of subbufers: 4
+      switch timer interval: 0
+      read timer interval: 200
+      output: mmap()
+
+    Events:
+      ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint) [disabled]
+      * (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng list mysession1
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession1: [inactive]
+    Trace path: /home/user/lttng-traces/mysession1-20120203-133225
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel events
+-------------
+      sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+
+PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+    ust_tests_hello:tptest_sighandler (loglevel: TRACE_WARNING (4)) (type: tracepoint)
+    ust_tests_hello:tptest (loglevel: TRACE_DEBUG_FUNCTION (12)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+</SCENARIO>
diff --git a/org.eclipse.linuxtools.lttng.ui/icons/elcl16/refresh.gif b/org.eclipse.linuxtools.lttng.ui/icons/elcl16/refresh.gif
new file mode 100644 (file)
index 0000000..3ca04d0
Binary files /dev/null and b/org.eclipse.linuxtools.lttng.ui/icons/elcl16/refresh.gif differ
index 59620b19e9f11f23f954b4273c13fe7d7e202956..92ae682c957343b5c50cfc51caecabbad8af0c40 100644 (file)
@@ -68,6 +68,10 @@ commands.control.connect.description=Connect to Target Node
 commands.control.disconnect=Disconnect
 commands.control.discconnect.description=Disconnect to Target Node
 
+commands.control.refresh=Refresh
+commands.control.refresh.description=Refresh Node Configuration
+
+
 commands.control.delete=Delete
 commands.control.deleete.description=Delete Target Node
 
index 06673b6ca7cf52fad061497e1fe5e4adc9e663f6..5006e74a053f5489b35dd89999b77402b9fb7a7b 100644 (file)
             id="org.eclipse.linuxtools.lttng.ui.commands.control.disconnect"
             name="%commands.control.disconnect">
       </command>
+      <command
+            categoryId="org.eclipse.linuxtools.lttng.ui.commands.control.category"
+            description="%commands.control.refresh.description"
+            id="org.eclipse.linuxtools.lttng.ui.commands.control.refresh"
+            name="%commands.control.refresh">
+      </command>
       <command
             categoryId="org.eclipse.linuxtools.lttng.ui.commands.control.category"
             description="%commands.control.delete.description"
                label="%commands.control.disconnect"
                style="push">
          </command>
+         <command
+               commandId="org.eclipse.linuxtools.lttng.ui.commands.control.refresh"
+               icon="icons/elcl16/refresh.gif"
+               label="%commands.control.refresh"
+               style="push">
+         </command>
          <command
                commandId="org.eclipse.linuxtools.lttng.ui.commands.control.delete"
                icon="icons/elcl16/target_delete.gif"
                </with>
             </visibleWhen>
          </command>
+         <command
+               commandId="org.eclipse.linuxtools.lttng.ui.commands.control.refresh"
+               icon="icons/elcl16/refresh.gif"
+               label="%commands.control.refresh"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <with
+                     variable="activeMenuSelection">
+                  <iterate
+                        operator="or">
+                     <instanceof
+                           value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent">
+                     </instanceof>
+                  </iterate>
+               </with>
+            </visibleWhen>
+         </command>
          <command
                commandId="org.eclipse.linuxtools.lttng.ui.commands.control.delete"
                icon="icons/elcl16/target_delete.gif"
             </with>
          </activeWhen>
       </handler>
+      <handler
+            class="org.eclipse.linuxtools.lttng.ui.views.control.handlers.RefreshHandler"
+            commandId="org.eclipse.linuxtools.lttng.ui.commands.control.refresh">
+         <activeWhen>
+            <with
+                  variable="selection">
+               <iterate
+                     operator="or">
+                  <instanceof
+                        value="org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent">
+                  </instanceof>
+               </iterate>
+            </with>
+         </activeWhen>
+      </handler>
       <handler
             class="org.eclipse.linuxtools.lttng.ui.views.control.handlers.DeleteHandler"
             commandId="org.eclipse.linuxtools.lttng.ui.commands.control.delete">
index e5643d58c178a5f977cd145443e09873386aa69b..f99341689415181657cdf8477206407594cdc516 100644 (file)
@@ -16,6 +16,7 @@ package org.eclipse.linuxtools.lttng.ui.views.control;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
 import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponentChangedListener;
@@ -151,6 +152,29 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang
             }
         });
     }
+    
+    /**
+     * Sets the selected component in the tree
+     * @param component - component to select
+     */
+    public void setSelection(ITraceControlComponent component) {
+        StructuredSelection selection = new StructuredSelection(component);
+        fTreeViewer.setSelection(selection);
+    }
+
+    /**
+     * Sets the selected components in the tree
+     * @param component - array of components to select
+     */
+    public void setSelection(ITraceControlComponent[] components) {
+        StructuredSelection selection = new StructuredSelection(components);
+        fTreeViewer.setSelection(selection);
+    }
+    
+//    public ITraceControlComponent getSelection() {
+//        ISelection selection = fTreeViewer.getSelection();
+//        
+//    }
 
     // ------------------------------------------------------------------------
     // Helper methods
index 3aff29d18d25f765a67b15e5a82183b40c2c3091..ca1d7141adfc654b9c5063c9aae1365e78857f91 100644 (file)
@@ -163,9 +163,10 @@ final public class Messages extends NLS {
     public static String TraceControl_SessionPathPropertyName;
     public static String TraceControl_ProviderNamePropertyName;
     public static String TraceControl_ProcessIdPropertyName;
+    public static String TraceControl_ProbeAddressPropertyName;
+    public static String TraceControl_ProbeOffsetPropertyName;
+    public static String TraceControl_ProbeSymbolPropertyName;
     
-    
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/ConfirmDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/ConfirmDialog.java
new file mode 100644 (file)
index 0000000..c372c6b
--- /dev/null
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * 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.ui.views.control.dialogs;
+
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * <b><u>ConfirmDialog</u></b>
+ * <p>
+ * Confirmation dialog implementation.
+ * </p>
+ */
+
+public class ConfirmDialog implements IConfirmDialog {
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IConfirmDialog#openConfirm(org.eclipse.swt.widgets.Shell, java.lang.String, java.lang.String)
+     */
+    @Override
+    public boolean openConfirm(Shell parent, String title, String message) {
+        return MessageDialog.openConfirm(parent, 
+                Messages.TraceControl_DestroyConfirmationTitle, 
+                Messages.TraceControl_DestroyConfirmationMessage);
+    }
+}
index 1a062a9c4ab1ee63f7b7b7ebbf652d43b563d9ad..27dee19ee65e38715a132cf24b8233ad5a41defa 100644 (file)
@@ -119,23 +119,8 @@ public class CreateChannelDialog extends Dialog implements ICreateChannelOnSessi
      * @param shell - a shell for the display of the dialog
      */
     public CreateChannelDialog(Shell shell) {
-        this(shell, null);
-    }
-
-    
-    /**
-     * Constructor
-     * @param shell - a shell for the display of the dialog
-     * @param domain - a domain to create channel on. Use null for creating a channel on session level.
-     */
-    public CreateChannelDialog(Shell shell, TraceDomainComponent domain) {
-        super(shell);
-        fDomain = domain;
-        if (fDomain != null) {
-            fIsKernel = fDomain.isKernel();
-        } else {
-            fIsKernel = true;
-        }
+       super(shell);
+       fIsKernel = true;
 
         // Common verify listener
         fVerifyListener = new VerifyListener() {
@@ -159,6 +144,20 @@ public class CreateChannelDialog extends Dialog implements ICreateChannelOnSessi
         return fChannelInfo;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateChannelDialog#setDomainComponent(org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent)
+     */
+    @Override
+    public void setDomainComponent(TraceDomainComponent domain) {
+        fDomain = domain;
+        if (fDomain != null) {
+            fIsKernel = fDomain.isKernel();
+        } else {
+            fIsKernel = true;
+        }
+    }
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateChannelOnSessionDialog#isKernel()
index ef66896e6c4c9ba1f8bbc38f42633321793966c4..ae9e88c972320de8341faabb219e79b7741a812f 100644 (file)
@@ -87,11 +87,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
     /**
      * Constructor
      * @param shell - a shell for the display of the dialog
-     * @param parent - trace control parent for validation of session name
      */
-    public CreateSessionDialog(Shell shell, TraceSessionGroup parent) {
+    public CreateSessionDialog(Shell shell) {
         super(shell);
-        fParent = parent;
     }
 
     // ------------------------------------------------------------------------
@@ -124,6 +122,15 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog
         return fIsDefaultPath;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateSessionDialog#setTraceSessionGroup(org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup)
+     */
+    @Override
+    public void setTraceSessionGroup(TraceSessionGroup group) {
+        fParent = group;
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
index dbeb8586e0e1442cb527b6f34186c4c5406102cc..99bd3a20037af71083cfcd8cd09470136ba183f8 100644 (file)
@@ -96,28 +96,11 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog  {
      * @param shell - a shell for the display of the dialog
      * @param providerGroup - the trace provider group
      */
-    public EnableEventsDialog(Shell shell, TraceProviderGroup providerGroup) {
-        this(shell, providerGroup, null);
-    }
-    
-    /**
-     * Constructor
-     * @param shell - a shell for the display of the dialog
-     * @param providerGroup - a trace provider group
-     * @param domain - a domain of the events (null if not known) 
-     */
-    public EnableEventsDialog(Shell shell, TraceProviderGroup providerGroup, TraceDomainComponent domain) {
+    public EnableEventsDialog(Shell shell) {
         super(shell);
-        fProviderGroup = providerGroup;
         setShellStyle(SWT.RESIZE);
-        fDomain = domain;
-        if (fDomain != null) {
-            fIsKernel = fDomain.isKernel();
-        } else {
-            fIsKernel = true;
-        }
     }
-
+    
     // ------------------------------------------------------------------------
     // Accessors
     // ------------------------------------------------------------------------
@@ -331,6 +314,29 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog  {
     public boolean isKernel() {
         return fIsKernel;
     }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableEventsDialog#setTraceProviderGroup(org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProviderGroup)
+     */
+    @Override
+    public void setTraceProviderGroup(TraceProviderGroup providerGroup) {
+        fProviderGroup = providerGroup;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableEventsDialog#setTraceDomainComponent(org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent)
+     */
+    @Override
+    public void setTraceDomainComponent(TraceDomainComponent domain) {
+        fDomain = domain;
+        if (fDomain != null) {
+            fIsKernel = fDomain.isKernel();
+        } else {
+            fIsKernel = true;
+        }
+    }
 
     // ------------------------------------------------------------------------
     // Operations
@@ -391,8 +397,11 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog  {
         // ------------------------------------------------------------------------
         // Kernel or UST event data group 
         // ------------------------------------------------------------------------
+        fUstComposite = null;
+        fKernelComposite = null;
         if (fIsKernel) {
             createKernelComposite();
+            fUstComposite = null;
         } else {
             createUstComposite();
         }
index 1f63b39ce0eeb649d703bfb1fa3d55e41b88b219..0003d506c1fa89abca184a6b67dc5b2552021523 100644 (file)
@@ -98,13 +98,9 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
     /**
      * Constructor of dialog box.
      * @param shell - the shell for the dialog box
-     * @param isKernel - a flag to indicate Kernel or UST events.
-     * @param sessions - a list of available sessions
      */
-    public GetEventInfoDialog(Shell shell, boolean isKernel, TraceSessionComponent[] sessions) {
+    public GetEventInfoDialog(Shell shell) {
         super(shell);
-        fIsKernel = isKernel;
-        fSessions = Arrays.copyOf(sessions, sessions.length);
         setShellStyle(SWT.RESIZE);
     }
 
@@ -129,6 +125,24 @@ public class GetEventInfoDialog extends Dialog implements IGetEventInfoDialog {
         return fChannel;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IGetEventInfoDialog#setIsKernel(boolean)
+     */
+    @Override
+    public void setIsKernel(boolean isKernel) {
+        fIsKernel = isKernel;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IGetEventInfoDialog#setSessions(org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent[])
+     */
+    @Override
+    public void setSessions(TraceSessionComponent[] sessions) {
+        fSessions = Arrays.copyOf(sessions, sessions.length);
+    }
+
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IConfirmDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/IConfirmDialog.java
new file mode 100644 (file)
index 0000000..0d413bf
--- /dev/null
@@ -0,0 +1,26 @@
+/**********************************************************************
+ * 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.ui.views.control.dialogs;
+
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * <b><u>IConfirmDialog</u></b>
+ * <p>
+ * Interface for a confirmation dialog.
+ * </p>
+ */
+public interface IConfirmDialog {
+    
+    public boolean openConfirm(Shell parent, String title, String message);
+    
+}
index 26cd0ce2b73c7b943c931dc6dfcb54d67fab2836..3e97c94d8fd9248c7376ba98fd72cf82491ee00c 100644 (file)
@@ -12,6 +12,7 @@
 package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
 
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
 
 /**
  * <b><u>ICreateChannelDialog</u></b>
@@ -29,6 +30,12 @@ public interface ICreateChannelDialog {
      */
     public IChannelInfo getChannelInfo();
     
+    /**
+     * Sets the domain component
+     * @param domain - the trace domain component
+     */
+    public void setDomainComponent(TraceDomainComponent domain);
+    
     // ------------------------------------------------------------------------
     // Operations
     // ------------------------------------------------------------------------
index eb42ac2af2025e8739742f68d02da4666c55d6ba..91eeeaa063005f755180b7c3fc09c4caa84f4b35 100644 (file)
@@ -11,6 +11,8 @@
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
 
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
+
 /**
  * <b><u>ICreateSessionDialog</u></b>
  * <p>
@@ -36,6 +38,12 @@ public interface ICreateSessionDialog {
      * @return true for default location else false
      */
     public boolean isDefaultSessionPath();
+    
+    /**
+     * Set trace session group.
+     * @param group - the session group
+     */
+    public void setTraceSessionGroup(TraceSessionGroup group);
 
     // ------------------------------------------------------------------------
     // Operations
index eb3230cc4e3865a92c3d2edd834cae0096d52979..e4bd698f8edf44267523204355b2d687f904e259 100644 (file)
@@ -11,6 +11,9 @@
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
 
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProviderGroup;
+
 /**
  * <b><u>IEnableKernelEvents</u></b>
  * <p>
@@ -26,6 +29,18 @@ public interface IEnableEventsDialog extends IEnableKernelEvents, IEnableUstEven
      * @return the session the events shall be enabled.
      */
     public boolean isKernel();
+    
+    /**
+     * Sets the trace provider group.
+     * @param providerGroup -  a trace provider group
+     */
+    public void setTraceProviderGroup(TraceProviderGroup providerGroup);
+    
+    /**
+     * Sets the trace domain component.
+     * @param domain - a domain of the events (null if not known)
+     */
+    public void setTraceDomainComponent(TraceDomainComponent domain);
 
     // ------------------------------------------------------------------------
     // Operations
index b4b09e1751bb2300dfd253acb3334571fcea0f44..39d74e5f4cfac8d6bd80fc8dd4e7d185737f283f 100644 (file)
@@ -34,6 +34,18 @@ public interface IGetEventInfoDialog {
      * @return the channel the events shall be enabled. Null for default channel.
      */
     public TraceChannelComponent getChannel();
+    
+    /**
+     * Sets flag about domain.
+     * @param isKernel - true for kernel, false for UST
+     */
+    public void setIsKernel(boolean isKernel);
+    
+    /**
+     * Sets available session.
+     * @param sessions - a array of available sessions.
+     */
+    public void setSessions(TraceSessionComponent[] sessions);
 
     // ------------------------------------------------------------------------
     // Operations
index acdceac6e4cd4718ca7f84563add84bc1d19ecb4..3b42d3ff3594573030b8a37d14deacc99b707a29 100644 (file)
@@ -11,6 +11,9 @@
  **********************************************************************/
 package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
 
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.rse.core.model.IHost;
+
 /**
  * <b><u>INewConnectionDialog</u></b>
  * <p>
@@ -31,6 +34,18 @@ public interface INewConnectionDialog {
      * @return the host name (IP address or DNS name)
      */
     public String getHostName();
+    
+    /**
+     * Sets the trace control root
+     * @param parent - the trace control parent
+     */
+    public void setTraceControlParent(ITraceControlComponent parent);
+    
+    /**
+     * Sets the available hosts to select.
+     * @param hosts - the available hosts
+     */
+    public void setHosts(IHost[] hosts);
 
     // ------------------------------------------------------------------------
     // Operations
index dd7edec72d49b3cfab5e3b726e7125ef78424835..d415a5bdf433251f5f0080145a8b9619104fd775 100644 (file)
@@ -103,12 +103,8 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
-    public NewConnectionDialog(Shell shell, ITraceControlComponent parent, IHost[] hosts) {
+    public NewConnectionDialog(Shell shell) {
         super(shell);
-        fParent = parent;
-        if (hosts != null) {
-            fExistingHosts = Arrays.copyOf(hosts, hosts.length);
-        }
         setShellStyle(SWT.RESIZE);
     }
 
@@ -132,6 +128,26 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog
     public String getHostName() {
         return fHostName;
     }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.INewConnectionDialog#setTraceControlParent(org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent)
+     */
+    @Override
+    public void setTraceControlParent(ITraceControlComponent parent) {
+        fParent = parent;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.dialogs.INewConnectionDialog#setHosts(org.eclipse.rse.core.model.IHost[])
+     */
+    @Override
+    public void setHosts(IHost[] hosts) {
+        if (hosts != null) {
+            fExistingHosts = Arrays.copyOf(hosts, hosts.length);
+        }
+    }
 
     // ------------------------------------------------------------------------
     // Operations
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/TraceControlDialogFactory.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/dialogs/TraceControlDialogFactory.java
new file mode 100644 (file)
index 0000000..584a154
--- /dev/null
@@ -0,0 +1,203 @@
+package org.eclipse.linuxtools.lttng.ui.views.control.dialogs;
+
+import org.eclipse.ui.PlatformUI;
+
+
+public class TraceControlDialogFactory {
+
+    // ------------------------------------------------------------------------
+    // Members
+    // ------------------------------------------------------------------------
+
+    /**
+     * The factory instance.
+     */
+    private static TraceControlDialogFactory fInstance;
+
+    /**
+     * The new connection dialog reference.
+     */
+    private INewConnectionDialog fNewConnectionDialog;
+    
+    /**
+     * The create channel dialog (on domain level)
+     */
+    private ICreateChannelDialog fCreateChannelDialog;
+    
+    /**
+     * The create channel dialog (on session level)
+     */
+    private ICreateChannelOnSessionDialog fCreateChannelOnSessionDialog;
+    
+    /**
+     * The create session dialog.
+     */
+    private ICreateSessionDialog fCreateSessionDialog;
+    
+    /**
+     * The enable events dialog.
+     */
+    private IEnableEventsDialog fEnableEventsDialog;
+    
+    /**
+     * The get event info dialog.
+     */
+    private IGetEventInfoDialog fGetEventInfoDialog;
+    
+    /**
+     * The confirmation dialog implementation
+     */
+    private IConfirmDialog fConfirmDialog;
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor for R4EUIDialogFactory.
+     */
+    private TraceControlDialogFactory() {
+    }
+
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /**
+     * @return TraceControlDialogFactory instance
+     */
+    public static TraceControlDialogFactory getInstance() {
+        if (null == fInstance) {
+            fInstance = new TraceControlDialogFactory();
+        }
+        return fInstance;
+    }
+
+    /**
+     * @return new connection dialog
+     */
+    public INewConnectionDialog getNewConnectionDialog() {
+        if (null == fNewConnectionDialog) {
+            fNewConnectionDialog = new NewConnectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fNewConnectionDialog;
+    }
+
+    /**
+     * Sets a new connection dialog implementation.
+     * @param newConnectionDialog - new connection dialog implementation
+     */
+    public void setNewConnectionDialog(INewConnectionDialog newConnectionDialog) {
+        fNewConnectionDialog = newConnectionDialog;
+    }
+    
+    /**
+     * @return create channel dialog (on domain level)
+     */
+    public ICreateChannelDialog getCreateChannelDialog() {
+        if (null == fCreateChannelDialog) {
+            fCreateChannelDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fCreateChannelDialog;
+    }
+
+    /**
+     * Sets a create channel dialog implementation (on domain level).
+     * @param createChannelDialog - a create channel dialog implementation
+     */
+    public void setCreateChannelDialog(ICreateChannelDialog createChannelDialog) {
+        fCreateChannelDialog = createChannelDialog;
+    }
+    
+    /**
+     * @return create channel dialog (on session level)
+     */
+    public ICreateChannelOnSessionDialog getCreateChannelOnSessionDialog() {
+        if (null == fCreateChannelOnSessionDialog) {
+            fCreateChannelOnSessionDialog = new CreateChannelDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fCreateChannelOnSessionDialog;
+    }
+
+    /**
+     * Sets a create channel dialog implementation (on domain level).
+     * @param createChannelDialog - a create channel dialog implementation
+     */
+    public void setCreateChannelOnSessionDialog(ICreateChannelOnSessionDialog createChannelDialog) {
+        fCreateChannelOnSessionDialog = createChannelDialog;
+    }
+
+    /**
+     * @return create session dialog implementation
+     */
+    public ICreateSessionDialog getCreateSessionDialog() {
+        if (null == fCreateSessionDialog) {
+            fCreateSessionDialog = new CreateSessionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fCreateSessionDialog;
+    }
+
+    /**
+     * Sets a create session dialog implementation.
+     * @param createSessionDialog - a create session implementation.
+     */
+    public void setCreateSessionDialog(ICreateSessionDialog createSessionDialog) {
+        fCreateSessionDialog = createSessionDialog;
+    }
+
+    /**
+     * @return enable events dialog implementation.
+     */
+    public IEnableEventsDialog getEnableEventsDialog() {
+        if (null == fEnableEventsDialog) {
+            fEnableEventsDialog = new EnableEventsDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fEnableEventsDialog;
+    }
+
+    /**
+     * Sets a enable events dialog implementation.
+     * @param enableEventsDialog - a enable events dialog implementation.
+     */
+    public void setEnableEventsDialog(IEnableEventsDialog enableEventsDialog) {
+        fEnableEventsDialog = enableEventsDialog;
+    }
+
+    /**
+     * @return get events info dialog implementation.
+     */
+    public IGetEventInfoDialog getGetEventInfoDialog() {
+        if (null == fGetEventInfoDialog) {
+            fGetEventInfoDialog = new GetEventInfoDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+        }
+        return fGetEventInfoDialog;
+    }
+
+    /**
+     * Sets a get events info dialog implementation.
+     * @param getEventInfoDialog - a get events info dialog implementation
+     */
+    public void setGetEventInfoDialog(IGetEventInfoDialog getEventInfoDialog) {
+        fGetEventInfoDialog = getEventInfoDialog;
+    }
+    
+    /**
+     * @return the confirmation dialog implementation
+     */
+    public IConfirmDialog getConfirmDialog() {
+        if (null == fConfirmDialog) {
+            fConfirmDialog = new ConfirmDialog();
+        }
+        return fConfirmDialog;
+    }
+    
+    /**
+     * Sets the confirmation dialog implementation
+     * @param confirmDialog
+     */
+    public void setConfirmDialog(IConfirmDialog confirmDialog) {
+        fConfirmDialog = confirmDialog;
+    }
+}
+
+
index c169e4259cf02920e9cfac076af74c851ee466d9..f2412bff04b4eb7deba4f238dde1b86c86091273 100644 (file)
@@ -15,7 +15,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -28,8 +27,8 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.GetEventInfoDialog;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IGetEventInfoDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.KernelProviderComponent;
@@ -38,9 +37,6 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceChannelComp
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 
 /**
  * <b><u>EnableEventHandler</u></b>
@@ -49,7 +45,7 @@ import org.eclipse.ui.PlatformUI;
  * This is done on the trace provider level.
  * </p>
  */
-public class AssignEventHandler extends AbstractHandler {
+public class AssignEventHandler extends BaseControlViewHandler {
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -80,14 +76,10 @@ public class AssignEventHandler extends AbstractHandler {
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
 
-        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
-        if (window == null) {
-            return false;
-        }
-
         // Open dialog box to retrieve the session and channel where the events should be enabled in.
-        final IGetEventInfoDialog dialog = new GetEventInfoDialog(window.getShell(), fIsKernel, fSessions);
+        final IGetEventInfoDialog dialog = TraceControlDialogFactory.getInstance().getGetEventInfoDialog();
+        dialog.setIsKernel(fIsKernel);
+        dialog.setSessions(fSessions);
 
         if (dialog.open() != Window.OK) {
             return null;
@@ -149,23 +141,12 @@ public class AssignEventHandler extends AbstractHandler {
         fSessions = null;
         fIsKernel = null;
 
-        // Check if we are closing down
-        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null) {
-            return false;
-        }
-
-        // Check if we are in the Project View
-        IWorkbenchPage page = window.getActivePage();
+     // Get workbench page for the Control View
+        IWorkbenchPage page = getWorkbenchPage();
         if (page == null) {
             return false;
         }
 
-        IWorkbenchPart part = page.getActivePart();
-        if (!(part instanceof ControlView)) {
-            return false;
-        }
-
         // Check if one or more session are selected
         ISelection selection = page.getSelection(ControlView.ID);
         if (selection instanceof StructuredSelection) {
index 8a128040b279b08a2d086c92b9e1377f7835222e..fd2bc2a1e128825becf9c42612df983a65b30d2c 100644 (file)
@@ -22,8 +22,8 @@ import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.EnableEventsDialog;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IEnableEventsDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
@@ -71,21 +71,13 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
     /**
      * Enables a dynamic probe.
      * @param eventName - a event name
+     * @param isFunction - true for dynamic function entry/return probe else false
      * @param probe - a dynamic probe information
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
-    abstract public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
+    abstract public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException;
     
-    /**
-     * Enables a dynamic function entry/return probe.
-     * @param eventName - a event name
-     * @param function - a dynamic function entry/return probe information
-     * @param monitor - a progress monitor 
-     * @throws ExecutionException
-     */
-    abstract public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
-
     /**
      * Enables events using log level
      * @param eventName - a event name
@@ -116,9 +108,11 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
 
         TargetNodeComponent node = fSession.getTargetNode();
         List<ITraceControlComponent> providers = node.getChildren(TraceProviderGroup.class);
-        
-        final IEnableEventsDialog dialog = new EnableEventsDialog(window.getShell(), (TraceProviderGroup)providers.get(0), getDomain());
-        
+
+        final IEnableEventsDialog dialog = TraceControlDialogFactory.getInstance().getEnableEventsDialog();
+        dialog.setTraceProviderGroup((TraceProviderGroup)providers.get(0));
+        dialog.setTraceDomainComponent(getDomain());
+
         if (dialog.open() != Window.OK) {
             return null;
         }
@@ -151,14 +145,14 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler {
                     // Enable dynamic probe
                     if (dialog.isDynamicProbe()) {
                         if ((dialog.getProbeEventName() != null && dialog.getProbeName() != null)) {
-                            enableProbe(dialog.getProbeEventName(), dialog.getProbeName(), monitor);
+                            enableProbe(dialog.getProbeEventName(), false, dialog.getProbeName(), monitor);
                         } 
                     }
 
                     // Enable dynamic function probe
                     if (dialog.isDynamicFunctionProbe()) {
                         if ((dialog.getFunctionEventName() != null) && (dialog.getFunction() != null)) {
-                            enableFunctionProbe(dialog.getFunctionEventName(), dialog.getFunction(), monitor);
+                            enableProbe(dialog.getFunctionEventName(), true, dialog.getFunction(), monitor);
                         } 
                     }
 
index a69f09808dcb4b5eb66bf64ae1a0ac07618615bb..ef10e9f17a9494a762f389a5fabb744de7aa5689 100644 (file)
@@ -120,8 +120,8 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler {
 
                         for (Iterator<TraceEventComponent> iterator = fEvents.iterator(); iterator.hasNext();) {
                             // Enable all selected channels which are disabled
-                            TraceEventComponent channel = (TraceEventComponent) iterator.next();
-                            channel.setState(getNewState());
+                            TraceEventComponent ev = (TraceEventComponent) iterator.next();
+                            ev.setState(getNewState());
                         }
                     }
                 } catch (ExecutionException e) {
index 65adabe53dc9de77909740d01e796f2d2a61e9ae..6d12265fb9099b280f658c8c954c9310aeca9835 100644 (file)
@@ -27,14 +27,12 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.CreateChannelDialog;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateChannelDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 
 /**
  * <b><u>CreateChannelOnDomainHandler</u></b>
@@ -62,14 +60,9 @@ public class CreateChannelOnDomainHandler extends BaseControlViewHandler {
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
 
-        final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
-        if (window == null) {
-            return false;
-        }
-
         // Get channel information from user
-        final ICreateChannelDialog dialog = new CreateChannelDialog(window.getShell(), fDomain);
+        final ICreateChannelDialog dialog = TraceControlDialogFactory.getInstance().getCreateChannelDialog();
+        dialog.setDomainComponent(fDomain);
 
         if (dialog.open() != Window.OK) {
             return null;
index e54ec436e18ba43b6c22aedf475ea25b11d3e45b..4becd61354e5481bd3111d98228a64f18fb02bb7 100644 (file)
@@ -27,14 +27,12 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.CreateChannelDialog;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateChannelOnSessionDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 
 /**
  * <b><u>CreateChannelOnSessionHandler</u></b>
@@ -63,13 +61,7 @@ public class CreateChannelOnSessionHandler extends BaseControlViewHandler {
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
 
-        final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
-        if (window == null) {
-            return false;
-        }
-
-        final ICreateChannelOnSessionDialog dialog = new CreateChannelDialog(window.getShell());
+        final ICreateChannelOnSessionDialog dialog =  TraceControlDialogFactory.getInstance().getCreateChannelOnSessionDialog();
 
         if (dialog.open() != Window.OK) {
             return null;
index 8d3f20addd9b1907dd615a0587dc6f8a13cd4fcc..a6b3b7bf25f33ab9e39a8a09f368486b277ede99 100644 (file)
@@ -23,12 +23,10 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.CreateSessionDialog;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.ICreateSessionDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 
 /**
  * <b><u>CreateSessionHandler</u></b>
@@ -55,13 +53,10 @@ public class CreateSessionHandler extends BaseControlViewHandler {
      */
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null) {
-            return false;
-        }
 
         // Open dialog box for the node name and address
-        ICreateSessionDialog dialog = new CreateSessionDialog(window.getShell(), fSessionGroup);
+        ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog();
+        dialog.setTraceSessionGroup(fSessionGroup);
 
         if (dialog.open() != Window.OK) {
             return null;
index 10baaac5ce80164801035e18c34d2c6a85dcc01e..5974124e527af9a080050a391840269e4456b228 100644 (file)
@@ -21,12 +21,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.IConfirmDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionGroup;
@@ -66,12 +67,12 @@ public class DestroySessionHandler extends BaseControlViewHandler {
             return false;
         }
         // Get user confirmation
-        if (!MessageDialog.openConfirm(window.getShell(), 
+        IConfirmDialog dialog = TraceControlDialogFactory.getInstance().getConfirmDialog();
+        if (!dialog.openConfirm(window.getShell(), 
                 Messages.TraceControl_DestroyConfirmationTitle, 
                 Messages.TraceControl_DestroyConfirmationMessage)) {
 
             return null;
-            
         }
 
         Job job = new Job(Messages.TraceControl_DestroySessionJob) {
index 8c0b02dc1920b8b1c00dbdde6aa897ca2f25b84c..2829137a5a02b0f673821323264b4ccf4cdab48d 100644 (file)
@@ -66,22 +66,13 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler {
 
     /*
      * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
      */
     @Override
-    public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fChannel.enableProbe(eventName, probe, monitor);
+    public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        fChannel.enableProbe(eventName, isFunction, probe, monitor);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fChannel.enableFunctionProbe(eventName, probe, monitor);
-    }
-    
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(java.lang.String, org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
index 1cda8bb445e0fc4ad16339e6fc80731bda87b5ad..72c1f0876cd6bdb1b2472a0791a972446fc85de0 100644 (file)
@@ -66,20 +66,11 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler {
 
     /*
      * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
      */
     @Override
-    public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fDomain.enableProbe(eventName, probe, monitor);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fDomain.enableFunctionProbe(eventName, probe, monitor);
+    public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        fDomain.enableProbe(eventName, isFunction, probe, monitor);
     }
 
     /*
index 620e37f510475086bf4cc6f509d914a357115d32..ca0e94422946a6221e7194395eabf6f92580512a 100644 (file)
@@ -62,22 +62,13 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler {
 
     /*
      * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableProbe(java.lang.String, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
      */
     @Override
-    public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fSession.enableProbe(eventName, probe, monitor);
+    public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        fSession.enableProbe(eventName, isFunction, probe, monitor);
     }
 
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableFunctionProbe(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        fSession.enableFunctionProbe(eventName, probe, monitor);
-    }
-    
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.handlers.BaseEnableEventHandler#enableLogLevel(java.lang.String, org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType, org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel, org.eclipse.core.runtime.IProgressMonitor)
index 0fba7326ba2dcb693f185f65737d8f427bc9ed4d..6656c03cb35ba7a809de83bee79f859c872c62fd 100644 (file)
@@ -18,7 +18,7 @@ import org.eclipse.jface.window.Window;
 import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
 import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
 import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.INewConnectionDialog;
-import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.NewConnectionDialog;
+import org.eclipse.linuxtools.lttng.ui.views.control.dialogs.TraceControlDialogFactory;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
 import org.eclipse.rse.core.IRSESystemType;
@@ -76,7 +76,9 @@ public class NewConnectionHandler extends BaseControlViewHandler {
         IHost[] hosts = registry.getHostsBySystemType(sysType);
 
         // Open dialog box for the node name and address
-        INewConnectionDialog dialog = new NewConnectionDialog(window.getShell(), fRoot, hosts);
+        final INewConnectionDialog dialog = TraceControlDialogFactory.getInstance().getNewConnectionDialog();
+        dialog.setTraceControlParent(fRoot);
+        dialog.setHosts(hosts);
 
         if (dialog.open() != Window.OK) {
             return null;
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/RefreshHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/handlers/RefreshHandler.java
new file mode 100644 (file)
index 0000000..f6f6f79
--- /dev/null
@@ -0,0 +1,93 @@
+/**********************************************************************
+ * 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.ui.views.control.handlers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.lttng.ui.views.control.ControlView;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TargetNodeState;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * <b><u>RefreshHandler</u></b>
+ * <p>
+ * Command handler implementation to refresh node configuration.
+ * </p>
+ */
+public class RefreshHandler extends BaseControlViewHandler {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /**
+     * The node component reference.
+     */
+    private TargetNodeComponent fNode;
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+     */
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        fNode.refresh();
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+     */
+    @Override
+    public boolean isEnabled() {
+        fNode = null;
+
+        // Get workbench page for the Control View
+        IWorkbenchPage page = getWorkbenchPage();
+        if (page == null) {
+            return false;
+        }
+
+        // Check if one or more session are selected
+        ISelection selection = page.getSelection(ControlView.ID);
+        if (selection instanceof StructuredSelection) {
+            
+            StructuredSelection structered = ((StructuredSelection) selection);
+            for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
+                Object element = (Object) iterator.next();
+                if (element instanceof TraceControlComponent) {
+                    TraceControlComponent component = (TraceControlComponent) element;
+                    boolean isConnected = component.getTargetNodeState() == TargetNodeState.CONNECTED;
+                    if (isConnected) {
+                        while ((component != null) && component.getClass() != TargetNodeComponent.class) {
+                            component = (TraceControlComponent) component.getParent();
+                        }
+                        if (component != null) {
+                            fNode = (TargetNodeComponent) component;
+                        }
+                    }
+                }
+            }
+        }
+        return fNode != null;
+    }
+}
index da4bf9691e6960989af561a380e2b4ebc35faffa..24a2a96cde4cfa2238ddb00c89ac7e878bf6fa3a 100644 (file)
@@ -101,7 +101,7 @@ TraceControl_EnableEventsLogLevelTooltip=The available log levels
 TraceControl_EnableEventsLoglevelEventNameTooltip=Event name for enabling log levels
 
 TraceControl_InvalidProbeNameError=The probe name is invalid 
-TraceControl_InvalidProbeNameError=The wild card name is invalid
+TraceControl_InvalidWildcardError=The wild card name is invalid
 TraceControl_InvalidLogLevelEventNameError=The event name for log level is invalid
 
 # Tree structure strings
@@ -135,3 +135,6 @@ TraceControl_HostAddressPropertyName=Host Name
 TraceControl_SessionPathPropertyName=Session Path
 TraceControl_ProviderNamePropertyName=Provider Name
 TraceControl_ProcessIdPropertyName=Process ID
+TraceControl_ProbeAddressPropertyName=Address
+TraceControl_ProbeOffsetPropertyName=Offset
+TraceControl_ProbeSymbolPropertyName=Symbol
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/IProbeEventInfo.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/IProbeEventInfo.java
new file mode 100644 (file)
index 0000000..9227d78
--- /dev/null
@@ -0,0 +1,54 @@
+/**********************************************************************
+ * 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.ui.views.control.model;
+
+/**
+ * <b><u>IProbeEventInfo</u></b>
+ * <p>
+ * Interface for retrieval of probe event information.
+ * </p>
+ */
+public interface IProbeEventInfo extends IEventInfo {
+
+    /**
+     * @return the address of the probe. (null if not used)
+     */
+    public String getAddress();
+    
+    /**
+     * Sets the address of the probe.
+     * @param address - a address (null if not used)
+     */
+    public void setAddress(String address);
+    
+    /**
+     * @return the offset applied to the symbol (null if not used).
+     */
+    public String getOffset();
+    
+    /**
+     * Sets the offset applied to the symbol.
+     * @param offset - a offset ((null if not used)
+     */
+    public void setOffset(String offset);
+
+    /**
+     * @return the symbol name. ((null if not used))
+     */
+    public String getSymbol();
+    
+    /**
+     * Sets the symbol name.
+     * @param symbol - a symbol name ((null if not used))
+     */
+    public void setSymbol(String symbol);
+}
index f03d6da92f4535ea435c7c66c676f3d50372b05d..29a07b62ee5915a0062616d86c798ee512223183 100644 (file)
@@ -29,4 +29,9 @@ public interface ITraceInfo {
      * @param name
      */
     public void setName(String name);
+    
+    /** 
+     * @return a formated (readable) String with content.
+     */
+    public String formatString();
 }
index 098fc5d9b0b6275486879b4eb0115053ba3b871e..b374e9446df005ec5fceadcc9e41883e42897f9c 100644 (file)
@@ -155,43 +155,67 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
         }
     }
     
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        //    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)");
+        output.append("\n      ");
+        output.append(getName());
+        if (fLogLevel != TraceLogLevel.LEVEL_UNKNOWN) {
+            output.append(" (loglevel: ");
+            output.append(fLogLevel.getInName());
+            output.append(" (");
+            output.append(fLogLevel.ordinal());
+            output.append("))");
+        }
+        output.append(" (type: ");
+        output.append(fEventType.getInName());
+        output.append(")");
+        return output.toString();
+    }
+    
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
      */
     @Override
     public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
-        result = 37 * result + fEventType.ordinal();
-        result = 37 * result + fLogLevel.ordinal();
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fEventType == null) ? 0 : (fEventType.ordinal() + 1));
+        result = prime * result + ((fLogLevel == null) ? 0 : (fLogLevel.ordinal() + 1));
         return result;
-    }
+    }    
 
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof BaseEventInfo)) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
             return false;
         }
-
-        BaseEventInfo otherInfo = (BaseEventInfo) other;
-        if (!super.equals(otherInfo)) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-
-        if (fEventType.ordinal() != otherInfo.fEventType.ordinal()) {
+        BaseEventInfo other = (BaseEventInfo) obj;
+        if (fEventType != other.fEventType) {
             return false;
         }
-        
-        if (fLogLevel.ordinal() != otherInfo.fLogLevel.ordinal()) {
+        if (fLogLevel != other.fLogLevel) {
             return false;
         }
         return true;
-    }
+    }    
 
     /*
      * (non-Javadoc)
@@ -210,4 +234,8 @@ public class BaseEventInfo extends TraceInfo implements IBaseEventInfo {
             output.append(")]");
             return output.toString();
     }
+
+
+
 }
\ No newline at end of file
index 468952971dda45979db7e478b238b729ad1e58b5..b2f0035d41467fe4761813bcee47ce94359d783c 100644 (file)
@@ -273,71 +273,122 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
         fEvents.add(channel);
     }
     
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        //- channel0: [enabled]
+        output.append("\n- ");
+        output.append(getName());
+        output.append(": [");
+        output.append(getState().getInName());
+        output.append("]\n");
+        //     Attributes:
+        output.append("\n    Attributes:\n");
+        //     overwrite mode: 0
+        output.append("      overwrite mode: ");
+        output.append(isOverwriteMode() ? "1" : "0");
+        //         subbufers size: 262144
+        output.append("\n      subbufers size: ");
+        output.append(getSubBufferSize());
+        //         number of subbufers: 4
+        output.append("\n      number of subbufers: ");
+        output.append(getNumberOfSubBuffers());
+        //        switch timer interval: 0
+        output.append("\n      switch timer interval: ");
+        output.append(getSwitchTimer());
+        //         read timer interval: 200
+        output.append("\n      read timer interval: ");
+        output.append(getReadTimer());
+        //         output: splice()
+        output.append("\n      output: ");
+        output.append(getOutputType());
+        output.append("\n\n");
+
+        output.append("    Events:");
+        if (fEvents.isEmpty()) {
+            output.append("\n      None");
+        } else {
+            for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
+                IEventInfo event = (IEventInfo) iterator.next();
+                output.append(event.formatString());
+            }
+        }
+        output.append("\n");
+
+        return output.toString();
+    }
+    
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
      */
     @Override
     public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
-        result = 37 * result + Boolean.valueOf(fOverwriteMode).hashCode();
-        result = 37 * result + Long.valueOf(fSubBufferSize).hashCode();
-        result = 37 * result + fNumberOfSubBuffers;
-        result = 37 * result + Long.valueOf(fSwitchTimer).hashCode();
-        result = 37 * result + Long.valueOf(fReadTimer).hashCode();
-        result = 37 * result + (fOutputType != null ? fOutputType.hashCode() : 0);
-        result = 37 * result + fState.ordinal();
-        for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
-            IEventInfo event = (IEventInfo) iterator.next();
-            result = 37 * result + event.hashCode();
-        }
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fEvents == null) ? 0 : fEvents.hashCode());
+        result = prime * result + fNumberOfSubBuffers;
+        result = prime * result + ((fOutputType == null) ? 0 : fOutputType.hashCode());
+        result = prime * result + (fOverwriteMode ? 1231 : 1237);
+        result = prime * result + (int) (fReadTimer ^ (fReadTimer >>> 32));
+        result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
+        result = prime * result + (int) (fSubBufferSize ^ (fSubBufferSize >>> 32));
+        result = prime * result + (int) (fSwitchTimer ^ (fSwitchTimer >>> 32));
         return result;
-    }
+    }  
 
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof ChannelInfo)) {
-            return false;
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
         }
-
-        ChannelInfo otherInfo = (ChannelInfo) other;
-        if (!super.equals(otherInfo)) {
+        if (!super.equals(obj)) {
             return false;
         }
-
-        if (fOverwriteMode != otherInfo.fOverwriteMode) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-        if (fSubBufferSize != otherInfo.fSubBufferSize) {
+        ChannelInfo other = (ChannelInfo) obj;
+        if (fEvents == null) {
+            if (other.fEvents != null) {
+                return false;
+            }
+        } else if (!fEvents.equals(other.fEvents)) {
             return false;
         }
-        if (fNumberOfSubBuffers != otherInfo.fNumberOfSubBuffers) {
+        if (fNumberOfSubBuffers != other.fNumberOfSubBuffers) {
             return false;
         }
-        if (fSwitchTimer != otherInfo.fSwitchTimer) {
+        if (fOutputType == null) {
+            if (other.fOutputType != null) {
+                return false;
+            }
+        } else if (!fOutputType.equals(other.fOutputType)) {
             return false;
         }
-        if (fReadTimer != otherInfo.fReadTimer) {
+        if (fOverwriteMode != other.fOverwriteMode) {
             return false;
         }
-        if (fState.ordinal() != otherInfo.fState.ordinal()) {
+        if (fReadTimer != other.fReadTimer) {
             return false;
         }
-        if (!fOutputType.equals(otherInfo.fOutputType)) {
+        if (fState != other.fState) {
             return false;
         }
-        if (fEvents.size() != otherInfo.fEvents.size()) {
+        if (fSubBufferSize != other.fSubBufferSize) {
             return false;
         }
-        for (int i = 0; i < fEvents.size(); i++) {
-            if (!fEvents.get(i).equals(otherInfo.fEvents.get(i))) {
-                return false;
-            }
+        if (fSwitchTimer != other.fSwitchTimer) {
+            return false;
         }
         return true;
     }
@@ -378,4 +429,6 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
             output.append(")]");
             return output.toString();
     }
+
+
 }
\ No newline at end of file
index 95c1d26366f3a6731937e183c00b78f7f6d92d48..1bf7994ba214eabab28f323bea84957e0e421b4e 100644 (file)
@@ -114,19 +114,45 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
         fChannels.add(channel);
     }
     
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        //=== Domain: Kernel ===
+        output.append("\n=== Domain: ");
+        output.append(getName());
+        output.append(" ===\n");
+        output.append("\n");
+        // Channels:
+        output.append("Channels:\n");
+        // -------------
+        output.append("-------------");
+        if (fChannels.isEmpty()) {
+            output.append("\nNone");
+        } else {
+            for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
+                IChannelInfo channel = (IChannelInfo) iterator.next();
+                output.append(channel.formatString());
+            }
+        }
+        output.append("\n");
+        return output.toString();
+    }
+    
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
      */
     @Override
     public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
-        for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
-            IChannelInfo channel = (IChannelInfo) iterator.next();
-            result = 37 * result + channel.hashCode();
-        }
-        result += 37 * result + (fIsKernel ? 1 : 0);
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fChannels == null) ? 0 : fChannels.hashCode());
+        result = prime * result + (fIsKernel ? 1231 : 1237);
         return result;
     }
 
@@ -135,31 +161,30 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof DomainInfo)) {
-            return false;
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
         }
-
-        DomainInfo otherInfo = (DomainInfo) other;
-        if (!super.equals(otherInfo)) {
+        if (!super.equals(obj)) {
             return false;
         }
-
-        if (fChannels.size() != otherInfo.fChannels.size()) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-        for (int i = 0; i < fChannels.size(); i++) {
-            if (!fChannels.get(i).equals(otherInfo.fChannels.get(i))) {
+        DomainInfo other = (DomainInfo) obj;
+        if (fChannels == null) {
+            if (other.fChannels != null) {
                 return false;
             }
+        } else if (!fChannels.equals(other.fChannels)) {
+            return false;
         }
-
-        if (fIsKernel != otherInfo.fIsKernel) {
+        if (fIsKernel != other.fIsKernel) {
             return false;
         }
         return true;
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#toString()
@@ -184,4 +209,5 @@ public class DomainInfo extends TraceInfo implements IDomainInfo {
             output.append(")]");
             return output.toString();
     }
+    
 }
index 9ecb0b1b65ffe5bb0f27a8e727a64a78aa47e1a6..8a16e3feb8a97bb37f566f46e0004e96714f630f 100644 (file)
@@ -72,6 +72,22 @@ public class EventInfo extends BaseEventInfo implements IEventInfo {
         fState = state;
     }
 
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        //    ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint) [enabled]");
+        output.append(super.formatString());
+        output.append(" [");
+        output.append(fState.getInName());
+        output.append("]");
+        return output.toString();
+    }
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo#setState(java.lang.String)
@@ -92,9 +108,9 @@ public class EventInfo extends BaseEventInfo implements IEventInfo {
      */
     @Override
     public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
-        result = 37 * result + fState.ordinal();
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
         return result;
     }
 
@@ -103,23 +119,23 @@ public class EventInfo extends BaseEventInfo implements IEventInfo {
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof EventInfo)) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
             return false;
         }
-
-        EventInfo otherInfo = (EventInfo) other;
-        if (!super.equals(otherInfo)) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-
-        if (fState.ordinal() != otherInfo.fState.ordinal()) {
+        EventInfo other = (EventInfo) obj;
+        if (fState != other.fState) {
             return false;
         }
         return true;
     }
-    
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo#toString()
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/ProbeEventInfo.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/ProbeEventInfo.java
new file mode 100644 (file)
index 0000000..e7865f0
--- /dev/null
@@ -0,0 +1,229 @@
+/**********************************************************************
+ * 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.ui.views.control.model.impl;
+
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo;
+
+/**
+* <b><u>ProbleEventInfo</u></b>
+* <p>
+* Implementation of the trace event interface (IProbeEventInfo) to store probe event
+* related data. 
+* </p>
+*/
+public class ProbeEventInfo extends EventInfo implements IProbeEventInfo {
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    /**
+     * The dynamic probe address (null if symbol is used).
+     */
+    private String fAddress;
+    /**
+     * The dynamic probe offset (if symbol is used).
+     */
+    private String fOffset;
+    
+    /**
+     * The symbol name (null if address is used)
+     */
+    private String fSymbol;
+    
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Constructor
+     * @param name - name of event
+     */
+    public ProbeEventInfo(String name) {
+        super(name);
+    }
+    
+    /**
+     * Copy constructor
+     * @param other - the instance to copy
+     */
+    public ProbeEventInfo(ProbeEventInfo other) {
+        super(other);
+        fAddress = other.fAddress;
+        fOffset = other.fOffset;
+        fSymbol = other.fSymbol;
+    }
+    
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#getAddress()
+     */
+    @Override
+    public String getAddress() {
+        return fAddress;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#setAddress(java.lang.String)
+     */
+    @Override
+    public void setAddress(String address) {
+        fAddress = address;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#getOffset()
+     */
+    @Override
+    public String getOffset() {
+        return fOffset;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#setOffset(java.lang.String)
+     */
+    @Override
+    public void setOffset(String offset) {
+        fOffset = offset;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#getSymbol()
+     */
+    @Override
+    public String getSymbol() {
+        return fSymbol;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo#setSymbol(java.lang.String)
+     */
+    @Override
+    public void setSymbol(String symbol) {
+        fSymbol = symbol;
+    }
+
+    // ------------------------------------------------------------------------
+    // Operation
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+   @SuppressWarnings("nls")
+   @Override
+   public String formatString() {
+       StringBuffer output = new StringBuffer();
+       //    name (type: probe) [enabled]");
+       //       address: 
+       output.append(super.formatString());
+       if (fAddress != null) {
+           output.append("\n        addr: ");
+           output.append(fAddress);
+       } else {
+           output.append("\n        offset: ");
+           output.append(fOffset);
+           output.append("\n");
+           output.append("        symbol: ");
+           output.append(fSymbol);
+       }
+       return output.toString();
+   }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fAddress == null) ? 0 : fAddress.hashCode());
+        result = prime * result + ((fOffset == null) ? 0 : fOffset.hashCode());
+        result = prime * result + ((fSymbol == null) ? 0 : fSymbol.hashCode());
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ProbeEventInfo other = (ProbeEventInfo) obj;
+        if (fAddress == null) {
+            if (other.fAddress != null) {
+                return false;
+            }
+        } else if (!fAddress.equals(other.fAddress)) {
+            return false;
+        }
+        if (fOffset == null) {
+            if (other.fOffset != null) {
+                return false;
+            }
+        } else if (!fOffset.equals(other.fOffset)) {
+            return false;
+        }
+        if (fSymbol == null) {
+            if (other.fSymbol != null) {
+                return false;
+            }
+        } else if (!fSymbol.equals(other.fSymbol)) {
+            return false;
+        }
+        return true;
+    }
+
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.EventInfo#toString()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    public String toString() {
+        StringBuffer output = new StringBuffer();
+            output.append("[ProbeEventInfo(");
+            output.append(super.toString());
+            if (fAddress != null) {
+                output.append(",fAddress=");
+                output.append(fAddress);
+            } else {
+                output.append(",fOffset=");
+                output.append(fOffset);
+                output.append(",fSymbol=");
+                output.append(fSymbol);
+            }
+            output.append(")]");
+            return output.toString();
+    }
+
+
+}
index ac6464762fd9da1e9115018077cf6b74ca1cebcc..5d074b1783be29e0b2df039a8417fc2c0414925e 100644 (file)
@@ -158,21 +158,45 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
     public void addDomain(IDomainInfo domainInfo) {
         fDomains.add(domainInfo);
     }
-    
+
     /*
      * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
      */
     @Override
-    public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
-        result = 37 * result + fSessionPath.hashCode();
-        result = 37 * result + fState.hashCode();
+    @SuppressWarnings("nls")
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        // Tracing session mysession: [active]
+        output.append("Tracing session ");
+        output.append(getName());
+        output.append(": [");
+        output.append(getSessionState().getInName());
+        output.append("]\n");
+        
+        //    Trace path: /home/user/lttng-traces/mysession-20120129-084256
+        output.append("    Trace path: ");
+        output.append(getSessionPath());
+        output.append("\n");
+        
         for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
             IDomainInfo domain = (IDomainInfo) iterator.next();
-            result = 37 * result + domain.hashCode();
+            output.append(domain.formatString());
         }
+        return output.toString();
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fDomains == null) ? 0 : fDomains.hashCode());
+        result = prime * result + ((fSessionPath == null) ? 0 : fSessionPath.hashCode());
+        result = prime * result + ((fState == null) ? 0 : (fState.ordinal() + 1));
         return result;
     }
 
@@ -181,34 +205,37 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof SessionInfo)) {
-            return false;
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
         }
-        SessionInfo otherInfo = (SessionInfo) other;
-        if (!super.equals(otherInfo)) {
+        if (!super.equals(obj)) {
             return false;
         }
-
-        if (!fSessionPath.equals(otherInfo.fSessionPath)) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-        
-        if (fState.ordinal() != otherInfo.fState.ordinal()) {
-            return false;
-        }
-        
-        if (fDomains.size() != otherInfo.fDomains.size()) {
+        SessionInfo other = (SessionInfo) obj;
+        if (fDomains == null) {
+            if (other.fDomains != null) {
+                return false;
+            }
+        } else if (!fDomains.equals(other.fDomains)) {
             return false;
         }
-        for (int i = 0; i < fDomains.size(); i++) {
-            if (!fDomains.get(i).equals(otherInfo.fDomains.get(i))) {
+        if (fSessionPath == null) {
+            if (other.fSessionPath != null) {
                 return false;
             }
+        } else if (!fSessionPath.equals(other.fSessionPath)) {
+            return false;
+        }
+        if (fState != other.fState) {
+            return false;
         }
         return true;
     }
-    
+
     /*
      * (non-Javadoc)
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#toString()
@@ -223,8 +250,8 @@ public class SessionInfo extends TraceInfo implements ISessionInfo {
             output.append(fState);
             output.append(",Domains=");
             for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
-                IDomainInfo channel = (IDomainInfo) iterator.next();
-                output.append(channel.toString());
+                IDomainInfo domain = (IDomainInfo) iterator.next();
+                output.append(domain.toString());
             }
             output.append(")]");
             return output.toString();
index 97c8bc5ec9050af7b7fc110db58b6dbf3a3d20a8..0b3775ac1cca2b559728788fba5049e7264cabe0 100644 (file)
@@ -285,7 +285,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
      * 
      * @throws ExecutionException
      */
-    public void getConfigurationFromNode() throws ExecutionException {
+    public void getConfigurationFromNode() {
         Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
             @Override
             protected IStatus run(IProgressMonitor monitor) {
@@ -310,7 +310,11 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
         };
         job.setUser(true);
         job.schedule();
+    }
 
+    public void refresh() {
+        removeAllChildren();
+        getConfigurationFromNode();
     }
 
     // ------------------------------------------------------------------------
index 7f4a08195bdebefb69fb1266e9fe8baa27c52757..d3572a81dd46f06f44692eb5c4103f503e246a91 100644 (file)
@@ -99,7 +99,13 @@ public class TraceChannelComponent extends TraceControlComponent {
         fChannelInfo = channelInfo;
         IEventInfo[] events = fChannelInfo.getEvents();
         for (int i = 0; i < events.length; i++) {
-            TraceEventComponent event = new TraceEventComponent(events[i].getName(), this);
+            TraceEventComponent event = null;
+            if (events[i].getClass() == ProbeEventInfo.class) {
+                event = new TraceProbeEventComponent(events[i].getName(), this);
+            } else {
+                event = new TraceEventComponent(events[i].getName(), this);
+            }
+
             event.setEventInfo(events[i]);
             addChild(event);
         }
@@ -286,45 +292,26 @@ public class TraceChannelComponent extends TraceControlComponent {
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
+     * @param isFunction - true for dynamic function entry/return probe else false
      * @param probe - the actual probe
      * @throws ExecutionException
      */
-    public void enableProbe(String eventName, String probe) throws ExecutionException {
-        enableProbe(eventName, probe, new NullProgressMonitor());
+    public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+        enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
     }
 
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
+     * @param isFunction - true for dynamic function entry/return probe else false 
      * @param probe - the actual probe
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
-    public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableProbe(getSessionName(), getName(), eventName, probe, monitor);
+    public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableProbe(getSessionName(), getName(), eventName, isFunction, probe, monitor);
     }
 
-    /**
-     * Enables a dynamic function entry/return probe (for kernel domain)
-     * @param eventName - event name for probe
-     * @param probe - the actual probe
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
-        enableFunctionProbe(eventName, probe, new NullProgressMonitor());
-    }
-    
-    /**
-     * Enables a dynamic function entry/return probe (for kernel domain)
-     * @param eventName - event name for probe
-     * @param probe - the actual probe
-     * @param monitor - a progress monitor
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableFunctionProbe(getSessionName(), getName(), eventName, probe, monitor);
-    }
-    
     /**
      * Enables events using log level.
      * @param eventName - a event name
index 237b473921b541fa31b8a257e390c7e5680cad66..28696f7dd8bad2e654d424996ce7eca2cfc94a35 100644 (file)
@@ -228,45 +228,26 @@ public class TraceDomainComponent extends TraceControlComponent {
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
-     * @param probe - the actual probe
+     * @param isFunction - true for dynamic function entry/return probe else false
+      * @param probe - the actual probe
      * @throws ExecutionException
      */
-    public void enableProbe(String eventName, String probe) throws ExecutionException {
-        enableProbe(eventName, probe, new NullProgressMonitor());
+    public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+        enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
     }
     
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
+     * @param isFunction - true for dynamic function entry/return probe else false
      * @param probe - the actual probe
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
-    public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableProbe(getSessionName(), null, eventName, probe, monitor);
+    public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableProbe(getSessionName(), null, eventName, isFunction, probe, monitor);
     }
 
-    /**
-     * Enables a dynamic function entry/return probe (for kernel domain)
-     * @param eventName - event name for probe
-     * @param probe - the actual probe
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
-        enableFunctionProbe(eventName, probe, new NullProgressMonitor());
-    }
-    
-    /**
-     * Enables a dynamic function entry/return probe (for kernel domain)
-     * @param eventName - event name for probe
-     * @param probe - the actual probe
-     * @param monitor - a progress monitor
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableFunctionProbe(getSessionName(), null, eventName, probe, monitor);
-    }
-    
     /**
      * Enables events using log level.
      * @param eventName - a event name
index 936be7521fee369dcf65b8a8e1c2bdc07bf5a12e..7fed4e75b0a7ad6089e0ca588e3bf0992d9a28f5 100644 (file)
@@ -24,7 +24,7 @@ import org.eclipse.ui.views.properties.IPropertySource;
 
 
 /**
- * <b><u>TraceChannelComponent</u></b>
+ * <b><u>TraceEventComponent</u></b>
  * <p>
  * Implementation of the trace channel component.
  * </p>
@@ -48,7 +48,7 @@ public class TraceEventComponent extends TraceControlComponent {
     /**
      * The event information.
      */
-    private IEventInfo fEventInfo = null;
+    protected IEventInfo fEventInfo = null;
     /**
      * The image to be displayed when in disabled state.
      */
index 5ae5e2e0f00da1439031ca183a94160d69b532d0..851478ff996316f5b68414cb6237198d10941d61 100644 (file)
@@ -77,16 +77,25 @@ public class TraceInfo implements ITraceInfo {
         fName = name;
     }
     
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
+     */
+    @Override
+    public String formatString() {
+        return toString();
+    }
+    
     /*
      * (non-Javadoc)
      * @see java.lang.Object#hashCode()
      */
     @Override
     public int hashCode() {
-        if (fName == null) {
-            return 17;
-        }
-        return fName.hashCode();
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((fName == null) ? 0 : fName.hashCode());
+        return result;
     }
 
     /*
@@ -94,15 +103,26 @@ public class TraceInfo implements ITraceInfo {
      * @see java.lang.Object#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof TraceInfo)) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
             return false;
         }
-
-        TraceInfo otherInfo = (TraceInfo) other;
-        return fName.equals(otherInfo.fName);
-    }
-    
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        TraceInfo other = (TraceInfo) obj;
+        if (fName == null) {
+            if (other.fName != null) {
+                return false;
+            }
+        } else if (!fName.equals(other.fName)) {
+            return false;
+        }
+        return true;
+    }    
     /*
      * (non-Javadoc)
      * @see java.lang.Object#toString()
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceProbeEventComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceProbeEventComponent.java
new file mode 100644 (file)
index 0000000..e473f94
--- /dev/null
@@ -0,0 +1,124 @@
+/**********************************************************************
+ * 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.ui.views.control.model.impl;
+
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceProbeEventPropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+
+/**
+ * <b><u>TraceProbeEventComponent</u></b>
+ * <p>
+ * Implementation of the trace channel component.
+ * </p>
+ */
+public class TraceProbeEventComponent extends TraceEventComponent {
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    /**
+     * Constructor 
+     * @param name - the name of the component.
+     * @param parent - the parent of this component.
+     */    
+    public TraceProbeEventComponent(String name, ITraceControlComponent parent) {
+        super(name, parent);
+        fEventInfo = new ProbeEventInfo(name);
+    }
+    
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
+
+    /**
+     * Sets the event information.
+     * @param eventInfo - the event information to set.
+     */
+    @Override
+    public void setEventInfo(IEventInfo eventInfo) {
+        if (eventInfo instanceof ProbeEventInfo) {
+            fEventInfo = eventInfo;
+            return;
+        }
+        throw new IllegalArgumentException("Invalid type passed. Only class of type ProbeEventInfo allowed:\n" + eventInfo.getClass()); //$NON-NLS-1$
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+     */
+    @SuppressWarnings("rawtypes")
+    @Override
+    public Object getAdapter(Class adapter) {
+        if (adapter == IPropertySource.class) {
+            return new TraceProbeEventPropertySource(this);
+        }
+        return null;
+    }
+    /**
+     * @return the address of the probe. (null if Symbol is used)
+     */
+    public String getAddress() {
+        return getEventInfo().getAddress();
+    }
+    /**
+     * Sets the address of the probe.
+     * @param address - a address
+     */
+    public void setAddress(String address) {
+        getEventInfo().setAddress(address);
+    }
+    /**
+     * @return the offset applied to the symbol.
+     */
+    public String getOffset() {
+        return getEventInfo().getOffset();
+    }
+    /**
+     * Sets the offset applied to the symbol. (valid if symbol is used)
+     * @param offset - a offset
+     */
+    public void setOffset(String offset) {
+        getEventInfo().setOffset(offset);
+    }
+    /**
+     * @return the symbol name. (null if address is used)
+     */
+    public String getSymbol() {
+        return getEventInfo().getSymbol();
+    }
+    /**
+     * Sets the symbol name.
+     * @param symbol - a symbol name (null if address is used)
+     */
+    public void setSymbol(String symbol) {
+        getEventInfo().setSymbol(symbol);
+    }
+    
+    // ------------------------------------------------------------------------
+    // Helper methods
+    // ------------------------------------------------------------------------
+    private ProbeEventInfo getEventInfo() {
+        return (ProbeEventInfo) fEventInfo;
+    }
+
+}
index d1f01fe97fd7e1029112f14128c248b8b096be5f..15f3b3eae0270c4810e2b82f53b2fa5a6d2e794f 100644 (file)
@@ -292,43 +292,24 @@ public class TraceSessionComponent extends TraceControlComponent {
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
+     * @param isFunction - true for dynamic function entry/return probe else false
      * @param probe - the actual probe
      * @throws ExecutionException
      */
-    public void enableProbe(String eventName, String probe) throws ExecutionException {
-        enableProbe(eventName, probe, new NullProgressMonitor());
+    public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException {
+        enableProbe(eventName, isFunction, probe, new NullProgressMonitor());
     }
     
     /**
      * Enables a dynamic probe (for kernel domain)
      * @param eventName - event name for probe
+     * @param isFunction - true for dynamic function entry/return probe else false
      * @param probe - the actual probe
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
-   public void enableProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableProbe(getName(), null, eventName, probe, monitor);
-    }
-
-   /**
-    * Enables a dynamic function entry/return probe (for kernel domain)
-    * @param eventName - event name for probe
-    * @param probe - the actual probe
-    * @throws ExecutionException
-    */
-    public void enableFunctionProbe(String eventName, String probe) throws ExecutionException {
-        enableFunctionProbe(eventName, probe, new NullProgressMonitor());
-    }
-    
-    /**
-     * Enables a dynamic function entry/return probe (for kernel domain)
-     * @param eventName - event name for probe
-     * @param probe - the actual probe
-     * @param monitor - a progress monitor
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        getControlService().enableFunctionProbe(getName(), null, eventName, probe, monitor);
+   public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
+        getControlService().enableProbe(getName(), null, eventName, isFunction, probe, monitor);
     }
     
     /**
index 537d7341177f2b1c980366affc9521d52f5d1a5f..c3d4b4cec7a402c62b32281246bc073b8cd2dd11 100644 (file)
@@ -125,16 +125,37 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo {
     
     /*
      * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceInfo#formatString()
      */
+    @SuppressWarnings("nls")
     @Override
-    public int hashCode() {
-        int result = 17;
-        result = 37 * result + super.hashCode();
+    public String formatString() {
+        StringBuffer output = new StringBuffer();
+        //PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+        output.append("\nPID: ");
+        output.append(fPid);
+        output.append(" - Name: ");
+        output.append(getName());
         for (Iterator<IBaseEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
             IBaseEventInfo event = (IBaseEventInfo) iterator.next();
-            result = 37 * result + event.hashCode();
+            output.append(event.formatString());
         }
+        output.append("\n");
+
+        return output.toString();
+    }
+
+    
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((fEvents == null) ? 0 : fEvents.hashCode());
+        result = prime * result + fPid;
         return result;
     }
 
@@ -143,23 +164,26 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo {
      * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceInfo#equals(java.lang.Object)
      */
     @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof UstProviderInfo)) {
-            return false;
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
         }
-
-        UstProviderInfo otherUstInfo = (UstProviderInfo) other;
-        if (!super.equals(otherUstInfo)) {
+        if (!super.equals(obj)) {
             return false;
         }
-
-        if (fEvents.size() != otherUstInfo.fEvents.size()) {
+        if (getClass() != obj.getClass()) {
             return false;
         }
-        for (int i = 0; i < fEvents.size(); i++) {
-            if (!fEvents.get(i).equals(otherUstInfo.fEvents.get(i))) {
+        UstProviderInfo other = (UstProviderInfo) obj;
+        if (fEvents == null) {
+            if (other.fEvents != null) {
                 return false;
             }
+        } else if (!fEvents.equals(other.fEvents)) {
+            return false;
+        }
+        if (fPid != other.fPid) {
+            return false;
         }
         return true;
     }
@@ -188,4 +212,6 @@ public class UstProviderInfo extends TraceInfo implements IUstProviderInfo {
             output.append(")]");
             return output.toString();
     }
+
 }
index f656dd3998f1a574d2147af946ddce31deeea0bd..fed66619134e2018ff91685a1eefd0345aba37c1 100644 (file)
@@ -70,7 +70,7 @@ public class TraceEventPropertySource extends BasePropertySource {
     /**
      * The event component which this property source is for. 
      */
-    private final TraceEventComponent fEvent;
+    protected final TraceEventComponent fEvent;
     
     // ------------------------------------------------------------------------
     // Constructors
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceProbeEventPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceProbeEventPropertySource.java
new file mode 100644 (file)
index 0000000..b8e60a6
--- /dev/null
@@ -0,0 +1,122 @@
+/**********************************************************************
+ * 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.ui.views.control.property;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceProbeEventComponent;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * <b><u>TraceEventPropertySource</u></b>
+ * <p>
+ * Property source implementation for the trace probe event component.
+ * </p>
+ */
+public class TraceProbeEventPropertySource extends TraceEventPropertySource {
+
+    // ------------------------------------------------------------------------
+    // Constants
+    // ------------------------------------------------------------------------
+    /**
+     * The trace event 'probe address' property ID.
+     */
+    public static final String TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID = "trace.event.probe.address"; //$NON-NLS-1$
+    /**
+     * The trace event 'probe offset' property ID.
+     */
+    public static final String TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID = "trace.event.probe.offset"; //$NON-NLS-1$
+    /**
+     * The trace event 'probe symbol' property ID.
+     */
+    public static final String TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID = "trace.event.probe.symbol"; //$NON-NLS-1$
+    /**
+     * The trace event 'probe address' property name.
+     */
+    public static final String TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME = Messages.TraceControl_ProbeAddressPropertyName;
+    /**
+     * The trace event 'probe offset' property ID.
+     */
+    public static final String TRACE_EVENT_PROBE_OFFSET_PROPERTY_NAME = Messages.TraceControl_ProbeOffsetPropertyName;
+    /**
+     * The trace event 'probe symbol' property ID.
+     */
+    public static final String TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME = Messages.TraceControl_ProbeSymbolPropertyName;
+
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+    
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+    public TraceProbeEventPropertySource(TraceEventComponent component) {
+        super(component);
+        if (component.getClass() != TraceProbeEventComponent.class) {
+            throw new IllegalArgumentException("Invalid type passed. Only class of type TraceProbeEventComponent allowed:\n" + component.getClass()); //$NON-NLS-1$
+        }
+    }
+    
+    // ------------------------------------------------------------------------
+    // Operations
+    // ------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
+     */
+    @Override
+    public IPropertyDescriptor[] getPropertyDescriptors() {
+        IPropertyDescriptor[] superProperties = super.getPropertyDescriptors();
+        List<IPropertyDescriptor> list = new ArrayList<IPropertyDescriptor>();
+        for (int i = 0; i < superProperties.length; i++) {
+            list.add(superProperties[i]);
+        }
+        
+        if (fEvent instanceof TraceProbeEventComponent) {
+            TraceProbeEventComponent event = (TraceProbeEventComponent) fEvent;
+            if (event.getAddress() != null) {
+                list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME));                
+            }
+
+            if (event.getOffset() != null) {
+                list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID, TRACE_EVENT_PROBE_OFFSET_PROPERTY_NAME));
+            }
+
+            if (event.getSymbol() != null) {
+                list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID, TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME));
+            }
+        }
+        return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
+     */
+    @Override
+    public Object getPropertyValue(Object id) {
+        if(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID.equals(id)) {
+            return ((TraceProbeEventComponent)fEvent).getAddress();
+        }
+        if (TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID.equals(id)) {
+            return ((TraceProbeEventComponent)fEvent).getOffset();
+        }
+        if (TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID.equals(id)) {
+            return ((TraceProbeEventComponent)fEvent).getSymbol();
+        }
+        return super.getPropertyValue(id);
+    }
+}
index 617a1c3d7ce096436ee7655eea689f6bbb11e7ed..6db57557206c65a7adaaf762766b4efeabfc015b 100644 (file)
@@ -106,7 +106,7 @@ public interface ILttngControlService {
      /**
       * Enables a list of channels for given session and given channel information (configuration). 
       * @param sessionName - a session name to create
-      * @param channelNames - a list of channel names to enable
+      * @param channelNames - a list of channel names to be enabled
       * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST) 
       * @param info - channel information used for creation of a channel (or null for default)
       * @param monitor - a progress monitor 
@@ -117,7 +117,7 @@ public interface ILttngControlService {
      /**
       * Disables a list of channels for given session and given channel information (configuration). 
       * @param sessionName - a session name to create
-      * @param channelNames - a list of channel names to enable
+      * @param channelNames - a list of channel names to be enabled
       * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST) 
       * @param monitor - a progress monitor 
       * @throws ExecutionException
@@ -127,8 +127,8 @@ public interface ILttngControlService {
     /**
      * Enables a list of events with no additional parameters.
      * @param sessionName - a session name
-     * @param channelName - a channel name (null for default channel)
-     * @param eventNames - a list of event names to enabled.
+     * @param channelName - a channel name or null for default channel
+     * @param eventNames - a list of event names to be enabled, or null (list of size = 0)for all events .
      * @param isKernel -  a flag for indicating kernel or UST.
      * @param monitor - a progress monitor
      * @throws ExecutionException
@@ -138,33 +138,23 @@ public interface ILttngControlService {
     /**
      * Enables all syscall events.
      * @param sessionName - a session name
-     * @param channelName - a channel name (null for default channel)
+     * @param channelName - a channel name or null for default channel
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
     public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException;
 
     /**
-     * Enables a dynamic probe.
+     * Enables a dynamic probe or dynamic function entry/return probe.
      * @param sessionName - a session name
-     * @param channelName - a channel name (null for default channel)
+     * @param channelName - a channel name or null for default channel
      * @param eventName - a event name
+     * @param isFunction - true for dynamic function entry/return probe else false 
      * @param probe - a dynamic probe information
      * @param monitor - a progress monitor
      * @throws ExecutionException
      */
-    public void enableProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException;
-
-    /**
-     * Enables a dynamic function entry/return probe.
-     * @param sessionName - a session name
-     * @param channelName - a channel name (null for default channel)
-     * @param eventName - a event name
-     * @param function - a dynamic function entry/return probe information
-     * @param monitor - a progress monitor 
-     * @throws ExecutionException
-     */
-    public void enableFunctionProbe(String sessionName, String channelName, String eventName, String function, IProgressMonitor monitor) throws ExecutionException;
+    public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException;
 
     /**
      * Enables events using log level
index efc980bc5ab8d0afa82366e37259fa5df90261c4..94290e27c7258a3c45f39b938796a7385a2bb1c4 100644 (file)
@@ -25,14 +25,17 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.IProbeEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.IUstProviderInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.LogLevelType;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ChannelInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.DomainInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.EventInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.ProbeEventInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.SessionInfo;
 import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderInfo;
 
@@ -211,6 +214,18 @@ public class LTTngControlService implements ILttngControlService {
      * Pattern to match a wildcarded event information (lttng list <session>)
      */
     private final static Pattern WILDCARD_EVENT_PATTERN = Pattern.compile("\\s+(.*)\\s+\\(type:\\s+(.*)\\)\\s+\\[(enabled|disabled)\\].*"); //$NON-NLS-1$
+    /**
+     * Pattern to match a probe address information (lttng list <session>)
+     */
+    private final static Pattern PROBE_ADDRESS_PATTERN = Pattern.compile("\\s+(addr)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$
+    /**
+     * Pattern to match a probe OFFSET information (lttng list <session>)
+     */
+    private final static Pattern PROBE_OFFSET_PATTERN = Pattern.compile("\\s+(offset)\\:\\s+(0x[0-9a-fA-F]{1,8})"); //$NON-NLS-1$
+    /**
+     * Pattern to match a probe SYMBOL information (lttng list <session>)
+     */
+    private final static Pattern PROBE_SYMBOL_PATTERN = Pattern.compile("\\s+(symbol)\\:\\s+(.+)"); //$NON-NLS-1$
     /**
      * Pattern to match for channel (overwite mode) information (lttng list
      * <session>)
@@ -340,9 +355,11 @@ public class LTTngControlService implements ILttngControlService {
      */
     @Override
     public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException {
+        
         String command = COMMAND_LIST + sessionName;
         ICommandResult result = fCommandShell.executeCommand(command, monitor);
-
+        
+        
         if (isError(result)) {
             throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
         }
@@ -743,13 +760,9 @@ public class LTTngControlService implements ILttngControlService {
         
         StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
 
-        if (eventNames == null) {
+        if (eventNames == null || eventNames.size() == 0) {
             command.append(OPTION_ALL);
         } else {
-            // no events to enable
-            if (eventNames.size() == 0) {
-                return;
-            }
 
             for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) {
                 String event = (String) iterator.next();
@@ -818,7 +831,7 @@ public class LTTngControlService implements ILttngControlService {
      * @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
      */
     @Override
-    public void enableProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
+    public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException {
         String newSessionName = formatParameter(sessionName);
         
         StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
@@ -833,46 +846,19 @@ public class LTTngControlService implements ILttngControlService {
             command.append(OPTION_CHANNEL);
             command.append(channelName);
         }
-        
-        command.append(OPTION_PROBE);
-        command.append(probe);
-        
-        ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
-        
-        if (isError(result)) {
-            throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
-        }        
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see org.eclipse.linuxtools.lttng.ui.views.control.service.ILttngControlService#enableFunctionProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor)
-     */
-    @Override
-    public void enableFunctionProbe(String sessionName, String channelName, String eventName, String probe, IProgressMonitor monitor) throws ExecutionException {
-        String newSessionName = formatParameter(sessionName);
-        
-        StringBuffer command = new StringBuffer(COMMAND_ENABLE_EVENT);
-
-        command.append(eventName);
-        command.append(OPTION_KERNEL);
-
-        command.append(OPTION_SESSION);
-        command.append(newSessionName);
-
-        if (channelName != null) {
-            command.append(OPTION_CHANNEL);
-            command.append(channelName);
+        if (isFunction) {
+            command.append(OPTION_FUNCTION_PROBE);
+        } else {
+            command.append(OPTION_PROBE);
         }
         
-        command.append(OPTION_FUNCTION_PROBE);
         command.append(probe);
         
         ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor);
         
         if (isError(result)) {
             throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + formatOutput(result.getOutput())); //$NON-NLS-1$ //$NON-NLS-2$
-        }   
+        }        
     }
 
     /*
@@ -1118,17 +1104,69 @@ public class LTTngControlService implements ILttngControlService {
                 eventInfo.setEventType(matcher.group(3).trim());
                 eventInfo.setState(matcher.group(4));
                 events.add(eventInfo);
+                index++;
             } else if (matcher2.matches()) {
                 IEventInfo eventInfo = new EventInfo(matcher2.group(1).trim());
                 eventInfo.setLogLevel(TraceLogLevel.LEVEL_UNKNOWN);
                 eventInfo.setEventType(matcher2.group(2).trim());
                 eventInfo.setState(matcher2.group(3));
-                events.add(eventInfo);
+                
+                if (eventInfo.getEventType() == TraceEventType.PROBE) {
+                    IProbeEventInfo probeEvent = new ProbeEventInfo(eventInfo.getName());
+                    probeEvent.setLogLevel(eventInfo.getLogLevel());
+                    probeEvent.setEventType(eventInfo.getEventType());
+                    probeEvent.setState(eventInfo.getState());
+
+                    // Overwrite eventinfo
+                    eventInfo = probeEvent;
+
+                    // myevent2 (type: probe) [enabled]
+                    // addr: 0xc0101340
+                    // myevent0 (type: probe) [enabled]
+                    // offset: 0x0
+                    // symbol: init_post
+                    index++;
+                    while (index < output.length) {
+                        String probeLine = output[index];
+                        // parse probe
+                        Matcher addrMatcher = PROBE_ADDRESS_PATTERN.matcher(probeLine);
+                        Matcher offsetMatcher = PROBE_OFFSET_PATTERN.matcher(probeLine);
+                        Matcher symbolMatcher = PROBE_SYMBOL_PATTERN.matcher(probeLine);
+                        if (addrMatcher.matches()) {
+                            String addr = addrMatcher.group(2).trim();
+                            probeEvent.setAddress(addr);
+                        } else if (offsetMatcher.matches()) {
+                            String offset = offsetMatcher.group(2).trim();
+                            probeEvent.setOffset(offset);
+                        } else if (symbolMatcher.matches()) {
+                            String symbol = symbolMatcher.group(2).trim();
+                            probeEvent.setSymbol(symbol);
+                        } else if ((EVENT_PATTERN.matcher(probeLine).matches()) || (WILDCARD_EVENT_PATTERN.matcher(probeLine).matches())) {
+                            break;
+                        } else if (CHANNEL_PATTERN.matcher(probeLine).matches()) {
+                            break;
+                        } else if (DOMAIN_KERNEL_PATTERN.matcher(probeLine).matches()) {
+                            // end of domain
+                            break;
+                        } else if (DOMAIN_UST_GLOBAL_PATTERN.matcher(probeLine).matches()) {
+                            // end of domain
+                            break;
+                        }
+                        index++;
+                    }
+                    events.add(eventInfo);
+                } else {
+                    events.add(eventInfo);
+                    index++;
+                    continue;
+                }
+            } else {
+                index++;
             }
 //            else if (line.matches(EVENT_NONE_PATTERN)) {
                 // do nothing
 //            } else 
-            index++;
+
         }
 
         return index;
This page took 0.10802 seconds and 5 git commands to generate.