X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=org.eclipse.linuxtools.lttng2.control.ui.tests%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Flttng2%2Fcontrol%2Fui%2Ftests%2Fmodel%2Fcomponent%2FTraceControlCreateSessionTests.java;h=50611ca5a2944e9297e479e61e9dbb58242c54b0;hb=7fa45c7fd86d7458d3963367dc5f6786ce043455;hp=4ff93b0ad8dd8efb9238019da16d57297edae521;hpb=e5e5b3db58be0a4926502168173ad81af219dd34;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java index 4ff93b0ad8..50611ca5a2 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlCreateSessionTests.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2013 Ericsson + * Copyright (c) 2013, 2014 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -8,7 +8,9 @@ * * Contributors: * Bernd Hufmann - Initial API and implementation + * Jonathan Rajotte - Support for LTTng 2.6 **********************************************************************/ + package org.eclipse.linuxtools.lttng2.control.ui.tests.model.component; import static org.junit.Assert.assertEquals; @@ -29,6 +31,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceCont import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.ITraceControlComponent; import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TargetNodeComponent; import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent; +import org.eclipse.linuxtools.internal.lttng2.control.ui.views.service.ILttngControlService; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemProfile; @@ -39,11 +42,9 @@ import org.junit.Test; import org.osgi.framework.FrameworkUtil; /** - * The class TraceControlKernelSessionTests contains Kernel session/channel/event - * handling test cases. + * The class {@link TraceControlKernelSessionTests} contains Kernel + * session/channel/event handling test cases. */ - -@SuppressWarnings("javadoc") public class TraceControlCreateSessionTests { // ------------------------------------------------------------------------ @@ -55,6 +56,8 @@ public class TraceControlCreateSessionTests { private static final String SCEN_SCENARIO_NETWORK_TEST = "CreateSessionNetwork"; private static final String SCEN_SCENARIO_NETWORK2_TEST = "CreateSessionNetwork2"; + private static final String SESSION = "mysession"; + // ------------------------------------------------------------------------ // Test data // ------------------------------------------------------------------------ @@ -70,25 +73,29 @@ public class TraceControlCreateSessionTests { * Perform pre-test initialization. * * @throws Exception - * if the initialization fails for some reason - * + * if the initialization fails for some reason */ @Before public void setUp() throws Exception { fFacility = TraceControlTestFacility.getInstance(); fFacility.init(); fProxy = new TestRemoteSystemProxy(); - URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null); + URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + getTestStream()), null); File testfile = new File(FileLocator.toFileURL(location).toURI()); fTestFile = testfile.getAbsolutePath(); } /** - * Perform post-test clean-up. - * - * @throws Exception - * if the clean-up fails for some reason + * Get the test stream file name to use for the test suite * + * @return the name of the test stream file + */ + protected String getTestStream() { + return TEST_STREAM; + } + + /** + * Perform post-test clean-up. */ @After public void tearDown() { @@ -97,6 +104,9 @@ public class TraceControlCreateSessionTests { /** * Run the TraceControlComponent. + * + * @throws Exception + * on internal error */ @Test public void testTraceSessionTree() throws Exception { @@ -107,7 +117,7 @@ public class TraceControlCreateSessionTests { ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); - ISystemProfile profile = registry.createSystemProfile("myProfile", true); + ISystemProfile profile = registry.createSystemProfile("myProfile", true); IHost host = registry.createLocalHost(profile, "myProfile", "user"); TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy); @@ -125,6 +135,8 @@ public class TraceControlCreateSessionTests { // Verify that node is connected assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState()); + ILttngControlService controleService = node.getControlService(); + // Get provider groups ITraceControlComponent[] groups = node.getChildren(); assertNotNull(groups); @@ -147,8 +159,13 @@ public class TraceControlCreateSessionTests { // Verify that session was created assertNotNull(session); - assertEquals("mysession", session.getName()); - assertEquals("file:///tmp", session.getSessionPath()); + assertEquals(getSessionName(), session.getName()); + if (controleService.isVersionSupported("2.6.0")) { + assertEquals("/tmp", session.getSessionPath()); + } else { + assertEquals("file:///tmp", session.getSessionPath()); + } + assertTrue(!session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); sessionDialogStub.setNetworkUrl(null); @@ -173,8 +190,12 @@ public class TraceControlCreateSessionTests { // Verify that session was created assertNotNull(session); - assertEquals("mysession", session.getName()); - assertEquals("tcp://172.0.0.1:5342 [data: 5343]", session.getSessionPath()); + assertEquals(getSessionName(), session.getName()); + if (controleService.isVersionSupported("2.6.0")) { + assertEquals("tcp4://172.0.0.1:5342/ [data: 5343]", session.getSessionPath()); + } else { + assertEquals("tcp://172.0.0.1:5342 [data: 5343]", session.getSessionPath()); + } assertTrue(session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); sessionDialogStub.setControlUrl(null); @@ -199,8 +220,12 @@ public class TraceControlCreateSessionTests { // Verify that session was created assertNotNull(session); - assertEquals("mysession", session.getName()); - assertEquals("net://172.0.0.1:1234 [data: 2345]", session.getSessionPath()); + assertEquals(getSessionName(), session.getName()); + if (controleService.isVersionSupported("2.6.0")) { + assertEquals("tcp4://172.0.0.1:1234/mysession-20140820-153527 [data: 2345]", session.getSessionPath()); + } else { + assertEquals("net://172.0.0.1:1234 [data: 2345]", session.getSessionPath()); + } assertTrue(session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); sessionDialogStub.setNetworkUrl(null); @@ -223,8 +248,12 @@ public class TraceControlCreateSessionTests { // Verify that session was created assertNotNull(session); - assertEquals("mysession", session.getName()); - assertEquals("net://[ffff::eeee:dddd:cccc:0]:5342/mysession-20130221-144451 [data: 5343]", session.getSessionPath()); + assertEquals(getSessionName(), session.getName()); + if (controleService.isVersionSupported("2.6.0")) { + assertEquals("tcp6://[ffff::eeee:dddd:cccc:0]:5342/mysession-20140820-153801 [data: 5343]", session.getSessionPath()); + } else { + assertEquals("net://[ffff::eeee:dddd:cccc:0]:5342/mysession-20130221-144451 [data: 5343]", session.getSessionPath()); + } assertTrue(session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); sessionDialogStub.setNetworkUrl(null); @@ -234,19 +263,22 @@ public class TraceControlCreateSessionTests { // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); - - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // Disconnect node - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- fFacility.executeCommand(node, "disconnect"); assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // Delete node - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- fFacility.executeCommand(node, "delete"); - assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length); + assertEquals(0, fFacility.getControlView().getTraceControlRoot().getChildren().length); + } + + private static String getSessionName() { + return SESSION; } }