/**********************************************************************
* 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;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEnablement;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.EnableChannelDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.GetEventInfoDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.TraceControlDialogFactory;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEnablement;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceEventType;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceSessionState;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.KernelProviderComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent;
-import org.eclipse.rse.core.model.Host;
+import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.core.model.SystemProfile;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
import org.junit.After;
import org.junit.Before;
import org.osgi.framework.FrameworkUtil;
// ------------------------------------------------------------------------
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));
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();
- @SuppressWarnings("restriction")
- IHost host = new Host(new SystemProfile("myProfile", true));
- host.setHostName("127.0.0.1");
+ 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);
-
+
fFacility.waitForJobs();
-
+
fFacility.executeCommand(node, "connect");
int i = 0;
i++;
fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY);
}
-
+
// Verify that node is connected
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
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);
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
// ------------------------------------------------------------------------
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());
// ------------------------------------------------------------------------
// Get first UST provider
UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
- assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustProvider.getName());
+ assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello [PID=9379]", ustProvider.getName());
assertEquals(9379, ustProvider.getPid());
// Get events
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
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);