From cfdb727a40c37882fd8c1ae8e4ad35c8020701c5 Mon Sep 17 00:00:00 2001
From: Alexandre Montplaisir
*/
+@SuppressWarnings("javadoc")
public class ActivatorTest extends TestCase {
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java
index d5aad5b37d..e34a1be605 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* 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:
* Francois Chouinard - Initial API and implementation
*******************************************************************************/
@@ -19,6 +19,7 @@ import junit.framework.TestSuite;
* AllTests
*
*/
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
index b40bafbb1e..3d44b0d10c 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
@@ -14,10 +14,11 @@ package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
import junit.framework.Test;
import junit.framework.TestSuite;
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
-
+
TestSuite suite = new TestSuite(AllTests.class.getName());
//$JUnit-BEGIN$
suite.addTestSuite(TraceControlComponentTest.class);
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java
index ff87552d6c..24065ab31d 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -16,8 +16,8 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceContr
/**
* The class can be used to validate the listener interface.
- *
*/
+@SuppressWarnings("javadoc")
public class ListenerValidator implements ITraceControlComponentChangedListener {
// ------------------------------------------------------------------------
@@ -26,11 +26,11 @@ public class ListenerValidator implements ITraceControlComponentChangedListener
private boolean fisAddedCalled = false;
private boolean fisRemoveCalled = false;
private boolean fisChangedCalled = false;
-
+
private ITraceControlComponent fParent = null;
private ITraceControlComponent fChild = null;
private ITraceControlComponent fChangedComponent = null;
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -49,11 +49,11 @@ public class ListenerValidator implements ITraceControlComponentChangedListener
public ITraceControlComponent getSavedParent() {
return fParent;
}
-
+
public ITraceControlComponent getSavedChild() {
return fChild;
}
-
+
public ITraceControlComponent getSavedComponent() {
return fChangedComponent;
}
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java
index 1fbd76ad68..a3c23f9e93 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* 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
*******************************************************************************/
@@ -15,14 +15,15 @@ import junit.extensions.TestSetup;
import junit.framework.Test;
/**
- * Test setup class for one-time setUp() and tearDown() across test cases.
+ * Test setup class for one-time setUp() and tearDown() across test cases.
*/
+@SuppressWarnings("javadoc")
public class ModelImplTestSetup extends TestSetup {
public ModelImplTestSetup(Test test) {
super(test);
}
-
+
/*
* (non-Javadoc)
* @see junit.extensions.TestSetup#setUp()
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java
index 51b4ff8d03..bf453acb14 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -37,20 +37,20 @@ import org.junit.Before;
* The class
* Dialog box for collecting information about contexts to be added to channels/events.
*
* Dialog box for collecting information events to be enabled.
*
* A composite for collecting information about kernel events to be enabled.
*
* A composite for collecting information about UST events to be enabled.
*
* Interface for a confirmation dialog.
*
* Interface for import traces dialog.
*
* Dialog box for collecting trace import information.
*
* Helper class for storing information about a remote file to import.
*
* Dialog box for connection information.
*
* Command handler implementation to add contexts to a given channel and all of its events.
*
* Command handler implementation to add contexts to all channels and all events.
*
* Command handler implementation to add contexts to a given event.
* TraceControlComponentTest
contains tests for the class {@link TraceControlComponent}
.
*
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlComponentTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlComponentTest.class));
@@ -83,13 +83,13 @@ public class TraceControlComponentTest extends TestCase {
@After
public void tearDown() throws Exception {
}
-
+
/**
* Run the TraceControlComponent(String) constructor test.
*/
public void testTraceControlComponent_1()
throws Exception {
-
+
String name = "node";
TraceControlComponent result = new TraceControlComponent(name);
@@ -135,7 +135,7 @@ public class TraceControlComponentTest extends TestCase {
fixture.addChild(new TraceControlRoot());
ITraceControlComponent component = new TraceControlRoot();
fixture.addChild(component);
-
+
ITraceControlComponent child = fixture.getChild(TraceControlRoot.TRACE_CONTROL_ROOT_NAME);
assertNotNull(child);
assertEquals(TraceControlRoot.TRACE_CONTROL_ROOT_NAME, child.getName());
@@ -163,7 +163,7 @@ public class TraceControlComponentTest extends TestCase {
* @throws Exception
*
*/
-
+
public void testAddComponentListener_1()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
@@ -175,7 +175,7 @@ public class TraceControlComponentTest extends TestCase {
TraceControlRoot root = new TraceControlRoot();
fixture.addChild(root);
assertTrue(validator.isAddedCalled());
-
+
fixture.removeChild(root);
assertTrue(validator.isRemovedCalled());
@@ -225,14 +225,14 @@ public class TraceControlComponentTest extends TestCase {
* @throws Exception
*
*/
-
+
public void testFireCompenentUpdated()
throws Exception {
ITraceControlComponent parent = new TraceControlRoot();
-
+
TraceControlComponent fixture = new TraceControlComponent("node", parent);
fixture.setToolTip("");
-
+
ITraceControlComponent component = new TraceControlComponent("child");
fixture.addChild(component);
@@ -243,9 +243,9 @@ public class TraceControlComponentTest extends TestCase {
assertTrue(validator.isAddedCalled());
assertEquals(parent.getName(), validator.getSavedParent().getName());
assertEquals(component.getName(), validator.getSavedChild().getName());
-
+
validator.initialize();
-
+
fixture.fireComponentRemoved(parent, component);
assertTrue(validator.isRemovedCalled());
assertEquals(parent.getName(), validator.getSavedParent().getName());
@@ -263,7 +263,7 @@ public class TraceControlComponentTest extends TestCase {
* @throws Exception
*
*/
-
+
public void testGetAdapter()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
@@ -309,37 +309,37 @@ public class TraceControlComponentTest extends TestCase {
*/
public void testGetAndSetControlService_1()
throws Exception {
-
+
TraceControlComponent parent = new TraceControlComponent("parent") {
ILttngControlService fService = null;
-
+
@Override
public void setControlService(ILttngControlService service ) {
fService = service;
}
-
+
@Override
public ILttngControlService getControlService() {
return fService;
}
};
-
+
TraceControlComponent fixture = new TraceControlComponent("", parent);
parent.addChild(fixture);
fixture.setToolTip("");
TraceControlComponent child = new TraceControlComponent("child", fixture);
fixture.addChild(child);
-
+
ILttngControlService result = fixture.getControlService();
assertEquals(null, result);
-
+
TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
ILttngControlService service = new LTTngControlService(proxy.createCommandShell());
fixture.setControlService(service);
result = fixture.getControlService();
assertNotNull(service);
assertEquals(service, result);
-
+
result = fixture.getChildren()[0].getControlService();
assertNotNull(service);
assertEquals(service, result);
@@ -359,7 +359,7 @@ public class TraceControlComponentTest extends TestCase {
Image result = fixture.getImage();
assertEquals(null, result);
-
+
fixture.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
assertNotNull(fixture.getImage());
}
@@ -410,7 +410,7 @@ public class TraceControlComponentTest extends TestCase {
fixture.addChild(new TraceControlRoot());
fixture.addChild(new TraceControlComponent("child"));
-
+
fixture.removeAllChildren();
assertFalse(fixture.hasChildren());
}
@@ -426,7 +426,7 @@ public class TraceControlComponentTest extends TestCase {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
fixture.setToolTip("");
TraceControlComponent child = new TraceControlComponent("child", fixture);
-
+
fixture.addChild(child);
fixture.removeChild(child);
assertFalse(fixture.hasChildren());
@@ -438,7 +438,7 @@ public class TraceControlComponentTest extends TestCase {
* @throws Exception
*
*/
-
+
public void testRemoveChild_2()
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot());
@@ -460,7 +460,7 @@ public class TraceControlComponentTest extends TestCase {
throws Exception {
TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null);
fixture.setToolTip("");
-
+
ListenerValidator validator = new ListenerValidator();
fixture.addComponentListener(validator);
@@ -470,7 +470,7 @@ public class TraceControlComponentTest extends TestCase {
TraceControlRoot root = new TraceControlRoot();
fixture.addChild(root);
assertFalse(validator.isAddedCalled());
-
+
fixture.removeChild(root);
assertFalse(validator.isRemovedCalled());
@@ -497,7 +497,7 @@ public class TraceControlComponentTest extends TestCase {
/**
* Run the void setChildren(ListTraceControlKernelProviderTests
contains UST provider handling
* test cases.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlKernelProviderTests extends TestCase {
// ------------------------------------------------------------------------
@@ -63,15 +63,15 @@ public class TraceControlKernelProviderTests extends TestCase {
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlKernelProviderTests.class));
@@ -110,22 +110,22 @@ public class TraceControlKernelProviderTests extends TestCase {
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
*/
public void testKernelProviderTree() throws Exception {
-
-
+
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
ISystemProfile profile = registry.createSystemProfile("myProfile", true);
IHost host = registry.createLocalHost(profile, "myProfile", "user");
-
+
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
root.addChild(node);
@@ -151,7 +151,7 @@ public class TraceControlKernelProviderTests extends TestCase {
ITraceControlComponent[] providers = groups[0].getChildren();
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
- // Get kernel provider events and select 2 events
+ // Get kernel provider events and select 2 events
ITraceControlComponent[] events = kernelProvider.getChildren();
assertNotNull(events);
assertEquals(3, events.length);
@@ -166,12 +166,12 @@ public class TraceControlKernelProviderTests extends TestCase {
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
@@ -187,21 +187,21 @@ public class TraceControlKernelProviderTests extends TestCase {
ITraceControlComponent[] components = { baseEventInfo0, baseEventInfo1 };
fFacility.executeCommand(components, "assign.event");
-
+
// 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];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("channel0", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
@@ -231,30 +231,30 @@ public class TraceControlKernelProviderTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event1.getState());
// ------------------------------------------------------------------------
- // Disable event components
+ // Disable event components
// ------------------------------------------------------------------------
ITraceControlComponent[] selection = { event, event1 };
fFacility.executeCommand(selection, "disableEvent");
-
+
assertEquals(TraceEnablement.DISABLED, event.getState());
assertEquals(TraceEnablement.DISABLED, event1.getState());
// ------------------------------------------------------------------------
- // Enable event component
+ // Enable event component
// ------------------------------------------------------------------------
fFacility.executeCommand(event1, "enableEvent");
-
+
// Verify event state
assertEquals(TraceEnablement.ENABLED, event1.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
@@ -263,7 +263,7 @@ public class TraceControlKernelProviderTests extends TestCase {
//-------------------------------------------------------------------------
fFacility.executeCommand(node, "disconnect");
assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
-
+
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
index b5364fbbe7..6000c30fa4 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -55,9 +55,9 @@ import org.osgi.framework.FrameworkUtil;
* handling test cases.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
public class TraceControlKernelSessionTests extends TestCase {
-
+
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
@@ -69,15 +69,15 @@ public class TraceControlKernelSessionTests extends TestCase {
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlKernelSessionTests.class));
@@ -116,15 +116,15 @@ public class TraceControlKernelSessionTests extends TestCase {
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
*/
public void testTraceSessionTree() throws Exception {
-
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
@@ -155,15 +155,15 @@ public class TraceControlKernelSessionTests extends TestCase {
TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub());
TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub());
TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub());
-
+
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
@@ -172,7 +172,7 @@ public class TraceControlKernelSessionTests extends TestCase {
// Initialize scenario
fProxy.setScenario(SCEN_SCENARIO3_TEST);
-
+
// ------------------------------------------------------------------------
// Enable channel on session
// ------------------------------------------------------------------------
@@ -181,21 +181,21 @@ public class TraceControlKernelSessionTests extends TestCase {
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that Kernel domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("Kernel", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
@@ -216,9 +216,9 @@ public class TraceControlKernelSessionTests extends TestCase {
info.setSwitchTimer(100);
info.setReadTimer(200);
channelStub.setChannelInfo(info);
-
+
fFacility.executeCommand(domains[0], "enableChannelOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -230,7 +230,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(2, channels.length);
assertTrue(channels[1] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
assertEquals("mychannel2", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
@@ -248,9 +248,9 @@ public class TraceControlKernelSessionTests extends TestCase {
eventsDialogStub.setNames(events);
eventsDialogStub.setIsKernel(true);
TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
-
+
// ------------------------------------------------------------------------
- // disable channels
+ // disable channels
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
@@ -263,12 +263,12 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(2, channels.length);
fFacility.executeCommand(channels, "disableChannel");
-
+
assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[0]).getState());
assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[1]).getState());
// ------------------------------------------------------------------------
- // enable channels
+ // enable channels
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
@@ -279,14 +279,14 @@ public class TraceControlKernelSessionTests extends TestCase {
channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(2, channels.length);
-
+
fFacility.executeCommand(channels, "enableChannel");
-
+
assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[0]).getState());
assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[1]).getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on session
+ // enable event (tracepoints) on session
// ------------------------------------------------------------------------
fFacility.executeCommand(session, "enableEventOnSession");
@@ -301,13 +301,13 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(3, channels.length);
assertTrue(channels[2] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
assertEquals("channel0", channel.getName());
// No need to check parameters of default channel because that has been done in other tests
ITraceControlComponent[] channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
assertTrue(channel0Events[1] instanceof TraceEventComponent);
@@ -324,7 +324,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on domain
+ // enable event (tracepoints) on domain
// ------------------------------------------------------------------------
events.clear();
events.add("sched_wakeup_new");
@@ -339,14 +339,14 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(3, channel0Events.length);
-
+
assertTrue(channel0Events[2] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[2];
@@ -356,14 +356,14 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (tracepoints) on channel
+ // enable event (tracepoints) on channel
// ------------------------------------------------------------------------
events.clear();
eventsDialogStub.setNames(events);
eventsDialogStub.setIsAllTracePoints(true);
fFacility.executeCommand(channels[1], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -373,10 +373,10 @@ public class TraceControlKernelSessionTests extends TestCase {
channels = domains[0].getChildren();
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[1];
-
+
channel0Events = channel.getChildren();
assertEquals(3, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
assertTrue(channel0Events[1] instanceof TraceEventComponent);
assertTrue(channel0Events[2] instanceof TraceEventComponent);
@@ -392,7 +392,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
event = (TraceEventComponent) channel0Events[2];
assertEquals("sched_wakeup_new", event.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel());
@@ -400,15 +400,15 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on channel
+ // enable event (syscall) on channel
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsSysCalls(true);
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -416,16 +416,16 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[0];
-
+
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
@@ -433,7 +433,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on domain
+ // enable event (syscall) on domain
// ------------------------------------------------------------------------
fFacility.executeCommand(domains[0], "enableEventOnDomain");
@@ -444,16 +444,16 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
@@ -461,7 +461,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // enable event (syscall) on session
+ // enable event (syscall) on session
// ------------------------------------------------------------------------
fFacility.executeCommand(session, "enableEventOnSession");
@@ -472,34 +472,34 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[2];
-
+
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("syscalls", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
assertEquals(TraceEventType.SYSCALL, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on domain
+ // enable event (dynamic probe) on domain
// ------------------------------------------------------------------------
events.clear();
eventsDialogStub.setIsSysCalls(false);
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("0xc0101280");
eventsDialogStub.setProbeEventName("myevent1");
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -507,14 +507,14 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(5, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
-
+
TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[0];
assertEquals("myevent1", probeEvent.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
@@ -525,14 +525,14 @@ public class TraceControlKernelSessionTests extends TestCase {
assertNull(probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on channel
+ // enable event (dynamic probe) on channel
// ------------------------------------------------------------------------
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("init_post");
eventsDialogStub.setProbeEventName("myevent2");
fFacility.executeCommand(channels[2], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -540,14 +540,14 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(6, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceProbeEventComponent);
-
+
probeEvent = (TraceProbeEventComponent) channel0Events[0];
assertEquals("myevent2", probeEvent.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
@@ -558,14 +558,14 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals("init_post", probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // enable event (dynamic probe) on session
+ // enable event (dynamic probe) on session
// ------------------------------------------------------------------------
eventsDialogStub.setIsDynamicProbe(true);
eventsDialogStub.setDynamicProbe("init_post:0x1000");
eventsDialogStub.setProbeEventName("myevent3");
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -573,7 +573,7 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
@@ -589,7 +589,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals("0x1000", probeEvent.getOffset());
assertNull(null, probeEvent.getAddress());
assertEquals("init_post", probeEvent.getSymbol());
-
+
// ------------------------------------------------------------------------
// enable event (dynamic function probe) on session
// ------------------------------------------------------------------------
@@ -601,7 +601,7 @@ public class TraceControlKernelSessionTests extends TestCase {
eventsDialogStub.setFunctionProbe("create_dev");
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -609,7 +609,7 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
@@ -625,7 +625,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals("0x0", probeEvent.getOffset());
assertNull(null, probeEvent.getAddress());
assertEquals("create_dev", probeEvent.getSymbol());
-
+
// ------------------------------------------------------------------------
// enable event (dynamic function probe) on domain
// ------------------------------------------------------------------------
@@ -634,7 +634,7 @@ public class TraceControlKernelSessionTests extends TestCase {
eventsDialogStub.setFunctionProbe("create_dev:0x2000");
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -642,7 +642,7 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
@@ -667,7 +667,7 @@ public class TraceControlKernelSessionTests extends TestCase {
eventsDialogStub.setFunctionProbe("create_dev:0x2000");
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -675,7 +675,7 @@ public class TraceControlKernelSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
@@ -693,7 +693,7 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals("create_dev", probeEvent.getSymbol());
// ------------------------------------------------------------------------
- // Add Context on domain
+ // Add Context on domain
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
@@ -707,13 +707,13 @@ public class TraceControlKernelSessionTests extends TestCase {
contexts.add("perf:cache-misses");
addContextStub.setContexts(contexts);
TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
-
+
fFacility.executeCommand(domains[0], "addContextOnDomain");
// Currently there is nothing to verify because the list commands don't show any context information
// However, the execution of the command make sure that the correct service command line is build and executed.
// ------------------------------------------------------------------------
- // Add Context on channel
+ // Add Context on channel
// ------------------------------------------------------------------------
// Get Kernel domain component instance
@@ -723,8 +723,8 @@ public class TraceControlKernelSessionTests extends TestCase {
//Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
-
+ channel = (TraceChannelComponent) channels[0];
+
try {
// The setContext() verifies that the contexts set are part of the available contexts
// The available contexts are set by the command handler addContextOnDomain above.
@@ -738,9 +738,9 @@ public class TraceControlKernelSessionTests extends TestCase {
fFacility.executeCommand(channel, "addContextOnChannel");
// Currently there is nothing to verify because the list commands don't show any context information
// However, the execution of the command make sure that the correct service command line is build and executed.
-
+
// ------------------------------------------------------------------------
- // Add Context on event
+ // Add Context on event
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
@@ -749,30 +749,30 @@ public class TraceControlKernelSessionTests extends TestCase {
//Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
-
+ channel = (TraceChannelComponent) channels[2];
+
channel0Events = channel.getChildren();
event = (TraceEventComponent) channel0Events[6];
-
+
fFacility.executeCommand(event, "addContextOnEvent");
// Currently there is nothing to verify because the list commands don't show any context information
- // However, the execution of the command make sure that the correct service command line is build and executed.
+ // However, the execution of the command make sure that the correct service command line is build and executed.
// ------------------------------------------------------------------------
- // Calibrate
+ // Calibrate
// ------------------------------------------------------------------------
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
-
+
fFacility.executeCommand(domains[0], "calibrate");
- // There is nothing to verify here.
+ // There is nothing to verify here.
// However, the execution of the command make sure that the correct service command line is build and executed.
-
+
// ------------------------------------------------------------------------
- // refresh
+ // refresh
// ------------------------------------------------------------------------
fFacility.executeCommand(node, "refresh");
groups = node.getChildren();
@@ -783,30 +783,30 @@ public class TraceControlKernelSessionTests extends TestCase {
assertEquals(1, groups[1].getChildren()[0].getChildren().length); // domains
assertEquals(3, groups[1].getChildren()[0].getChildren()[0].getChildren().length); // channels
assertEquals(2, groups[1].getChildren()[0].getChildren()[0].getChildren()[0].getChildren().length); // events (of channel[0])
-
+
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
session = (TraceSessionComponent)groups[1].getChildren()[0];
// ------------------------------------------------------------------------
- // start session
+ // start session
// ------------------------------------------------------------------------
fFacility.startSession(session);
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
-
+
// ------------------------------------------------------------------------
- // stop session
+ // stop session
// ------------------------------------------------------------------------
fFacility.stopSession(session);
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
@@ -815,13 +815,13 @@ public class TraceControlKernelSessionTests extends TestCase {
//-------------------------------------------------------------------------
fFacility.executeCommand(node, "disconnect");
assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
-
+
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
-
+
fFacility.executeCommand(node, "delete");
assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
}
-
+
}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
index ff63ad9bee..df0eda5e66 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -70,18 +70,18 @@ public class TraceControlPropertiesTest extends TestCase {
private static final String TEST_STREAM = "ListInfoTest.cfg";
private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlPropertiesTest.class));
@@ -115,19 +115,22 @@ public class TraceControlPropertiesTest extends TestCase {
public void tearDown() throws Exception {
TraceControlTestFacility.getInstance().waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
public void testComponentProperties() throws Exception {
-
+
TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), 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();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
@@ -161,11 +164,11 @@ public class TraceControlPropertiesTest extends TestCase {
adapter = node.getAdapter(IChannelInfo.class);
assertNull(adapter);
-
+
ITraceControlComponent[] groups = node.getChildren();
assertNotNull(groups);
assertEquals(2, groups.length);
-
+
ITraceControlComponent[] providers = groups[0].getChildren();
assertNotNull(providers);
@@ -175,7 +178,7 @@ public class TraceControlPropertiesTest extends TestCase {
// Verify Kernel Provider Properties (adapter)
// ------------------------------------------------------------------------
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
-
+
adapter = kernelProvider.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof KernelProviderPropertySource);
@@ -189,7 +192,7 @@ public class TraceControlPropertiesTest extends TestCase {
// Verify UST Provider Properties (adapter)
// ------------------------------------------------------------------------
UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
-
+
adapter = ustProvider.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof UstProviderPropertySource);
@@ -209,7 +212,7 @@ public class TraceControlPropertiesTest extends TestCase {
BaseEventComponent baseEventInfo = (BaseEventComponent) events[0];
assertNotNull(baseEventInfo);
-
+
adapter = baseEventInfo.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof BaseEventPropertySource);
@@ -257,7 +260,7 @@ public class TraceControlPropertiesTest extends TestCase {
assertNotNull(domainSource.getPropertyDescriptors());
assertEquals("Kernel", domainSource.getPropertyValue(TraceDomainPropertySource.TRACE_DOMAIN_NAME_PROPERTY_ID));
-
+
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(2, channels.length);
@@ -267,7 +270,7 @@ public class TraceControlPropertiesTest extends TestCase {
// ------------------------------------------------------------------------
assertTrue(channels[0] instanceof TraceChannelComponent);
TraceChannelComponent channel = (TraceChannelComponent) channels[0];
-
+
adapter = channel.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceChannelPropertySource);
@@ -283,7 +286,7 @@ public class TraceControlPropertiesTest extends TestCase {
assertEquals(String.valueOf(200), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_READ_TIMER_PROPERTY_ID));
assertEquals(String.valueOf(262144), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID));
assertEquals(String.valueOf(0), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID));
-
+
// ------------------------------------------------------------------------
// Verify Event Properties (adapter)
// ------------------------------------------------------------------------
@@ -291,28 +294,28 @@ public class TraceControlPropertiesTest extends TestCase {
assertNotNull(channel0Events);
assertEquals(5, channel0Events.length);
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
TraceEventComponent event = (TraceEventComponent) channel0Events[0];
-
+
adapter = event.getAdapter(IPropertySource.class);
assertNotNull(adapter);
assertTrue(adapter instanceof TraceEventPropertySource);
TraceEventPropertySource eventSource = (TraceEventPropertySource)adapter;
assertNotNull(eventSource.getPropertyDescriptors());
-
+
assertEquals("block_rq_remap", eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
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);
@@ -320,16 +323,16 @@ public class TraceControlPropertiesTest extends TestCase {
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);
@@ -337,13 +340,13 @@ public class TraceControlPropertiesTest extends TestCase {
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));
-
+
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java
index 436291ee95..e03b8eea40 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
@@ -27,29 +27,30 @@ import org.eclipse.ui.handlers.IHandlerService;
/**
* Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides
- * utility methods for interacting with the loader/view.
+ * utility methods for interacting with the loader/view.
*/
+@SuppressWarnings("javadoc")
public class TraceControlTestFacility {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- public final static int WAIT_FOR_JOBS_DELAY = 1000;
+ public final static int WAIT_FOR_JOBS_DELAY = 1000;
public final static int GUI_REFESH_DELAY = 500;
-
+
public final static String DIRECTORY = "testfiles"; //$NON-NLS-1$
public final static String COMMAND_CATEGORY_PREFIX = "org.eclipse.linuxtools.internal.lttng2.ui.commands.control."; //$NON-NLS-1$
public final static String SCEN_INIT_TEST = "Initialize"; //$NON-NLS-1$
public final static String SCEN_SCENARIO_SESSION_HANDLING = "SessionHandling"; //$NON-NLS-1$
public final static String SCEN_SCENARIO_SESSION_HANDLING_WITH_PATH = "SessionHandlingWithPath"; //$NON-NLS-1$
-
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
private static TraceControlTestFacility fInstance = null;
private ControlView fControlView = null;
private boolean fIsInitialized = false;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -70,28 +71,28 @@ public class TraceControlTestFacility {
* Initial the test facility.
*/
public void init() {
-
+
if (!fIsInitialized) {
IViewPart view;
try {
-
+
view = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.findView("org.eclipse.ui.internal.introview"); //$NON-NLS-1$
-
+
if (view != null) {
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
- .getActivePage().hideView(view);
+ .getActivePage().hideView(view);
}
view = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
- .showView(ControlView.ID);
-
+ .showView(ControlView.ID);
+
} catch (PartInitException e) {
throw new RuntimeException(e);
}
@@ -103,7 +104,7 @@ public class TraceControlTestFacility {
}
}
-
+
/**
* Disposes the facility (and GUI)
*/
@@ -168,7 +169,7 @@ public class TraceControlTestFacility {
setSelection(component);
executeCommand(commandId);
}
-
+
/**
* Executes an Eclipse command with command ID after selecting passed components
* @param components - array of components to select in the tree
@@ -208,7 +209,7 @@ public class TraceControlTestFacility {
waitForJobs();
}
-
+
/**
* Selects passed components
* @param components - array of component to select in the tree
@@ -220,7 +221,7 @@ public class TraceControlTestFacility {
// Selection is done in own job
waitForJobs();
}
-
+
/**
* Creates session on passed session group.
* @param group - session group
@@ -233,14 +234,14 @@ public class TraceControlTestFacility {
@SuppressWarnings("nls")
public TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(group, "createSession");
-
+
ITraceControlComponent[] sessions = group.getChildren();
if ((sessions == null) || (sessions.length == 0)) {
return null;
}
return (TraceSessionComponent)sessions[0];
}
-
+
/**
* Destroys a given session.
* @param session - session to destroy
@@ -253,7 +254,7 @@ public class TraceControlTestFacility {
public void destroySession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(session, "destroySession");
}
-
+
/**
* Starts a given session
* @param session - session to start
@@ -266,7 +267,7 @@ public class TraceControlTestFacility {
public void startSession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
executeCommand(session, "start");
}
-
+
/**
* Stops a given session
* @param session - session to stop
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
index 4c23bb34eb..8a913d1615 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -54,7 +54,7 @@ import org.osgi.framework.FrameworkUtil;
*/
@SuppressWarnings("nls")
public class TraceControlTreeModelTest extends TestCase {
-
+
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
@@ -62,21 +62,21 @@ public class TraceControlTreeModelTest extends TestCase {
private static final String TEST_STREAM = "ListInfoTest.cfg";
private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
private static final String TARGET_NODE_NAME = "myNode";
-
+
// ------------------------------------------------------------------------
// Test data
// ------------------------------------------------------------------------
-
+
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelTest.class));
@@ -114,16 +114,18 @@ public class TraceControlTreeModelTest extends TestCase {
public void tearDown() throws Exception {
TraceControlTestFacility.getInstance().waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
- public void testTraceControlComponents()
- throws Exception {
-
+ public void testTraceControlComponents() throws Exception {
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(SCEN_LIST_INFO_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
@@ -159,10 +161,10 @@ public class TraceControlTreeModelTest extends TestCase {
ITraceControlComponent[] groups = node.getChildren();
assertNotNull(groups);
assertEquals(2, groups.length);
-
+
assertTrue(groups[0] instanceof TraceProviderGroup);
assertTrue(groups[1] instanceof TraceSessionGroup);
-
+
assertEquals("Provider", groups[0].getName());
assertEquals("Sessions", groups[1].getName());
@@ -233,7 +235,7 @@ public class TraceControlTreeModelTest extends TestCase {
ustProvider = (UstProviderComponent) providers[2];
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello [PID=4852]", ustProvider.getName());
assertEquals(4852, ustProvider.getPid());
-
+
// verify getters and setter
verifyUstProviderGettersSetters(ustProvider);
@@ -254,10 +256,10 @@ public class TraceControlTreeModelTest extends TestCase {
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
// ------------------------------------------------------------------------
@@ -280,11 +282,11 @@ public class TraceControlTreeModelTest extends TestCase {
// Verify setters and setters
verifySessionGetterSetters(session);
-
+
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(2, domains.length);
-
+
// ------------------------------------------------------------------------
// Verify Kernel domain
// ------------------------------------------------------------------------
@@ -295,12 +297,12 @@ public class TraceControlTreeModelTest extends TestCase {
// Verify setters and setters
verifyDomainGettersSetters((TraceDomainComponent) domains[0]);
-
+
// ------------------------------------------------------------------------
// Verify Kernel's channel0
// ------------------------------------------------------------------------
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("channel0", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
@@ -321,13 +323,13 @@ public class TraceControlTreeModelTest extends TestCase {
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());
@@ -354,18 +356,18 @@ public class TraceControlTreeModelTest extends TestCase {
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];
+ channel = (TraceChannelComponent) channels[1];
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("splice()", channel.getOutputType());
assertEquals(true, channel.isOverwriteMode());
@@ -384,9 +386,9 @@ public class TraceControlTreeModelTest extends TestCase {
// 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);
}
@@ -394,7 +396,7 @@ public class TraceControlTreeModelTest extends TestCase {
// ------------------------------------------------------------------------
// Verify UST global's mychannel1
// ------------------------------------------------------------------------
- channel = (TraceChannelComponent) ustChannels[0];
+ channel = (TraceChannelComponent) ustChannels[0];
assertEquals("mychannel1", channel.getName());
assertEquals(8, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
@@ -403,8 +405,8 @@ public class TraceControlTreeModelTest extends TestCase {
assertEquals(TraceEnablement.DISABLED, channel.getState());
assertEquals(8192, channel.getSubBufferSize());
assertEquals(200, channel.getSwitchTimer());
-
- // verify getters and setters
+
+ // verify getters and setters
verifyChannelGettersSetters(channel);
// ------------------------------------------------------------------------
@@ -431,31 +433,31 @@ public class TraceControlTreeModelTest extends TestCase {
// ------------------------------------------------------------------------
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());
-
+
node.getParent().removeChild(node);
}
-
+
private void verifySessionGetterSetters(TraceSessionComponent session) {
// save original values
String name = session.getName();
@@ -465,7 +467,7 @@ public class TraceControlTreeModelTest extends TestCase {
// test cases
session.setName("newName");
assertEquals("newName", session.getName());
-
+
session.setSessionPath("/home/user/tmp");
assertEquals("/home/user/tmp", session.getSessionPath());
@@ -473,7 +475,7 @@ public class TraceControlTreeModelTest extends TestCase {
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
Image inactiveImage = session.getImage();
assertNotNull(inactiveImage);
-
+
session.setSessionState("active");
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
@@ -489,13 +491,13 @@ public class TraceControlTreeModelTest extends TestCase {
for (int i = 0; i < domains.length; i++) {
assertEquals(domains[i].getName(), children[i].getName());
}
-
- // restore original values
+
+ // restore original values
session.setName(name);
session.setSessionPath(origPath);
session.setSessionState(origState);
}
-
+
private void verifyDomainGettersSetters(TraceDomainComponent domain) {
// save original values
boolean isKernel = domain.isKernel();
@@ -526,11 +528,11 @@ public class TraceControlTreeModelTest extends TestCase {
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");
@@ -540,24 +542,24 @@ public class TraceControlTreeModelTest extends TestCase {
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");
@@ -567,10 +569,10 @@ public class TraceControlTreeModelTest extends TestCase {
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);
@@ -587,29 +589,29 @@ public class TraceControlTreeModelTest extends TestCase {
event.setEventType(type);
event.setState(state);
}
-
+
private void verifyProbeEventGettersSetters(TraceProbeEventComponent event) {
// save original values
String address = event.getAddress();
String offset = event.getOffset();
String symbol = event.getSymbol();
-
+
// test cases
event.setAddress("0xffff1234");
assertEquals("0xffff1234", event.getAddress());
-
+
event.setOffset("0x1234");
assertEquals("0x1234", event.getOffset());
-
+
event.setSymbol("init");
assertEquals("init", event.getSymbol());
-
+
// restore original values
event.setAddress(address);
event.setOffset(offset);
event.setSymbol(symbol);
}
-
+
private void verifyChannelGettersSetters(TraceChannelComponent channel) {
// save original values
String name = channel.getName();
@@ -620,26 +622,26 @@ public class TraceControlTreeModelTest extends TestCase {
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);
@@ -648,10 +650,10 @@ public class TraceControlTreeModelTest extends TestCase {
Image disabledImage = channel.getImage();
assertNotNull(disabledImage);
assertNotSame(enabledImage, disabledImage);
-
+
channel.setSubBufferSize(1024);
assertEquals(1024, channel.getSubBufferSize());
-
+
channel.setSwitchTimer(1000);
assertEquals(1000, channel.getSwitchTimer());
@@ -665,19 +667,19 @@ public class TraceControlTreeModelTest extends TestCase {
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);
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
index 7a29c63e14..e519a57d35 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -65,15 +65,15 @@ public class TraceControlUstProviderTests extends TestCase {
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlUstProviderTests.class));
@@ -112,15 +112,18 @@ public class TraceControlUstProviderTests extends TestCase {
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
public void testUstProviderTree() throws Exception {
-
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
@@ -129,9 +132,9 @@ public class TraceControlUstProviderTests extends TestCase {
TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
root.addChild(node);
-
+
fFacility.waitForJobs();
-
+
fFacility.executeCommand(node, "connect");
int i = 0;
@@ -139,7 +142,7 @@ public class TraceControlUstProviderTests extends TestCase {
i++;
fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
}
-
+
// Verify that node is connected
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
@@ -152,7 +155,7 @@ public class TraceControlUstProviderTests extends TestCase {
ITraceControlComponent[] providers = groups[0].getChildren();
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
- // Get kernel provider events and select 2 events
+ // Get kernel provider events and select 2 events
ITraceControlComponent[] events = kernelProvider.getChildren();
assertNotNull(events);
assertEquals(3, events.length);
@@ -176,13 +179,13 @@ public class TraceControlUstProviderTests extends TestCase {
TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub);
TraceSessionComponent session = fFacility.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());
-
+
// ------------------------------------------------------------------------
// Enable Channel on UST global domain
// ------------------------------------------------------------------------
@@ -196,21 +199,21 @@ public class TraceControlUstProviderTests extends TestCase {
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelDialogStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that UST domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("UST global", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[]channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
@@ -239,7 +242,7 @@ public class TraceControlUstProviderTests extends TestCase {
ITraceControlComponent[] ustSelection = { baseEventInfo0, baseEventInfo1 };
fFacility.executeCommand(ustSelection, "assign.event");
-
+
// verify that events were created under the channel
// Note that domain and channel has to be re-read because the tree is re-created
@@ -264,29 +267,29 @@ public class TraceControlUstProviderTests extends TestCase {
assertEquals(TraceEnablement.ENABLED, event.getState());
// ------------------------------------------------------------------------
- // Disable event components
+ // Disable event components
// ------------------------------------------------------------------------
fFacility.executeCommand(event, "disableEvent");
-
+
assertEquals(TraceEnablement.DISABLED, event.getState());
// ------------------------------------------------------------------------
- // Enable event component
+ // Enable event component
// ------------------------------------------------------------------------
fFacility.executeCommand(event, "enableEvent");
// Verify event state
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
index 052ef2cb7a..9856aa8ac0 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
@@ -67,15 +67,15 @@ public class TraceControlUstSessionTests extends TestCase {
// ------------------------------------------------------------------------
private TraceControlTestFacility fFacility;
private TestRemoteSystemProxy fProxy;
- private String fTestFile;
-
+ private String fTestFile;
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
/**
* Returns test setup used when executing test case stand-alone.
- * @return Test setup class
+ * @return Test setup class
*/
public static Test suite() {
return new ModelImplTestSetup(new TestSuite(TraceControlUstSessionTests.class));
@@ -114,15 +114,18 @@ public class TraceControlUstSessionTests extends TestCase {
public void tearDown() throws Exception {
fFacility.waitForJobs();
}
-
+
/**
* Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
*/
public void testTraceSessionTree() throws Exception {
-
+
fProxy.setTestFile(fTestFile);
fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST);
-
+
ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
@@ -153,12 +156,12 @@ public class TraceControlUstSessionTests extends TestCase {
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
-
+
// ------------------------------------------------------------------------
// Create session
// ------------------------------------------------------------------------
TraceSessionComponent session = fFacility.createSession(groups[1]);
-
+
// Verify that session was created
assertNotNull(session);
assertEquals("mysession", session.getName());
@@ -167,7 +170,7 @@ public class TraceControlUstSessionTests extends TestCase {
// Initialize scenario
fProxy.setScenario(SCEN_SCENARIO4_TEST);
-
+
// ------------------------------------------------------------------------
// Enable default channel on created session above
// ------------------------------------------------------------------------
@@ -176,21 +179,21 @@ public class TraceControlUstSessionTests extends TestCase {
TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub);
fFacility.executeCommand(session, "enableChannelOnSession");
-
+
// Verify that Kernel domain was created
ITraceControlComponent[] domains = session.getChildren();
assertNotNull(domains);
assertEquals(1, domains.length);
assertEquals("UST global", domains[0].getName());
-
+
// Verify that channel was created with correct data
ITraceControlComponent[] channels = domains[0].getChildren();
assertNotNull(channels);
assertEquals(1, channels.length);
assertTrue(channels[0] instanceof TraceChannelComponent);
- TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
assertEquals("mychannel", channel.getName());
assertEquals(4, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
@@ -211,7 +214,7 @@ public class TraceControlUstSessionTests extends TestCase {
info.setSwitchTimer(100);
info.setReadTimer(200);
channelStub.setChannelInfo(info);
-
+
fFacility.executeCommand(domains[0], "enableChannelOnDomain");
// Get Kernel domain component instance
@@ -225,7 +228,7 @@ public class TraceControlUstSessionTests extends TestCase {
assertEquals(2, channels.length);
assertTrue(channels[1] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
assertEquals("mychannel2", channel.getName());
assertEquals(2, channel.getNumberOfSubBuffers());
assertEquals("mmap()", channel.getOutputType());
@@ -245,9 +248,9 @@ public class TraceControlUstSessionTests extends TestCase {
eventsDialogStub.setNames(events);
eventsDialogStub.setIsKernel(false);
TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub);
-
+
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -259,13 +262,13 @@ public class TraceControlUstSessionTests extends TestCase {
assertEquals(3, channels.length);
assertTrue(channels[2] instanceof TraceChannelComponent);
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
assertEquals("channel0", channel.getName());
// No need to check parameters of default channel because that has been done in other tests
ITraceControlComponent[] channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
TraceEventComponent event = (TraceEventComponent) channel0Events[0];
@@ -280,9 +283,9 @@ public class TraceControlUstSessionTests extends TestCase {
events.clear();
events.add("ust_tests_hello:tptest");
eventsDialogStub.setNames(events);
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -290,12 +293,12 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[1] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[1];
@@ -320,14 +323,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[1];
+ channel = (TraceChannelComponent) channels[1];
// No need to check parameters of default channel because that has been done in other tests
channel = (TraceChannelComponent) channels[1];
-
+
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
event = (TraceEventComponent) channel0Events[0];
@@ -340,7 +343,7 @@ public class TraceControlUstSessionTests extends TestCase {
// Enable event (wildcard) on specific channel
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
@@ -354,14 +357,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("ust*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
@@ -372,7 +375,7 @@ public class TraceControlUstSessionTests extends TestCase {
// Enable event (wildcard) on domain
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
@@ -386,14 +389,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(1, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("ust*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
@@ -404,7 +407,7 @@ public class TraceControlUstSessionTests extends TestCase {
// Enable event (wildcard) on session
// ------------------------------------------------------------------------
events.clear();
- eventsDialogStub.setIsTracePoints(false);
+ eventsDialogStub.setIsTracePoints(false);
eventsDialogStub.setIsAllTracePoints(false);
eventsDialogStub.setIsWildcard(true);
eventsDialogStub.setWildcard("ust*");
@@ -418,14 +421,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(4, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("u*", event.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel());
@@ -441,7 +444,7 @@ public class TraceControlUstSessionTests extends TestCase {
eventsDialogStub.setLogLevelEventName("myevent1");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_WARNING);
-
+
fFacility.executeCommand(domains[0], "enableEventOnDomain");
// Get Kernel domain component instance
@@ -451,14 +454,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(5, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent1", event.getName());
assertEquals(TraceLogLevel.TRACE_WARNING, event.getLogLevel());
@@ -471,9 +474,9 @@ public class TraceControlUstSessionTests extends TestCase {
eventsDialogStub.setLogLevelEventName("myevent2");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
-
+
fFacility.executeCommand(session, "enableEventOnSession");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -481,14 +484,14 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[2];
+ channel = (TraceChannelComponent) channels[2];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(6, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent2", event.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
@@ -501,9 +504,9 @@ public class TraceControlUstSessionTests extends TestCase {
eventsDialogStub.setLogLevelEventName("myevent0");
eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY);
eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION);
-
+
fFacility.executeCommand(channels[0], "enableEventOnChannel");
-
+
// Get Kernel domain component instance
domains = session.getChildren();
assertNotNull(domains);
@@ -511,28 +514,28 @@ public class TraceControlUstSessionTests extends TestCase {
// Verify that channel was created with correct data
channels = domains[0].getChildren();
- channel = (TraceChannelComponent) channels[0];
+ channel = (TraceChannelComponent) channels[0];
// No need to check parameters of default channel because that has been done in other tests
channel0Events = channel.getChildren();
assertEquals(2, channel0Events.length);
-
+
assertTrue(channel0Events[0] instanceof TraceEventComponent);
-
+
event = (TraceEventComponent) channel0Events[0];
assertEquals("myevent0", event.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, event.getEventType());
assertEquals(TraceEnablement.ENABLED, event.getState());
-
+
// ------------------------------------------------------------------------
- // Destroy session
+ // Destroy session
// ------------------------------------------------------------------------
// Initialize session handling scenario
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
fFacility.destroySession(session);
-
+
// Verify that no more session components exist
assertEquals(0, groups[1].getChildren().length);
@@ -545,7 +548,7 @@ public class TraceControlUstSessionTests extends TestCase {
//-------------------------------------------------------------------------
// Delete node
//-------------------------------------------------------------------------
-
+
fFacility.executeCommand(node, "delete");
assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length);
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java
index c259c15e08..7ad5ed2c16 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 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
*******************************************************************************/
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.lttng2.ui.tests.control.service;
import junit.framework.Test;
import junit.framework.TestSuite;
+@SuppressWarnings("javadoc")
public class AllTests {
public static Test suite() {
diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
index 6c4cb9819c..2466fd143e 100644
--- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
+++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.lttng2.ui.tests.control.service;
@@ -45,12 +45,12 @@ import org.osgi.framework.FrameworkUtil;
/**
* The class LTTngControlServiceTest
contains test for the class {@link LTTngControlService}
.
*/
-@SuppressWarnings("nls")
+@SuppressWarnings({"nls", "javadoc"})
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_LTTNG_VERSION = "LttngVersion";
private static final String SCEN_LTTNG_UNSUPPORTED_VERSION = "LttngUnsupportedVersion";
@@ -80,7 +80,7 @@ public class LTTngControlServiceTest extends TestCase {
private LTTngToolsFileShell fShell;
private ILttngControlService fService;
-
+
// ------------------------------------------------------------------------
// Static methods
// ------------------------------------------------------------------------
@@ -102,7 +102,7 @@ public class LTTngControlServiceTest extends TestCase {
URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), 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);
@@ -121,22 +121,22 @@ public class LTTngControlServiceTest extends TestCase {
// ------------------------------------------------------------------------
// Test Cases
// ------------------------------------------------------------------------
-
+
public void testVersion() {
try {
fShell.setScenario(SCEN_LTTNG_VERSION);
- ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
assertNotNull(service);
assertEquals("2.0.0", service.getVersion());
} catch (ExecutionException e) {
fail("Exeption thrown " + e);
}
}
-
+
public void testUnsupportedVersion() {
try {
fShell.setScenario(SCEN_LTTNG_UNSUPPORTED_VERSION);
- LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
@@ -146,7 +146,7 @@ public class LTTngControlServiceTest extends TestCase {
public void testNoVersion() {
try {
fShell.setScenario(SCEN_LTTNG_NO_VERSION);
- LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
+ LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
@@ -162,7 +162,7 @@ public class LTTngControlServiceTest extends TestCase {
// success
}
}
-
+
public void testGetSessionNames1() {
try {
fShell.setScenario(SCEN_NO_SESSION_AVAILABLE);
@@ -170,7 +170,7 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(result);
assertEquals(0, result.length);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
@@ -185,7 +185,7 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(2, result.length);
assertEquals("mysession1", result[0]);
assertEquals("mysession", result[1]);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
@@ -196,12 +196,12 @@ public class LTTngControlServiceTest extends TestCase {
fShell.setScenario(SCEN_GET_SESSION_NAME_NOT_EXIST);
fService.getSessionNames(new NullProgressMonitor());
fail("No exeption thrown");
-
+
} catch (ExecutionException e) {
// success
}
}
-
+
public void testGetSessionNameGarbage() {
try {
fShell.setScenario(SCEN_GET_SESSION_GARBAGE_OUT);
@@ -209,12 +209,12 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(result);
assertEquals(0, result.length);
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
}
-
+
public void testGetSession1() {
try {
fShell.setScenario(SCEN_GET_SESSION1);
@@ -225,18 +225,18 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals("mysession", session.getName());
assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session.getSessionPath());
assertEquals(TraceSessionState.ACTIVE, session.getSessionState());
-
+
IDomainInfo[] domains = session.getDomains();
assertNotNull(domains);
assertEquals(2, domains.length);
-
+
// Verify Kernel domain
assertEquals("Kernel", domains[0].getName());
IChannelInfo[] channels = domains[0].getChannels();
assertNotNull(channels);
assertEquals(2, channels.length);
- // Verify Kernel's channel0
+ // Verify Kernel's channel0
assertEquals("channel0", channels[0].getName());
assertEquals(4, channels[0].getNumberOfSubBuffers());
assertEquals("splice()", channels[0].getOutputType());
@@ -245,7 +245,7 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(TraceEnablement.ENABLED, channels[0].getState());
assertEquals(262144, channels[0].getSubBufferSize());
assertEquals(0, channels[0].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] channel0Events = channels[0].getEvents();
assertNotNull(channel0Events);
@@ -254,13 +254,13 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[0].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, channel0Events[0].getEventType());
assertEquals(TraceEnablement.ENABLED, channel0Events[0].getState());
-
+
assertEquals("block_bio_remap", channel0Events[1].getName());
assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[1].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, channel0Events[1].getEventType());
assertEquals(TraceEnablement.DISABLED, channel0Events[1].getState());
-
- // Verify Kernel's channel1
+
+ // Verify Kernel's channel1
assertEquals("channel1", channels[1].getName());
assertEquals(4, channels[1].getNumberOfSubBuffers());
assertEquals("splice()", channels[1].getOutputType());
@@ -269,17 +269,17 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(TraceEnablement.DISABLED, channels[1].getState());
assertEquals(524288, channels[1].getSubBufferSize());
assertEquals(100, channels[1].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] channel1Events = channels[1].getEvents();
assertEquals(0, channel1Events.length);
-
+
// Verify domain UST global
assertEquals("UST global", domains[1].getName());
-
+
IChannelInfo[] ustChannels = domains[1].getChannels();
-
- // Verify UST global's mychannel1
+
+ // Verify UST global's mychannel1
assertEquals("mychannel1", ustChannels[0].getName());
assertEquals(8, ustChannels[0].getNumberOfSubBuffers());
assertEquals("mmap()", ustChannels[0].getOutputType());
@@ -288,12 +288,12 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(TraceEnablement.DISABLED, ustChannels[0].getState());
assertEquals(8192, ustChannels[0].getSubBufferSize());
assertEquals(200, ustChannels[0].getSwitchTimer());
-
+
// Verify event info
IEventInfo[] ustEvents = ustChannels[0].getEvents();
assertEquals(0, ustEvents.length);
- // Verify UST global's channel0
+ // Verify UST global's channel0
assertEquals("channel0", ustChannels[1].getName());
assertEquals(4, ustChannels[1].getNumberOfSubBuffers());
assertEquals("mmap()", ustChannels[1].getOutputType());
@@ -302,28 +302,28 @@ public class LTTngControlServiceTest extends TestCase {
assertEquals(TraceEnablement.ENABLED, ustChannels[1].getState());
assertEquals(4096, ustChannels[1].getSubBufferSize());
assertEquals(0, ustChannels[1].getSwitchTimer());
-
+
// Verify event info
ustEvents = ustChannels[1].getEvents();
assertEquals(2, ustEvents.length);
-
+
assertEquals("ust_tests_hello:tptest_sighandler", ustEvents[0].getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, ustEvents[0].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, ustEvents[0].getEventType());
assertEquals(TraceEnablement.DISABLED, ustEvents[0].getState());
-
+
assertEquals("*", ustEvents[1].getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, ustEvents[1].getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, ustEvents[1].getEventType());
assertEquals(TraceEnablement.ENABLED, ustEvents[1].getState());
-
+
// next session (no detailed information available)
session = fService.getSession("mysession1", new NullProgressMonitor());
assertNotNull(session);
assertEquals("mysession1", session.getName());
assertEquals("/home/user/lttng-traces/mysession1-20120203-133225", session.getSessionPath());
assertEquals(TraceSessionState.INACTIVE, session.getSessionState());
-
+
domains = session.getDomains();
assertNotNull(domains);
assertEquals(0, domains.length);
@@ -340,19 +340,19 @@ public class LTTngControlServiceTest extends TestCase {
// Verify event info
assertNotNull(events);
assertEquals(3, events.size());
-
- IBaseEventInfo baseEventInfo = (IBaseEventInfo) events.get(0);
+
+ IBaseEventInfo baseEventInfo = events.get(0);
assertNotNull(baseEventInfo);
assertEquals("sched_kthread_stop", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events.get(1);
+
+ baseEventInfo = events.get(1);
assertEquals("sched_kthread_stop_ret", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events.get(2);
+
+ baseEventInfo = events.get(2);
assertEquals("sched_wakeup_new", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
@@ -370,23 +370,23 @@ public class LTTngControlServiceTest extends TestCase {
// Check all providers
assertNotNull(providers);
assertEquals(2, providers.size());
-
+
//Verify first provider
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(0).getName());
assertEquals(9379, providers.get(0).getPid());
-
+
// Verify event info
IBaseEventInfo[] events = providers.get(0).getEvents();
assertNotNull(events);
assertEquals(2, events.length);
- IBaseEventInfo baseEventInfo = (IBaseEventInfo) events[0];
+ IBaseEventInfo baseEventInfo = 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 = (IBaseEventInfo) events[1];
+
+ baseEventInfo = events[1];
assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_INFO, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
@@ -394,19 +394,19 @@ public class LTTngControlServiceTest extends TestCase {
//Verify second provider
assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(1).getName());
assertEquals(4852, providers.get(1).getPid());
-
+
// Verify event info
events = providers.get(1).getEvents();
assertNotNull(events);
assertEquals(2, events.length);
- baseEventInfo = (IBaseEventInfo) events[0];
+ baseEventInfo = events[0];
assertNotNull(baseEventInfo);
assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_WARNING, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
-
- baseEventInfo = (IBaseEventInfo) events[1];
+
+ baseEventInfo = events[1];
assertEquals("ust_tests_hello:tptest", baseEventInfo.getName());
assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel());
assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType());
@@ -423,7 +423,7 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(providers);
assertEquals(0, providers.size());
-
+
} catch (ExecutionException e) {
fail(e.toString());
}
@@ -454,20 +454,20 @@ public class LTTngControlServiceTest extends TestCase {
} catch (ExecutionException e) {
// success
}
-
+
try {
fService.createSession("wrongName", null, new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
- }
+ }
try {
fService.createSession("withPath", "/home/user/hallo", new NullProgressMonitor());
fail("No exeption thrown");
} catch (ExecutionException e) {
// success
- }
+ }
try {
ISessionInfo info = fService.createSession("session with spaces", null, new NullProgressMonitor());
@@ -476,10 +476,10 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(info.getSessionPath());
assertTrue(info.getSessionPath().contains("session with spaces"));
assertEquals(TraceSessionState.INACTIVE, info.getSessionState());
-
+
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
try {
ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor());
@@ -488,10 +488,10 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(info.getSessionPath());
assertTrue(info.getSessionPath().contains("/home/user/hallo user/here"));
assertEquals(TraceSessionState.INACTIVE, info.getSessionState());
-
+
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
}
public void testDestroySession() {
@@ -500,7 +500,7 @@ public class LTTngControlServiceTest extends TestCase {
fService.destroySession("mysession2", new NullProgressMonitor());
} catch (ExecutionException e) {
fail(e.toString());
- }
+ }
}
public void testCreateChannel() {
@@ -512,9 +512,9 @@ public class LTTngControlServiceTest extends TestCase {
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);
@@ -523,11 +523,11 @@ public class LTTngControlServiceTest extends TestCase {
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);
@@ -550,10 +550,10 @@ public class LTTngControlServiceTest extends TestCase {
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());
@@ -562,7 +562,7 @@ public class LTTngControlServiceTest extends TestCase {
fail(e.toString());
}
}
-
+
public void testEnableChannel() {
try {
@@ -572,32 +572,32 @@ public class LTTngControlServiceTest extends TestCase {
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");
-//
+//
// } catch (ExecutionException e) {
// // success
// }
-// }
-
+// }
+
public void testEnableEvents() {
try {
// 1) session name, channel = null, 3 event names, kernel
@@ -611,7 +611,7 @@ public class LTTngControlServiceTest extends TestCase {
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());
@@ -621,30 +621,30 @@ public class LTTngControlServiceTest extends TestCase {
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
+ // 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());
}
@@ -659,15 +659,15 @@ public class LTTngControlServiceTest extends TestCase {
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
+ // 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());
}
@@ -680,9 +680,9 @@ public class LTTngControlServiceTest extends TestCase {
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());
@@ -693,7 +693,7 @@ public class LTTngControlServiceTest extends TestCase {
fail(e.toString());
}
}
-
+
public void testAddContext() {
try {
// 1) session name, channel = null, 3 event names, kernel
@@ -710,7 +710,7 @@ public class LTTngControlServiceTest extends TestCase {
assertNotNull(availContexts);
assertEquals(12, availContexts.size());
- // A very "hard-coded" way to verify but it works ...
+ // A very "hard-coded" way to verify but it works ...
Set
* Base command handler implementation to add contexts. *
- * + * * @author Bernd Hufmann */ abstract public class BaseAddContextHandler extends BaseControlViewHandler { @@ -48,16 +48,21 @@ abstract public class BaseAddContextHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** - * Adds contexts to channel(s) and/or event(s) - * @param param - a parameter instance with data for the command execution - * @param contextNames - list contexts to add - * @param monitor - a progress monitor + * Adds contexts to channel(s) and/or event(s) + * + * @param param + * - a parameter instance with data for the command execution + * @param contextNames + * - list contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If something goes wrong */ abstract public void addContexts(CommandParameter param, List* Abstract Command handler implementation for all control view handlers. *
- * + * * @author Bernd Hufmann */ abstract public class BaseControlViewHandler extends AbstractHandler { @@ -43,7 +43,7 @@ abstract public class BaseControlViewHandler extends AbstractHandler { * The synchronization lock. */ final protected ReentrantLock fLock = new ReentrantLock(); - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -76,14 +76,14 @@ abstract public class BaseControlViewHandler extends AbstractHandler { */ protected void refresh(final CommandParameter param) { Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) { - + @Override protected IStatus run(IProgressMonitor monitor) { try { param.getSession().getConfigurationFromNode(monitor); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e); + } return Status.OK_STATUS; } }; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java index 7af1edea2b..8d08305c1c 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -30,9 +30,9 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceD /** *- * Base implementation of a command handler to enable a trace channel. + * Base implementation of a command handler to enable a trace channel. *
- * + * * @author Bernd Hufmann */ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { @@ -45,21 +45,32 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param - a parameter instance with data for the command execution - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param param + * - a parameter instance with data for the command execution + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If something goes wrong when enabling the channel */ - abstract public void enableChannel(CommandParameter param, List* Base command handler implementation to enable events. *
- * + * * @author Bernd Hufmann */ abstract public class BaseEnableEventHandler extends BaseControlViewHandler { @@ -53,48 +53,74 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** * Enables a list of events for given parameters. - * @param - a parameter instance with data for the command execution - * @param eventNames - list of event names - * @param isKernel - true if kernel domain else false - * @param monitor - a progress monitor + * + * @param param + * - a parameter instance with data for the command execution + * @param eventNames + * - list of event names + * @param isKernel + * - true if kernel domain else false + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails for some reason */ abstract public void enableEvents(CommandParameter param, List* Command handler implementation to execute command calibrate to quantify LTTng overhead. *
- * + * * @author Bernd Hufmann */ public class CalibrateHandler extends BaseControlViewHandler { @@ -50,7 +50,7 @@ public class CalibrateHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) @@ -74,7 +74,7 @@ public class CalibrateHandler extends BaseControlViewHandler { try { param.getDomain().calibrate(monitor); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e); } return Status.OK_STATUS; @@ -95,7 +95,7 @@ public class CalibrateHandler extends BaseControlViewHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { @@ -110,11 +110,11 @@ public class CalibrateHandler extends BaseControlViewHandler { if (selection instanceof StructuredSelection) { StructuredSelection structered = ((StructuredSelection) selection); for (Iterator> iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); + Object element = iterator.next(); if (element instanceof TraceDomainComponent) { TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = (TraceSessionComponent) tmpDomain.getParent(); - + // Add only TraceDomainComponent whose TraceSessionComponent parent is not destroyed if ((!session.isDestroyed())) { domain = tmpDomain; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java index 9ea06971e7..90dc7a3e0b 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -38,7 +38,7 @@ import org.eclipse.ui.PlatformUI; ** Abstract command handler implementation to enable or disabling a trace channel. *
- * + * * @author Bernd Hufmann */ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { @@ -57,7 +57,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { /** * @return the new state to set */ - abstract protected TraceEnablement getNewState(); + abstract protected TraceEnablement getNewState(); // ------------------------------------------------------------------------ // Operations @@ -65,11 +65,11 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { /** * Changes the state of the given channels. * @param domain - the domain of the channels. - * @param channelNames - a list of channel names + * @param channelNames - a list of channel names * @param monitor - a progress monitor * @throws ExecutionException */ - abstract protected void changeState(TraceDomainComponent domain, List* Base Command handler implementation to enable or disabling a trace channel. *
- * + * * @author Bernd Hufmann */ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { @@ -50,14 +50,14 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { * The command execution parameter. */ protected Parameter fParam; - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ /** * @return the new state to set */ - abstract protected TraceEnablement getNewState(); + abstract protected TraceEnablement getNewState(); // ------------------------------------------------------------------------ // Operations @@ -65,11 +65,11 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { /** * Change the state * @param channel - channel of events to be enabled - * @param eventNames - list event names + * @param eventNames - list event names * @param monitor - a progress monitor * @throws ExecutionException */ - abstract protected void changeState(TraceChannelComponent channel, List* Abstract command handler implementation to start or stop one or more trace sessions. *
- * + * * @author Bernd Hufmann */ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { @@ -45,10 +45,10 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The list of session components the command is to be executed on. + * The list of session components the command is to be executed on. */ protected List* Command handler implementation to create a trace session. *
- * + * * @author Bernd Hufmann */ public class CreateSessionHandler extends BaseControlViewHandler { @@ -41,10 +41,10 @@ public class CreateSessionHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The trace session group the command is to be executed on. + * The trace session group the command is to be executed on. */ private TraceSessionGroup fSessionGroup = null; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -57,8 +57,8 @@ public class CreateSessionHandler extends BaseControlViewHandler { fLock.lock(); try { - final TraceSessionGroup sessionGroup = fSessionGroup; - + final TraceSessionGroup sessionGroup = fSessionGroup; + // Open dialog box for the node name and address ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog(); dialog.setTraceSessionGroup(sessionGroup); @@ -76,8 +76,8 @@ public class CreateSessionHandler extends BaseControlViewHandler { try { sessionGroup.createSession(sessionName, sessionPath, monitor); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); + } return Status.OK_STATUS; } }; @@ -95,7 +95,7 @@ public class CreateSessionHandler extends BaseControlViewHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java index 2f9c5c8aa0..24525042b9 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -39,7 +39,7 @@ import org.eclipse.ui.PlatformUI; ** Command handler implementation to destroy one or more trace sessions. *
- * + * * @author Bernd Hufmann */ public class DestroySessionHandler extends BaseControlViewHandler { @@ -48,10 +48,10 @@ public class DestroySessionHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The list of session components the command is to be executed on. + * The list of session components the command is to be executed on. */ - private List* Command handler implementation to enable a trace channel for known domain. *
- * + * * @author Bernd Hufmann */ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { @@ -51,7 +51,7 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { ((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor); } } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter) @@ -70,26 +70,26 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { return false; } - + TraceDomainComponent domain = null; TraceSessionComponent session = null; - + // Check if one domain is 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(); + Object element = iterator.next(); if (element instanceof TraceDomainComponent) { TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = (TraceSessionComponent) tmpDomain.getParent(); - + // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) { domain = tmpDomain; @@ -97,9 +97,9 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { } } } - + boolean isEnabled = domain != null; - + fLock.lock(); try { fParam = null; @@ -109,8 +109,8 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { } finally { fLock.unlock(); } - + return isEnabled; } - + } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java index 89a4dedfdd..b4d43ab0f1 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -27,10 +27,10 @@ import org.eclipse.ui.IWorkbenchPage; /** *- * Command handler implementation to enable a trace channel for unknown domain + * Command handler implementation to enable a trace channel for unknown domain * (on session level). *
- * + * * @author Bernd Hufmann */ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { @@ -46,7 +46,7 @@ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { public void enableChannel(CommandParameter param, List* Command handler implementation to enable events for a known channel. *
- * + * * @author Bernd Hufmann */ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { @@ -94,7 +94,7 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { public TraceDomainComponent getDomain(CommandParameter param) { if (param instanceof ChannelCommandParameter) { return (TraceDomainComponent) ((ChannelCommandParameter)param).getChannel().getParent(); - } + } return null; } @@ -116,10 +116,10 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { if (selection instanceof StructuredSelection) { StructuredSelection structered = ((StructuredSelection) selection); for (Iterator> iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); + Object element = iterator.next(); if (element instanceof TraceChannelComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceChannelComponent tmpChannel = (TraceChannelComponent) element; + TraceChannelComponent tmpChannel = (TraceChannelComponent) element; session = tmpChannel.getSession(); if(!session.isDestroyed()) { channel = tmpChannel; @@ -127,7 +127,7 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { } } } - + boolean isEnabled = (channel != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java index 8c071a456e..bbb47f90b2 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -31,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPage; * Command handler implementation to enable events for a known domain and default channel 'channel0' * (which will be created if doesn't exist). * - * + * * @author Bernd Hufmann */ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { @@ -117,10 +117,10 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { if (selection instanceof StructuredSelection) { StructuredSelection structered = ((StructuredSelection) selection); for (Iterator> iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); + Object element = iterator.next(); if (element instanceof TraceDomainComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceDomainComponent tmpDomain = (TraceDomainComponent) element; + TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = tmpDomain.getSession(); if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) { domain = tmpDomain; @@ -128,7 +128,7 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { } } } - + boolean isEnabled = (domain != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java index b892e060d0..2c827142c0 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -31,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPage; * Command handler implementation to enable events for a known session and default channel 'channel0' * (which will be created if doesn't exist). * - * + * * @author Bernd Hufmann */ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { @@ -39,7 +39,7 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + //------------------------------------------------------------------------- // Operations // ------------------------------------------------------------------------ @@ -79,7 +79,7 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { param.getSession().enableLogLevel(eventName, logLevelType, level, monitor); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter) @@ -107,10 +107,10 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { if (selection instanceof StructuredSelection) { StructuredSelection structered = ((StructuredSelection) selection); for (Iterator> iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); + Object element = iterator.next(); if (element instanceof TraceSessionComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceSessionComponent tmpSession = (TraceSessionComponent) element; + TraceSessionComponent tmpSession = (TraceSessionComponent) element; if(tmpSession.getSessionState() == TraceSessionState.INACTIVE && !tmpSession.isDestroyed()) { session = tmpSession; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java index 1b4b9671c8..eb0ce70898 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers; @@ -48,7 +48,7 @@ import org.eclipse.ui.PlatformUI; ** Command handler implementation to import traces from a (remote) session to a tracing project. *
- * + * * @author Bernd Hufmann */ public class ImportHandler extends BaseControlViewHandler { @@ -57,7 +57,7 @@ public class ImportHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ protected CommandParameter fParam; - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -65,7 +65,7 @@ public class ImportHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) @@ -82,7 +82,7 @@ public class ImportHandler extends BaseControlViewHandler { fLock.lock(); try { final CommandParameter param = fParam.clone(); - + final IImportDialog dialog = TraceControlDialogFactory.getInstance().getImportDialog(); dialog.setSession(param.getSession()); @@ -96,15 +96,15 @@ public class ImportHandler extends BaseControlViewHandler { try { List* Command handler implementation to refresh node configuration. *
- * + * * @author Bernd Hufmann */ public class RefreshHandler extends BaseControlViewHandler { @@ -39,7 +39,7 @@ public class RefreshHandler extends BaseControlViewHandler { * The node component reference. */ private TargetNodeComponent fNode; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -76,10 +76,10 @@ public class RefreshHandler extends BaseControlViewHandler { // 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(); + Object element = iterator.next(); if (element instanceof TraceControlComponent) { TraceControlComponent component = (TraceControlComponent) element; boolean isConnected = component.getTargetNodeState() == TargetNodeState.CONNECTED; @@ -94,9 +94,9 @@ public class RefreshHandler extends BaseControlViewHandler { } } } - + boolean isEnabled = node != null; - + fLock.lock(); try { fNode = null; @@ -106,7 +106,7 @@ public class RefreshHandler extends BaseControlViewHandler { } finally { fLock.unlock(); } - + return isEnabled; } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java index e9ecdf0944..32629d50d6 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java @@ -1,14 +1,14 @@ /******************************************************************************* * 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.internal.lttng2.ui.views.control.messages; @@ -16,14 +16,15 @@ import org.eclipse.osgi.util.NLS; /** *- * Messages file for the trace control package. + * Messages file for the trace control package. *
- * + * * @author Bernd Hufmann */ +@SuppressWarnings("javadoc") final public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.messages"; //$NON-NLS-1$ - + // Failures public static String TraceControl_ConnectionFailure; public static String TraceControl_DisconnectionFailure; @@ -37,10 +38,10 @@ final public class Messages extends NLS { public static String TraceControl_UnexpectedCommandOutputFormat; public static String TraceControl_UnexpectedNameError; public static String TraceControl_UnexpectedPathError; - + public static String TraceControl_UnsupportedVersionError; public static String TraceControl_GettingVersionError; - + // Commands public static String TraceControl_RetrieveNodeConfigurationJob; public static String TraceControl_ListSessionFailure; @@ -48,12 +49,12 @@ final public class Messages extends NLS { public static String TraceControl_NewNodeCreationFailure; public static String TraceControl_CreateSessionJob; public static String TraceControl_CreateSessionFailure; - + public static String TraceControl_DestroySessionJob; public static String TraceControl_DestroySessionFailure; public static String TraceControl_DestroyConfirmationTitle; public static String TraceControl_DestroyConfirmationMessage; - + public static String TraceControl_ImportJob; public static String TraceControl_ImportFailure; @@ -62,25 +63,25 @@ final public class Messages extends NLS { public static String TraceControl_CreateChannelStateJob; public static String TraceControl_CreateChannelStateFailure; - + public static String TraceControl_ChangeChannelStateJob; public static String TraceControl_ChangeChannelStateFailure; public static String TraceControl_ChangeEventStateJob; public static String TraceControl_ChangeEventStateFailure; - + public static String TraceControl_EnableEventsJob; public static String TraceControl_EnableEventsFailure; public static String TraceControl_DisableEventsJob; - + public static String TraceControl_GetContextJob; public static String TraceControl_GetContextFailure; - + public static String TraceControl_AddContextJob; public static String TraceControl_AddContextFailure; - + public static String TraceControl_AddCalibrateJob; public static String TraceControl_AddCalibrateFailure; - + // Dialogs public static String TraceControl_NewDialogTitle; public static String TraceControl_NewNodeExistingConnectionGroupName; @@ -91,7 +92,7 @@ final public class Messages extends NLS { public static String TraceControl_NewNodeHostNameLabel; public static String TraceControl_NewNodeHostNameTooltip; public static String TraceControl_AlreadyExistsError; - + public static String TraceControl_CreateSessionDialogTitle; public static String TraceControl_CreateSessionNameLabel; public static String TraceControl_CreateSessionNameTooltip; @@ -102,7 +103,7 @@ final public class Messages extends NLS { public static String TraceControl_SessionPathAlreadyExistsError; public static String TraceControl_InvalidSessionPathError; public static String TraceControl_FileSubSystemError; - + public static String TraceControl_EnableChannelDialogTitle; public static String TraceControl_EnableChannelNameLabel; public static String TraceControl_EnableChannelNameTooltip; @@ -116,10 +117,10 @@ final public class Messages extends NLS { public static String TraceControl_EnableChannelDiscardModeTooltip; public static String TraceControl_EnableChannelOverwriteModeLabel; public static String TraceControl_EnableChannelOverwriteModeTooltip; - + public static String TraceControl_InvalidChannelNameError; public static String TraceControl_ChannelAlreadyExistsError; - + public static String TraceControl_EnableEventsDialogTitle; public static String TraceControl_EnableEventsSessionGroupName; public static String TraceControl_EnableEventsChannelGroupName; @@ -142,7 +143,7 @@ final public class Messages extends NLS { public static String TraceControl_EnableEventsFucntionGroupName; public static String TraceControl_EnableEventsFunctionEventNameTooltip; public static String TraceControl_EnableEventsFunctionNameLabel; - + public static String TraceControl_EnableEventsWildcardGroupName; public static String TraceControl_EnableEventsWildcardLabel; public static String TraceControl_EnableEventsWildcardTooltip; @@ -158,12 +159,12 @@ final public class Messages extends NLS { public static String TraceControl_InvalidWildcardError; public static String TraceControl_InvalidLogLevelEventNameError; public static String TraceControl_InvalidLogLevel; - + public static String TraceControl_AddContextDialogTitle; public static String TraceControl_AddContextAvailableContextsLabel; public static String TraceControl_AddContextAvailableContextsTooltip; public static String TraceControl_AddContextAllLabel; - + public static String TraceControl_ImportDialogTitle; public static String TraceControl_ImportDialogTracesGroupName; public static String TraceControl_ImportDialogTracesTooltip; @@ -181,7 +182,7 @@ final public class Messages extends NLS { public static String TraceControl_ImportDialogConfirmationNewNameLabel; public static String TraceControl_InvalidTraceNameError; public static String TraceControl_ImportDialogTraceAlreadyExistError; - + // Tree structure strings public static String TraceControl_KernelDomainDisplayName; public static String TraceControl_UstDisplayName; @@ -193,7 +194,7 @@ final public class Messages extends NLS { public static String TraceControl_EventDisplayName; public static String TraceControl_ProviderDisplayName; public static String TraceControl_KernelProviderDisplayName; - + // Property names public static String TraceControl_SessionNamePropertyName; public static String TraceControl_EventNamePropertyName; @@ -216,19 +217,19 @@ final public class Messages extends NLS { public static String TraceControl_ProbeAddressPropertyName; public static String TraceControl_ProbeOffsetPropertyName; public static String TraceControl_ProbeSymbolPropertyName; - + // Preferences public static String TraceControl_TracingGroupPreference; public static String TraceControl_LoggingPreference; public static String TraceControl_LogfilePath; public static String TraceControl_AppendLogfilePreference; - + public static String TraceControl_VerboseLevelsPreference; public static String TraceControl_VerboseLevelNonePreference; public static String TraceControl_VerboseLevelVerbosePreference; public static String TraceControl_VerboseLevelVeryVerbosePreference; public static String TraceControl_VerboseLevelVeryVeryVerbosePreference; - + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java index 1ce4d6816f..2845528620 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ @@ -25,11 +25,11 @@ import org.eclipse.ui.views.properties.IPropertySource; ** Implementation of the Kernel provider component. *
- * + * * @author Bernd Hufmann */ public class KernelProviderComponent extends TraceControlComponent { - + // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ @@ -41,12 +41,12 @@ public class KernelProviderComponent extends TraceControlComponent { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -55,17 +55,17 @@ public class KernelProviderComponent extends TraceControlComponent { setToolTip(Messages.TraceControl_ProviderDisplayName); setImage(KERNEL_PROVIDER_ICON_FILE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ /** - * Sets the events information for this component. - * @param eventInfos - events information to set. + * Sets the events information for this component. + * @param eventInfos - events information to set. */ public void setEventInfo(List* Implementation of the trace node component. *
- * + * * @author Bernd Hufmann */ public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener { @@ -90,7 +90,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component * @param parent - the parent of the component * @param host - the host connection implementation @@ -106,7 +106,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } /** - * Constructor (using default proxy) + * Constructor (using default proxy) * @param name - the name of the component * @param parent - the parent of the component * @param host - the host connection implementation @@ -129,7 +129,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } return fDisconnectedImage; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getTargetNodeState() @@ -138,7 +138,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu public TargetNodeState getTargetNodeState() { return fState; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#setTargetNodeState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent.TargetNodeState) @@ -148,7 +148,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu fState = state; fireComponentChanged(TargetNodeComponent.this); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getControlService() @@ -164,7 +164,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu */ @Override public void setControlService(ILttngControlService service) { - fService = (ILttngControlService)service; + fService = service; } /* @@ -178,8 +178,8 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu return new TargetNodePropertySource(this); } return null; - } - + } + /** * @return remote host name */ @@ -200,17 +200,17 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu public TraceSessionComponent[] getSessions() { List* Implementation of the trace channel component. *
- * + * * @author Bernd Hufmann */ public class TraceChannelComponent extends TraceControlComponent { @@ -51,7 +51,7 @@ public class TraceChannelComponent extends TraceControlComponent { * Path to icon file for this component (state disabled). */ public static final String TRACE_CHANNEL_ICON_FILE_DISABLED = "icons/obj16/channel_disabled.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -63,12 +63,12 @@ public class TraceChannelComponent extends TraceControlComponent { * The image to be displayed in disabled state. */ private Image fDisabledImage = null; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -79,7 +79,7 @@ public class TraceChannelComponent extends TraceControlComponent { fChannelInfo = new ChannelInfo(name); fDisabledImage = Activator.getDefault().loadIcon(TRACE_CHANNEL_ICON_FILE_DISABLED); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -97,7 +97,9 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Sets the channel information. + * * @param channelInfo + * The channel info to assign to this component */ public void setChannelInfo(IChannelInfo channelInfo) { fChannelInfo = channelInfo; @@ -176,7 +178,7 @@ public class TraceChannelComponent extends TraceControlComponent { * @return the read timer interval. */ public long getReadTimer() { - return fChannelInfo.getReadTimer(); + return fChannelInfo.getReadTimer(); } /** * Sets the read timer interval to the given value. @@ -229,20 +231,20 @@ public class TraceChannelComponent extends TraceControlComponent { return new TraceChannelPropertySource(this); } return null; - } + } /** * @return session name from parent */ public String getSessionName() { - return ((TraceDomainComponent)getParent()).getSessionName(); + return ((TraceDomainComponent)getParent()).getSessionName(); } /** * @return session from parent */ public TraceSessionComponent getSession() { - return ((TraceDomainComponent)getParent()).getSession(); + return ((TraceDomainComponent)getParent()).getSession(); } /** @@ -251,21 +253,24 @@ public class TraceChannelComponent extends TraceControlComponent { public boolean isKernel() { return ((TraceDomainComponent)getParent()).isKernel(); } - + /** * @return the parent target node */ public TargetNodeComponent getTargetNode() { return ((TraceDomainComponent)getParent()).getTargetNode(); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. + * + * @param eventNames + * - a list of event names to enabled. * @throws ExecutionException + * If the command fails */ public void enableEvents(List* Base implementation for trace control component. *
- * + * * @author Bernd Hufmann */ public class TraceControlComponent implements ITraceControlComponent { @@ -58,16 +58,16 @@ public class TraceControlComponent implements ITraceControlComponent { /** * The list if children components. */ - private List* Implementation of the trace domain component. *
- * + * * @author Bernd Hufmann */ public class TraceDomainComponent extends TraceControlComponent { @@ -54,7 +54,7 @@ public class TraceDomainComponent extends TraceControlComponent { // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -94,19 +94,19 @@ public class TraceDomainComponent extends TraceControlComponent { } return null; } - + /** * @return session name from parent */ public String getSessionName() { return ((TraceSessionComponent)getParent()).getName(); } - + /** * @return session from parent */ public TraceSessionComponent getSession() { - return (TraceSessionComponent)getParent(); + return (TraceSessionComponent)getParent(); } /** @@ -115,23 +115,23 @@ public class TraceDomainComponent extends TraceControlComponent { public boolean isKernel() { return fDomainInfo.isKernel(); } - + /** - * Sets whether domain is Kernel domain or UST + * Sets whether domain is Kernel domain or UST * @param isKernel true for kernel, false for UST */ public void setIsKernel(boolean isKernel) { fDomainInfo.setIsKernel(isKernel); } - + /** * @return returns all available channels for this domain. */ public TraceChannelComponent[] getChannels() { List* Implementation of the trace channel component. *
- * + * * @author Bernd Hufmann */ public class TraceEventComponent extends TraceControlComponent { @@ -48,7 +48,7 @@ public class TraceEventComponent extends TraceControlComponent { * Path to icon file for this component (disabled state). */ public static final String TRACE_EVENT_ICON_FILE_DISABLED = "icons/obj16/event_disabled.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -60,15 +60,15 @@ public class TraceEventComponent extends TraceControlComponent { * The image to be displayed when in disabled state. */ private Image fDisabledImage = null; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceEventComponent(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_EVENT_ICON_FILE_ENABLED); @@ -76,7 +76,7 @@ public class TraceEventComponent extends TraceControlComponent { fEventInfo = new EventInfo(name); fDisabledImage = Activator.getDefault().loadIcon(TRACE_EVENT_ICON_FILE_DISABLED); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -91,7 +91,7 @@ public class TraceEventComponent extends TraceControlComponent { } return super.getImage(); } - + /** * Sets the event information. * @param eventInfo - the event information to set. @@ -99,25 +99,25 @@ public class TraceEventComponent extends TraceControlComponent { public void setEventInfo(IEventInfo eventInfo) { fEventInfo = eventInfo; } - + /** * @return the trace event type */ public TraceEventType getEventType() { return fEventInfo.getEventType(); } - + /** - * Sets the trace event type to the given type + * Sets the trace event type to the given type * @param type - type to set */ public void setEventType(TraceEventType type) { fEventInfo.setEventType(type); } - + /** * Sets the trace event type to the type specified by the given name. - * @param type - event type name + * @param typeName - event type name */ public void setEventType(String typeName) { fEventInfo.setEventType(typeName); @@ -129,7 +129,7 @@ public class TraceEventComponent extends TraceControlComponent { public TraceEnablement getState() { return fEventInfo.getState(); } - + /** * Sets the event state (enablement) to the given value. * @param state - state to set. @@ -137,7 +137,7 @@ public class TraceEventComponent extends TraceControlComponent { public void setState(TraceEnablement state) { fEventInfo.setState(state); } - + /** * Sets the event state (enablement) to the value specified by the given name. * @param stateName - state to set. @@ -152,15 +152,15 @@ public class TraceEventComponent extends TraceControlComponent { public TraceLogLevel getLogLevel() { return fEventInfo.getLogLevel(); } - + /** - * Sets the trace event log level to the given level + * Sets the trace event log level to the given level * @param level - event log level to set */ public void setLogLevel(TraceLogLevel level) { fEventInfo.setLogLevel(level); } - + /** * Sets the trace event log level to the level specified by the given name. * @param levelName - event log level name @@ -168,7 +168,7 @@ public class TraceEventComponent extends TraceControlComponent { public void setLogLevel(String levelName) { fEventInfo.setLogLevel(levelName); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class) @@ -180,27 +180,27 @@ public class TraceEventComponent extends TraceControlComponent { return new TraceEventPropertySource(this); } return null; - } - + } + /** * @return session name from parent */ public String getSessionName() { - return ((TraceChannelComponent)getParent()).getSessionName(); + return ((TraceChannelComponent)getParent()).getSessionName(); } /** * @return session from parent */ public TraceSessionComponent getSession() { - return ((TraceChannelComponent)getParent()).getSession(); + return ((TraceChannelComponent)getParent()).getSession(); } /** * @return channel name from parent */ public String getChannelName() { - return getParent().getName(); + return getParent().getName(); } /** @@ -213,11 +213,14 @@ public class TraceEventComponent extends TraceControlComponent { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add + * + * @param contexts + * - a list of contexts to add * @throws ExecutionException + * If the command fails */ public void addContexts(List* Implementation of the trace provider group. *
- * + * * @author Bernd Hufmann */ public class TraceProviderGroup extends TraceControlComponent { @@ -37,24 +37,24 @@ public class TraceProviderGroup extends TraceControlComponent { * Path to icon file for this component. */ public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceProviderGroup(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_PROVIDERS_ICON_FILE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -62,10 +62,10 @@ public class TraceProviderGroup extends TraceControlComponent { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** * Gets the provider information from the target node. - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public void getProviderFromNode() throws ExecutionException { getProviderFromNode(new NullProgressMonitor()); @@ -74,19 +74,19 @@ public class TraceProviderGroup extends TraceControlComponent { /** * Gets the provider information from the target node. * @param monitor - a progress monitor - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException { - + List* Implementation of the trace session component. *
- * + * * @author Bernd Hufmann */ public class TraceSessionComponent extends TraceControlComponent { @@ -79,10 +79,10 @@ public class TraceSessionComponent extends TraceControlComponent { // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceSessionComponent(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_SESSION_ICON_FILE_INACTIVE); @@ -108,7 +108,7 @@ public class TraceSessionComponent extends TraceControlComponent { if (fSessionInfo.getSessionState() == TraceSessionState.INACTIVE) { return super.getImage(); } - + return fActiveImage; } @@ -159,7 +159,7 @@ public class TraceSessionComponent extends TraceControlComponent { /** * Sets the path string (where session is located) to the given value. - * @param path - session path to set. + * @param sessionPath - session path to set. */ public void setSessionPath(String sessionPath) { fSessionInfo.setSessionPath(sessionPath); @@ -176,135 +176,185 @@ public class TraceSessionComponent extends TraceControlComponent { return new TraceSessionPropertySource(this); } return null; - } + } /** * @return all available domains of this session. */ public TraceDomainComponent[] getDomains() { List* Implementation of the trace session group. *
- * + * * @author Bernd Hufmann */ public class TraceSessionGroup extends TraceControlComponent { @@ -30,21 +30,21 @@ public class TraceSessionGroup extends TraceControlComponent { // ------------------------------------------------------------------------ /** * Path to icon file for this component. - */ + */ public static final String TRACE_SESSIONS_ICON_FILE = "icons/obj16/sessions.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceSessionGroup(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_SESSIONS_ICON_FILE); @@ -66,7 +66,9 @@ public class TraceSessionGroup extends TraceControlComponent { // ------------------------------------------------------------------------ /** * Retrieves the sessions information from the node. + * * @throws ExecutionException + * If the command fails */ public void getSessionsFromNode() throws ExecutionException { getSessionsFromNode(new NullProgressMonitor()); @@ -74,62 +76,87 @@ public class TraceSessionGroup extends TraceControlComponent { /** * Retrieves the sessions information from the node. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void getSessionsFromNode(IProgressMonitor monitor) throws ExecutionException { + public void getSessionsFromNode(IProgressMonitor monitor) + throws ExecutionException { String[] sessionNames = getControlService().getSessionNames(monitor); for (int i = 0; i < sessionNames.length; i++) { - TraceSessionComponent session = new TraceSessionComponent(sessionNames[i], this); + TraceSessionComponent session = new TraceSessionComponent( + sessionNames[i], this); addChild(session); session.getConfigurationFromNode(monitor); } } /** - * Creates a session with given session name and location. - * @param sessionName - a session name to create - * @param sessionPath - a path for storing the traces (use null for default) - * @return the session information - * throws ExecutionExecption + * Creates a session with given session name and location. + * + * @param sessionName + * - a session name to create + * @param sessionPath + * - a path for storing the traces (use null for default) + * @throws ExecutionException + * If the command fails */ - public void createSession(String sessionName, String sessionPath) throws ExecutionException { + public void createSession(String sessionName, String sessionPath) + throws ExecutionException { createSession(sessionName, sessionPath, new NullProgressMonitor()); } - + /** - * Creates a session with given session name and location. - * @param sessionName - a session name to create - * @param sessionPath - a path for storing the traces (use null for default) - * @Param monitor - a progress monitor - * @return the session information - * throws ExecutionExecption + * Creates a session with given session name and location. + * + * @param sessionName + * - a session name to create + * @param sessionPath + * - a path for storing the traces (use null for default) + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ - public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor); + public void createSession(String sessionName, String sessionPath, + IProgressMonitor monitor) throws ExecutionException { + ISessionInfo sessionInfo = getControlService().createSession( + sessionName, sessionPath, monitor); if (sessionInfo != null) { - TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this); + TraceSessionComponent session = new TraceSessionComponent( + sessionInfo.getName(), TraceSessionGroup.this); addChild(session); session.getConfigurationFromNode(monitor); } } /** - * Destroys a session with given session name. - * @param session - a session component to destroy - * throws ExecutionExecption + * Destroys a session with given session name. + * + * @param session + * - a session component to destroy + * @throws ExecutionException + * If the command fails */ - public void destroySession(TraceSessionComponent session) throws ExecutionException { + public void destroySession(TraceSessionComponent session) + throws ExecutionException { destroySession(session, new NullProgressMonitor()); } - + /** - * Destroys a session with given session name. - * @param session - a session component to destroy - * @param monitor - a progress monitor - * throws ExecutionExecption + * Destroys a session with given session name. + * + * @param session + * - a session component to destroy + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ - public void destroySession(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException { + public void destroySession(TraceSessionComponent session, + IProgressMonitor monitor) throws ExecutionException { getControlService().destroySession(session.getName(), monitor); session.removeAllChildren(); removeChild(session); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java index 3b90b16870..130e690f12 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences; @@ -27,7 +27,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; ** Preference page implementation for configuring LTTng tracer control preferences. *
- * + * * @author Bernd Hufmann */ public class ControlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -37,10 +37,14 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements // ------------------------------------------------------------------------ RadioGroupFieldEditor fVerboseLevel; BooleanFieldEditor fIsAppend; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + */ public ControlPreferencePage() { super(FieldEditorPreferencePage.GRID); @@ -48,7 +52,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements IPreferenceStore store = ControlPreferences.getInstance().getPreferenceStore(); setPreferenceStore(store); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -75,7 +79,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements StringFieldEditor logfile = new StringFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_FILE_PATH_PREF, Messages.TraceControl_LogfilePath, getFieldEditorParent()); addField(logfile); - + fIsAppend = new BooleanFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF, Messages.TraceControl_AppendLogfilePreference, getFieldEditorParent()); addField(fIsAppend); @@ -89,15 +93,15 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_NONE, }, { - Messages.TraceControl_VerboseLevelVerbosePreference, + Messages.TraceControl_VerboseLevelVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_VERBOSE }, { - Messages.TraceControl_VerboseLevelVeryVerbosePreference, + Messages.TraceControl_VerboseLevelVeryVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE }, { - Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference, + Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE } }, @@ -118,7 +122,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements */ @Override public void propertyChange(PropertyChangeEvent event) { - + if (event.getProperty().equals(FieldEditor.VALUE)) { if (event.getSource() instanceof FieldEditor) { FieldEditor editor = (FieldEditor) event.getSource(); @@ -131,7 +135,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements } super.propertyChange(event); } - + /* * (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults() diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java index 18f1dcb3d0..05df09ed5e 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences; @@ -20,7 +20,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.logging.ControlCo ** Singleton class to access LTTng tracer control preferences. *
- * + * * @author Bernd Hufmann */ public class ControlPreferences { @@ -105,7 +105,7 @@ public class ControlPreferences { // ------------------------------------------------------------------------ /** * Returns the trace control preferences singleton instance - * + * * @return the trace control preferences singleton instance */ public synchronized static ControlPreferences getInstance() { @@ -130,21 +130,21 @@ public class ControlPreferences { } /** - * @return value of tracing group preference + * @return value of tracing group preference */ public String getTracingGroup() { return fPreferenceStore.getString(TRACE_CONTROL_TRACING_GROUP_PREF); } /** - * @return whether is logging is enabled + * @return whether is logging is enabled */ public boolean isLoggingEnabled() { return fPreferenceStore.getBoolean(TRACE_CONTROL_LOG_COMMANDS_PREF); } /** - * @return whether an existing log file will appended or not + * @return whether an existing log file will appended or not */ public boolean isAppend() { return fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF); @@ -156,30 +156,34 @@ public class ControlPreferences { public String getVerboseLevel() { return fPreferenceStore.getString(TRACE_CONTROL_VERBOSE_LEVEL_PREF); } - + /** * @return absolute log file path */ public String getLogfilePath() { return fPreferenceStore.getString(TRACE_CONTROL_LOG_FILE_PATH_PREF); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** * Initializes the control preferences (e.g. enable open log file) + * + * @param preferenceStore + * The preference store to assign */ public void init(IPreferenceStore preferenceStore) { fPreferenceStore = preferenceStore; if (fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_COMMANDS_PREF)) { ControlCommandLogger.init(getLogfilePath(), isAppend()); - } + } } /** - * Disposes any resource (e.g. close log file). + * Disposes any resource (e.g. close log file). */ public void dispose() { ControlCommandLogger.close(); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java index 2b3a9ab7bc..77b8123124 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property; @@ -24,7 +24,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; ** Property source implementation for the base event component. *
- * + * * @author Bernd Hufmann */ public class BaseEventPropertySource extends BasePropertySource { @@ -46,7 +46,7 @@ public class BaseEventPropertySource extends BasePropertySource { */ public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$ /** - * The base event 'name' property name. + * The base event 'name' property name. */ public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName; /** @@ -57,15 +57,15 @@ public class BaseEventPropertySource extends BasePropertySource { * The base event 'log level' property name. */ public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName; - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ /** - * The base event component which this property source is for. + * The base event component which this property source is for. */ private final BaseEventComponent fBaseEvent; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -76,7 +76,7 @@ public class BaseEventPropertySource extends BasePropertySource { public BaseEventPropertySource(BaseEventComponent component) { fBaseEvent = component; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -92,7 +92,7 @@ public class BaseEventPropertySource extends BasePropertySource { if (fBaseEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) { list.add(new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME)); } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java index 19dd6dcabf..124890e386 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property; @@ -24,7 +24,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; ** Property source implementation for the trace event component. *
- * + * * @author Bernd Hufmann */ public class TraceEventPropertySource extends BasePropertySource { @@ -49,7 +49,7 @@ public class TraceEventPropertySource extends BasePropertySource { */ public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$ /** - * The trace event 'name' property name. + * The trace event 'name' property name. */ public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName; /** @@ -69,10 +69,10 @@ public class TraceEventPropertySource extends BasePropertySource { // Attributes // ------------------------------------------------------------------------ /** - * The event component which this property source is for. + * The event component which this property source is for. */ protected final TraceEventComponent fEvent; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -83,7 +83,7 @@ public class TraceEventPropertySource extends BasePropertySource { public TraceEventPropertySource(TraceEventComponent component) { fEvent = component; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -100,7 +100,7 @@ public class TraceEventPropertySource extends BasePropertySource { if (fEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) { list.add(new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME)); } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java index e843224377..239d7132a9 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property; @@ -25,7 +25,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; ** Property source implementation for the trace probe event component. *
- * + * * @author Bernd Hufmann */ public class TraceProbeEventPropertySource extends TraceEventPropertySource { @@ -61,17 +61,24 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param component + * A trace event component + */ 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 // ------------------------------------------------------------------------ @@ -90,7 +97,7 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { 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)); + list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME)); } if (event.getOffset() != null) { @@ -101,7 +108,7 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID, TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME)); } } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java index c90236b5ed..6a5beb3098 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; @@ -17,11 +17,11 @@ import java.util.Arrays; ** Class containing command result of remote command execution. *
- * + * * @author Bernd Hufmann */ public class CommandResult implements ICommandResult { - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -38,6 +38,15 @@ public class CommandResult implements ICommandResult { // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param result + * The result of the command + * @param output + * The output, as an array of strings + */ public CommandResult(int result, String[] output) { fResult = result; if (output != null) { @@ -46,7 +55,7 @@ public class CommandResult implements ICommandResult { } // ------------------------------------------------------------------------ - // Accessor + // Accessors // ------------------------------------------------------------------------ /* * (non-Javadoc) diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java index 79b73813d2..baf9e97667 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Patrick Tasse - Initial API and implementation * Bernd Hufmann - Updated using Executor Framework **********************************************************************/ @@ -34,9 +34,9 @@ import org.eclipse.rse.services.shells.IShellService; /** *- * Implementation of remote command execution using RSE's shell service. + * Implementation of remote command execution using RSE's shell service. *
- * + * * @author Patrick Tasse * @author Bernd Hufmann */ @@ -46,15 +46,17 @@ public class CommandShell implements ICommandShell { // Constants // ------------------------------------------------------------------------ - // string to be echo'ed when running command in shell, used to indicate that the command has finished running + /** String to be echo'ed when running command in shell, used to indicate that the command has finished running */ public final static String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$ - - //command delimiter for shell + + /** Command delimiter for shell */ public final static String CMD_DELIMITER = "\n"; //$NON-NLS-1$ + /** Shell "echo" command */ public final static String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$ - private final static int DEFAULT_TIMEOUT_VALUE = 15000; // in milliseconds + /** Default timeout, in milliseconds */ + private final static int DEFAULT_TIMEOUT_VALUE = 15000; // ------------------------------------------------------------------------ // Attributes @@ -62,12 +64,19 @@ public class CommandShell implements ICommandShell { private IRemoteSystemProxy fProxy = null; private IHostShell fHostShell = null; private BufferedReader fBufferReader = null; - private ExecutorService fExecutor = Executors.newFixedThreadPool(1); + private final ExecutorService fExecutor = Executors.newFixedThreadPool(1); private boolean fIsConnected = false; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param proxy + * The Remote System proxy + */ public CommandShell(IRemoteSystemProxy proxy) { fProxy = proxy; } @@ -139,7 +148,7 @@ public class CommandShell implements ICommandShell { if (monitor.isCanceled()) { flushInput(); - throw new CancellationException(); + throw new CancellationException(); } if (nextLine.contains(DONE_MARKUP_STRING) && nextLine.contains(SHELL_ECHO_CMD)) { @@ -151,7 +160,7 @@ public class CommandShell implements ICommandShell { // check if job was cancelled if (monitor.isCanceled()) { flushInput(); - throw new CancellationException(); + throw new CancellationException(); } if (!nextLine.contains(DONE_MARKUP_STRING)) { @@ -184,12 +193,12 @@ public class CommandShell implements ICommandShell { } throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null); } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ /** - * Flushes the buffer reader + * Flushes the buffer reader * @throws IOException */ private void flushInput() throws IOException { @@ -200,22 +209,25 @@ public class CommandShell implements ICommandShell { } } } - + /** - * format the command to be sent into the shell command with the done markup string. - * The done markup string is needed so we can tell that end of output has been reached. - * + * Format the command to be sent into the shell command with the done markup + * string. The done markup string is needed so we can tell that end of + * output has been reached. + * * @param cmd + * The original command * @return formatted command string */ private String formatShellCommand(String cmd) { - if (cmd == null || cmd.equals("")) //$NON-NLS-1$ + if (cmd == null || cmd.equals("")) { //$NON-NLS-1$ return cmd; + } StringBuffer formattedCommand = new StringBuffer(); // Make a multi line command by using \ and \r. This is needed for matching - // the DONE_MARKUP_STRING in echoed command when having a long command + // the DONE_MARKUP_STRING in echoed command when having a long command // (bigger than max SSH line) - formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$ + formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$ formattedCommand.append(SHELL_ECHO_CMD).append(DONE_MARKUP_STRING); formattedCommand.append(" $?"); //$NON-NLS-1$ formattedCommand.append(CMD_DELIMITER); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java index b8c9bd4c45..393d543cb4 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation *********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; @@ -15,19 +15,22 @@ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; ** Interface for providing command execution result. *
- * + * * @author Bernd Hufmann */ public interface ICommandResult { /** - * The result of the command. - * @return 0 if successful else >0 + * The result of the command. + * + * @return 0 if successful else >0 */ - public int getResult() ; + public int getResult(); /** * Sets the command result value. + * * @param result + * The integer result to set */ public void setResult(int result); @@ -38,7 +41,9 @@ public interface ICommandResult { /** * Sets the command output. + * * @param output + * The output (as an array of Strings) to assign */ public void setOutput(String[] output); } \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java index 60d6e5cab1..da89d3280b 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; @@ -18,41 +18,54 @@ import org.eclipse.core.runtime.IProgressMonitor; ** Interface for a command shell implementation *
- * + * * @author Bernd Hufmann */ public interface ICommandShell { - + /** * Method to connect the command shell. + * * @throws ExecutionException + * If the command fails */ public void connect() throws ExecutionException; - + /** * Method to disconnect the command shell. */ public void disconnect(); - + /** * Method to execute a command on the command shell. - * - * @param command - the command to executed - * @param monitor - a progress monitor + * + * @param command + * - the command to executed + * @param monitor + * - a progress monitor * @return the command result * @throws ExecutionException + * If the command fails */ - public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException; + public ICommandResult executeCommand(String command, + IProgressMonitor monitor) throws ExecutionException; /** * Method to execute a command on the command shell. - * - * @param command - the command to executed - * @param monitor - a progress monitor - * @param checkReturnValue - flag to indicate that the command result should be checked. If false the command result will be always 0. + * + * @param command + * - the command to executed + * @param monitor + * - a progress monitor + * @param checkReturnValue + * - flag to indicate that the command result should be checked. + * If false the command result will be always 0. * @return the command result * @throws ExecutionException + * If the command fails */ - public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException; + public ICommandResult executeCommand(final String command, + final IProgressMonitor monitor, final boolean checkReturnValue) + throws ExecutionException; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java index 52158156e3..7ffc7aea25 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; @@ -23,7 +23,7 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys ** Remote System Proxy interface. *
- * + * * @author Bernd Hufmann */ public interface IRemoteSystemProxy { @@ -33,77 +33,81 @@ public interface IRemoteSystemProxy { // ------------------------------------------------------------------------ /** * Find the first shell service. - * + * * @return shell service object, ornull
if not found.
*/
public IShellService getShellService();
/**
* Find the first terminal service.
- *
+ *
* @return shell service object, or null
if not found.
*/
public ITerminalService getTerminalService();
/**
* Find the first IShellServiceSubSystem service.
- *
+ *
* @return shell service subsystem, or null
if not found.
*/
public ISubSystem getShellServiceSubSystem();
/**
* Find the first ITerminalServiceSubSystem service.
- *
- * @param host the connection
+ *
* @return shell service subsystem, or null
if not found.
*/
public ISubSystem getTerminalServiceSubSystem();
-
+
/**
* Finds the File Service Subsystem.
- * @return file service subsystem, or null
if not found.
+ *
+ * @return file service subsystem, or null
if not found.
*/
public IFileServiceSubSystem getFileServiceSubSystem();
-
+
/**
- * Connects the shell service sub system.
- *
- * @param callback - call-back method being called when connection was finished
- * @throws Exception
+ * Connects the shell service sub system.
+ *
+ * @param callback
+ * - call-back method being called when connection was finished
+ * @throws ExecutionException
+ * If the connection fails
*/
public void connect(IRSECallback callback) throws ExecutionException;
/**
- * Disconnects from the shell service sub system.
- *
- * @throws Exception
+ * Disconnects from the shell service sub system.
+ *
+ * @throws ExecutionException
+ * If the disconnect command fails
*/
public void disconnect() throws ExecutionException;
/**
- * Creates a command shell.
- *
+ * Creates a command shell.
+ *
* @return the command shell implementation
- * @throws Exception
+ * @throws ExecutionException
+ * If the command fails
*/
public ICommandShell createCommandShell() throws ExecutionException;
/**
- * Method to add a communication listener to the connector service defined for
- * the given connection.
- *
- * @param listener - listener to add
- * @throws Exception
+ * Method to add a communication listener to the connector service defined
+ * for the given connection.
+ *
+ * @param listener
+ * - listener to add
*/
public void addCommunicationListener(ICommunicationsListener listener);
/**
- * Method to remove a communication listener from the connector service defined for
- * the given connection.
- *
- * @param listener - listener to remove
- * @throws Exception
+ * Method to remove a communication listener from the connector service
+ * defined for the given connection.
+ *
+ * @param listener
+ * - listener to remove
*/
public void removeCommunicationListener(ICommunicationsListener listener);
diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java
index 4e9f6c0212..fa2a964da0 100644
--- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java
+++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java
@@ -1,12 +1,12 @@
/**********************************************************************
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote;
@@ -27,19 +27,26 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys
* * RemoteSystemProxy implementation. *
- * + * * @author Bernd Hufmann */ public class RemoteSystemProxy implements IRemoteSystemProxy { - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - private IHost fHost; + private final IHost fHost; // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param host + * The host of this proxy + */ public RemoteSystemProxy(IHost host) { fHost = host; } @@ -86,8 +93,8 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { if (svc!=null) { ssvc = (IShellService)svc.getAdapter(IShellService.class); if (ssvc != null) { - return subSystems[i]; - } + return subSystems[i]; + } } } return null; @@ -108,8 +115,8 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { if (svc!=null) { ssvc = (ITerminalService)svc.getAdapter(ITerminalService.class); if (ssvc != null) { - return subSystems[i]; - } + return subSystems[i]; + } } } return null; @@ -132,7 +139,7 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { } return null; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback) */ @@ -176,7 +183,7 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { shell.connect(); return shell; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#addCommunicationListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) */ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java index 8d65032c7d..753150de0a 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.service; @@ -25,9 +25,9 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; /** *-* Interface for LTTng trace control command service. +* Interface for LTTng trace control command service. *
-* +* * @author Bernd Hufmann */ public interface ILttngControlService { @@ -39,178 +39,305 @@ public interface ILttngControlService { /** * Retrieves the existing sessions names from the node. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @return an array with session names. * @throws ExecutionException + * If the command fails */ - public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException; - + public String[] getSessionNames(IProgressMonitor monitor) + throws ExecutionException; + /** * Retrieves the session information with the given name the node. - * @param sessionName - the session name - * @param monitor - a progress monitor + * + * @param sessionName + * - the session name + * @param monitor + * - a progress monitor * @return session information * @throws ExecutionException - */ - public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException; - + * If the command fails + */ + public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) + throws ExecutionException; + /** * Retrieves the kernel provider information (i.e. the kernel events) - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @return the list of existing kernel events. * @throws ExecutionException + * If the command fails */ - public List* Service for sending LTTng trace control commands to remote host. *
- * + * * @author Bernd Hufmann */ public class LTTngControlService implements ILttngControlService { - - + + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -59,7 +59,7 @@ public class LTTngControlService implements ILttngControlService { * The command shell implementation */ protected ICommandShell fCommandShell = null; - + /** * The version string. */ @@ -71,7 +71,7 @@ public class LTTngControlService implements ILttngControlService { /** * Constructor - * + * * @param shell * - the command shell implementation to use */ @@ -90,9 +90,9 @@ public class LTTngControlService implements ILttngControlService { public String getVersion() { return fVersion; } - + /** - * Sets the version of the LTTng 2.0 control service. + * Sets the version of the LTTng 2.0 control service. * @param version - a version to set */ public void setVersion(String version) { @@ -101,10 +101,10 @@ public class LTTngControlService implements ILttngControlService { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getSessionNames(org.eclipse.core.runtime.IProgressMonitor) @@ -139,7 +139,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) @@ -189,7 +189,7 @@ public class LTTngControlService implements ILttngControlService { // set channels domainInfo.setChannels(channels); - + // set kernel flag domainInfo.setIsKernel(true); continue; @@ -206,7 +206,7 @@ public class LTTngControlService implements ILttngControlService { // set channels domainInfo.setChannels(channels); - + // set kernel flag domainInfo.setIsKernel(false); continue; @@ -218,7 +218,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getKernelProvider(org.eclipse.core.runtime.IProgressMonitor) @@ -238,7 +238,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getUstProvider() @@ -250,7 +250,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getUstProvider(org.eclipse.core.runtime.IProgressMonitor) @@ -322,7 +322,7 @@ public class LTTngControlService implements ILttngControlService { //Session myssession2 created. //Traces will be written in /home/user/lttng-traces/myssession2-20120209-095418 String[] output = result.getOutput(); - + // Get and verify session name Matcher matcher = LTTngControlServiceConstants.CREATE_SESSION_NAME_PATTERN.matcher(output[0]); String name = null; @@ -331,42 +331,42 @@ public class LTTngControlService implements ILttngControlService { name = String.valueOf(matcher.group(1).trim()); } else { // Output format not expected - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ - formatOutput(result)); + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ + formatOutput(result)); } if ((name == null) || (!name.equals(sessionName))) { // Unexpected name returned - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$ + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$ } - + // Get and verify session path matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); String path = null; - + if (matcher.matches()) { path = String.valueOf(matcher.group(1).trim()); } else { // Output format not expected - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ - formatOutput(result)); + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ + formatOutput(result)); } if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { // Unexpected path - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ } - + SessionInfo sessionInfo = new SessionInfo(name); sessionInfo.setSessionPath(path); return sessionInfo; } - + @Override public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); @@ -375,13 +375,13 @@ public class LTTngControlService implements ILttngControlService { ICommandResult result = executeCommand(command.toString(), monitor, false); String[] output = result.getOutput(); - + if (isError(result) && ((output == null) || (!LTTngControlServiceConstants.SESSION_NOT_FOUND_ERROR_PATTERN.matcher(output[0]).matches()))) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ } //Session* Constants for LTTng Control Service. *
- * + * * @author Bernd Hufmann */ public class LTTngControlServiceConstants { @@ -25,6 +25,9 @@ public class LTTngControlServiceConstants { // ------------------------------------------------------------------------ // Version constants // ------------------------------------------------------------------------ + /** + * Constant for the LTTng toolchain version + */ public final static String LTTNG_MAJOR_VERSION_2_0 = "2.0"; //$NON-NLS-1$ // ------------------------------------------------------------------------ @@ -51,35 +54,35 @@ public class LTTngControlServiceConstants { */ public final static String COMMAND_LIST_UST = COMMAND_LIST + "-u"; //$NON-NLS-1$ /** - * Command to create a session. + * Command to create a session. */ public final static String COMMAND_CREATE_SESSION = " create "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_DESTROY_SESSION = " destroy "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_START_SESSION = " start "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_STOP_SESSION = " stop "; //$NON-NLS-1$ /** - * Command to enable a channel. + * Command to enable a channel. */ public final static String COMMAND_ENABLE_CHANNEL = " enable-channel "; //$NON-NLS-1$ /** - * Command to disable a channel. + * Command to disable a channel. */ public final static String COMMAND_DISABLE_CHANNEL = " disable-channel "; //$NON-NLS-1$ /** - * Command to enable a event. + * Command to enable a event. */ public final static String COMMAND_ENABLE_EVENT = " enable-event "; //$NON-NLS-1$ /** - * Command to disable a event. + * Command to disable a event. */ public final static String COMMAND_DISABLE_EVENT = " disable-event "; //$NON-NLS-1$ /** @@ -169,7 +172,7 @@ public class LTTngControlServiceConstants { /** * Optional command line option for configuring a channel's overwrite mode. */ - public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$ + public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$ /** * Optional command line option for configuring a channel's number of sub buffers. */ @@ -187,7 +190,7 @@ public class LTTngControlServiceConstants { */ public final static String OPTION_READ_TIMER = " --read-timer "; //$NON-NLS-1$ /** - * Command line option for printing the help of a specif command + * Command line option for printing the help of a specif command */ public final static String OPTION_HELP = " -h "; //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java index 8c18577f00..b9def2b191 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: + * + * Contributors: * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.service; @@ -24,7 +24,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandSh * Factory to create LTTngControlService instances depending on the version of the LTTng Trace Control * installed on the remote host. * - * + * * @author Bernd Hufmann */ public class LTTngControlServiceFactory { @@ -36,7 +36,7 @@ public class LTTngControlServiceFactory { * The singleton instance. */ private static LTTngControlServiceFactory fInstance = null; - + // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ @@ -63,17 +63,17 @@ public class LTTngControlServiceFactory { // Factory method // ------------------------------------------------------------------------ /** - * Gets the LTTng Control Service implementation based on the version of the + * Gets the LTTng Control Service implementation based on the version of the * remote LTTng Tools. - * + * * @param shell - the shell implementation to pass to the service * @return - LTTng Control Service implementation - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public ILttngControlService getLttngControlService(ICommandShell shell) throws ExecutionException { // get the version ICommandResult result = shell.executeCommand(LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION, new NullProgressMonitor()); - + if ((result != null) && (result.getResult() == 0) && (result.getOutput().length >= 1) && (!LTTngControlServiceConstants.ERROR_PATTERN.matcher(result.getOutput()[0]).matches())) { int index = 0; while (index < result.getOutput().length) { -- 2.34.1