From a30e79fec228287cbaf58fbb86b9df65df7ccaee Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Mon, 25 Feb 2013 08:40:47 -0500 Subject: [PATCH] Update to session creation procedure - Removed --no-consumer and --disable-consumer option because these options will be obsolete in LTTng Tools 2.2 - Updated commands and dialog boxes for this change - Updated JUnit tests Change-Id: Ic89c7af3df98c25ff777eebbe1a7e15785ec91ae Signed-off-by: Bernd Hufmann Reviewed-on: https://git.eclipse.org/r/10590 Tested-by: Hudson CI Reviewed-by: Matthew Khouzam IP-Clean: Matthew Khouzam Tested-by: Matthew Khouzam --- .../control/model/impl/ModelImplFactory.java | 2 +- .../control/model/impl/SessionInfoTest.java | 4 +- .../core/control/model/impl/SessionInfo.java | 2 + .../control/model/component/AllTests.java | 1 + .../TraceControlCreateSessionTests.java | 78 ++++------ .../service/LTTngControlServiceTest.java | 30 +--- .../dialogs/CreateSessionDialogStub.java | 18 --- .../testfiles/CreateSessionTest.cfg | 72 +++------ .../testfiles/LTTngServiceTest.cfg | 54 ++----- .../control/dialogs/CreateSessionDialog.java | 145 +++++++----------- .../control/dialogs/ICreateSessionDialog.java | 10 -- .../control/dialogs/IEnableUstEvents.java | 2 +- .../handlers/CreateSessionHandler.java | 5 +- .../ui/views/control/messages/Messages.java | 2 + .../control/messages/messages.properties | 10 +- .../control/model/impl/TraceSessionGroup.java | 35 ++--- .../control/service/ILttngControlService.java | 31 +--- .../control/service/LTTngControlService.java | 93 ++++++----- .../service/LTTngControlServiceConstants.java | 22 +-- 19 files changed, 201 insertions(+), 415 deletions(-) diff --git a/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java b/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java index 855fccd7d8..9ff84a553d 100644 --- a/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java +++ b/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/ModelImplFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Ericsson + * Copyright (c) 2012, 2013 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which diff --git a/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/SessionInfoTest.java b/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/SessionInfoTest.java index 69754f724f..3bdeb51237 100644 --- a/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/SessionInfoTest.java +++ b/org.eclipse.linuxtools.lttng2.core.tests/src/org/eclipse/linuxtools/lttng2/core/tests/control/model/impl/SessionInfoTest.java @@ -190,7 +190,7 @@ public class SessionInfoTest { String result = fixture.toString(); // add additional test code here - assertEquals("[SessionInfo([TraceInfo(Name=sessionName)],State=INACTIVE,Domains=)]", result); + assertEquals("[SessionInfo([TraceInfo(Name=sessionName)],State=INACTIVE,isStreamedTrace=false,Domains=)]", result); } /** @@ -201,7 +201,7 @@ public class SessionInfoTest { String result = fSessionInfo1.toString(); // add additional test code here - assertEquals("[SessionInfo([TraceInfo(Name=session1)],State=ACTIVE,Domains=[DomainInfo([TraceInfo(Name=test1)],Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],isKernel=false)])]", result); + assertEquals("[SessionInfo([TraceInfo(Name=session1)],State=ACTIVE,isStreamedTrace=false,Domains=[DomainInfo([TraceInfo(Name=test1)],Channels=[ChannelInfo([TraceInfo(Name=channel1)],State=DISABLED,OverwriteMode=true,SubBuffersSize=13,NumberOfSubBuffers=12,SwitchTimer=10,ReadTimer=11,output=splice(),Events=[EventInfo([BaseEventInfo([TraceInfo(Name=event1)],type=TRACEPOINT,level=TRACE_DEBUG)],State=ENABLED)])],isKernel=false)])]", result); } // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java index 2fa1b61de7..6778532f6a 100644 --- a/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java +++ b/org.eclipse.linuxtools.lttng2.core/src/org/eclipse/linuxtools/internal/lttng2/core/control/model/impl/SessionInfo.java @@ -247,6 +247,8 @@ public class SessionInfo extends TraceInfo implements ISessionInfo { output.append(super.toString()); output.append(",State="); output.append(fState); + output.append(",isStreamedTrace="); + output.append(fIsStreamedTrace); output.append(",Domains="); for (Iterator iterator = fDomains.iterator(); iterator.hasNext();) { IDomainInfo domain = iterator.next(); 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 922b8ba54b..5398e41fe5 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 @@ -22,6 +22,7 @@ import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ TraceControlComponentTest.class, + TraceControlCreateSessionTests.class, TraceControlKernelProviderTests.class, TraceControlKernelSessionTests.class, TraceControlPropertiesTest.class, diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java index b1c6e91fe4..1e0754b74e 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlCreateSessionTests.java @@ -50,11 +50,10 @@ public class TraceControlCreateSessionTests { // Constants // ------------------------------------------------------------------------ private static final String TEST_STREAM = "CreateSessionTest.cfg"; - private static final String SCEN_SCENARIO_NO_CONSUMER_TEST = "CreateSessionNoConsumer"; - private static final String SCEN_SCENARIO_DISABLE_CONSUMER_TEST = "CreateSessionDisableConsumer"; private static final String SCEN_SCENARIO_FILE_PROTO_TEST = "CreateSessionFileProto"; private static final String SCEN_SCENARIO_CONTROL_DATA_TEST = "CreateSessionControlData"; private static final String SCEN_SCENARIO_NETWORK_TEST = "CreateSessionNetwork"; + private static final String SCEN_SCENARIO_NETWORK2_TEST = "CreateSessionNetwork2"; // ------------------------------------------------------------------------ // Test data @@ -77,6 +76,7 @@ public class TraceControlCreateSessionTests { @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); File testfile = new File(FileLocator.toFileURL(location).toURI()); @@ -135,43 +135,24 @@ public class TraceControlCreateSessionTests { TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub); TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub()); - // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_NO_CONSUMER_TEST); - - // ------------------------------------------------------------------------ - // Create session (--no-consumer) and destroy - // ------------------------------------------------------------------------ - // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_NO_CONSUMER_TEST); - sessionDialogStub.setNoConsumer(true); - TraceSessionComponent session = fFacility.createSession(groups[1]); - - // Verify that session was created - assertNotNull(session); - assertEquals("mysession", session.getName()); - assertEquals("", session.getSessionPath()); - assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - sessionDialogStub.setNoConsumer(false); - - fFacility.destroySession(session); - - // Verify that no more session components exist - assertEquals(0, groups[1].getChildren().length); - // ------------------------------------------------------------------------ - // Create session (--disable-consumer) and destroy + // Create session (--U file://...) and destroy // ------------------------------------------------------------------------ // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_DISABLE_CONSUMER_TEST); + fProxy.setScenario(SCEN_SCENARIO_FILE_PROTO_TEST); - sessionDialogStub.setDisableConsumer(true); - session = fFacility.createSession(groups[1]); + sessionDialogStub.setNetworkUrl("file:///tmp"); + sessionDialogStub.setStreamedTrace(true); + TraceSessionComponent session = fFacility.createSession(groups[1]); // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); + assertEquals("file:///tmp", session.getSessionPath()); + assertTrue(!session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - sessionDialogStub.setDisableConsumer(false); + sessionDialogStub.setNetworkUrl(null); + sessionDialogStub.setStreamedTrace(false); fFacility.destroySession(session); @@ -179,22 +160,25 @@ public class TraceControlCreateSessionTests { assertEquals(0, groups[1].getChildren().length); // ------------------------------------------------------------------------ - // Create session (--U file://...) and destroy + // Create session (--U file://,,, and destroy // ------------------------------------------------------------------------ // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_FILE_PROTO_TEST); + fProxy.setScenario(SCEN_SCENARIO_CONTROL_DATA_TEST); - sessionDialogStub.setNetworkUrl("file:///tmp"); + sessionDialogStub.setControlUrl("tcp://172.0.0.1"); + sessionDialogStub.setDataUrl("tcp://172.0.0.1:5343"); sessionDialogStub.setStreamedTrace(true); + session = fFacility.createSession(groups[1]); // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); - assertEquals("file:///tmp", session.getSessionPath()); + assertEquals("tcp://172.0.0.1:5342 [data: 5343]", session.getSessionPath()); assertTrue(session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - sessionDialogStub.setNetworkUrl(null); + sessionDialogStub.setControlUrl(null); + sessionDialogStub.setDataUrl(null); sessionDialogStub.setStreamedTrace(false); fFacility.destroySession(session); @@ -203,13 +187,12 @@ public class TraceControlCreateSessionTests { assertEquals(0, groups[1].getChildren().length); // ------------------------------------------------------------------------ - // Create session (--U file://,,, and destroy + // Create session (--U file://... and destroy // ------------------------------------------------------------------------ // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_CONTROL_DATA_TEST); + fProxy.setScenario(SCEN_SCENARIO_NETWORK_TEST); - sessionDialogStub.setControlUrl("tcp://172.0.0.1"); - sessionDialogStub.setDataUrl("tcp://172.0.0.1:5343"); + sessionDialogStub.setNetworkUrl("net://172.0.0.1:1234:2345"); sessionDialogStub.setStreamedTrace(true); session = fFacility.createSession(groups[1]); @@ -217,12 +200,10 @@ 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("net://172.0.0.1:1234 [data: 2345]", session.getSessionPath()); assertTrue(session.isStreamedTrace()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - sessionDialogStub.setControlUrl(null); - sessionDialogStub.setDataUrl(null); - sessionDialogStub.setStreamedTrace(false); + sessionDialogStub.setNetworkUrl(null); fFacility.destroySession(session); @@ -230,12 +211,12 @@ public class TraceControlCreateSessionTests { assertEquals(0, groups[1].getChildren().length); // ------------------------------------------------------------------------ - // Create session (--U file://,,, and destroy + // Create session (--U net6://[...] and destroy // ------------------------------------------------------------------------ // Initialize session handling scenario - fProxy.setScenario(SCEN_SCENARIO_NETWORK_TEST); + fProxy.setScenario(SCEN_SCENARIO_NETWORK2_TEST); - sessionDialogStub.setNetworkUrl("net://172.0.0.1:1234:2345"); + sessionDialogStub.setNetworkUrl("net6://[ffff::eeee:dddd:cccc:0]"); sessionDialogStub.setStreamedTrace(true); session = fFacility.createSession(groups[1]); @@ -243,7 +224,7 @@ 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("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); @@ -253,6 +234,7 @@ public class TraceControlCreateSessionTests { // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); + //------------------------------------------------------------------------- // Disconnect node //------------------------------------------------------------------------- @@ -267,4 +249,4 @@ public class TraceControlCreateSessionTests { 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/service/LTTngControlServiceTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java index 035b4fe730..2c99106478 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 @@ -949,59 +949,41 @@ public class LTTngControlServiceTest { } } + @Test public void testCreateSession2_1() { try { fShell.setScenario(SCEN_CREATE_SESSION_2_1); - ISessionInfo info = fService.createSession("mysession", null, true, false, new NullProgressMonitor()); - assertNotNull(info); - assertEquals("mysession", info.getName()); - assertEquals("", info.getSessionPath()); - fService.destroySession("mysession", new NullProgressMonitor()); - - info = fService.createSession("mysession", "file:///tmp", null, null, true, false, new NullProgressMonitor()); - assertNotNull(info); - assertEquals("mysession", info.getName()); - assertEquals("", info.getSessionPath()); - assertTrue(info.isStreamedTrace()); - fService.destroySession("mysession", new NullProgressMonitor()); - - info = fService.createSession("mysession", "net://172.0.0.1", null, null, false, true, new NullProgressMonitor()); + ISessionInfo info = fService.createSession("mysession", "net://172.0.0.1", null, null, new NullProgressMonitor()); assertNotNull(info); assertEquals("mysession", info.getName()); assertEquals("net://172.0.0.1", info.getSessionPath()); assertTrue(info.isStreamedTrace()); fService.destroySession("mysession", new NullProgressMonitor()); - info = fService.createSession("mysession", null, false, true, new NullProgressMonitor()); - assertNotNull(info); - assertEquals("mysession", info.getName()); - // >>> no way to verify provided by tracer!!! - fService.destroySession("mysession", new NullProgressMonitor()); - - info = fService.createSession("mysession", "file:///tmp", null, null, false, false, new NullProgressMonitor()); + info = fService.createSession("mysession", "file:///tmp", null, null, new NullProgressMonitor()); assertNotNull(info); assertEquals("mysession", info.getName()); assertEquals("file:///tmp", info.getSessionPath()); assertTrue(info.isStreamedTrace()); fService.destroySession("mysession", new NullProgressMonitor()); - info = fService.createSession("mysession", "file:///tmp", null, null, false, false, new NullProgressMonitor()); + info = fService.createSession("mysession", "file:///tmp", null, null, new NullProgressMonitor()); assertNotNull(info); assertEquals("mysession", info.getName()); assertEquals("file:///tmp", info.getSessionPath()); assertTrue(info.isStreamedTrace()); fService.destroySession("mysession", new NullProgressMonitor()); - info = fService.createSession("mysession", null, "tcp://172.0.0.1", "tcp://172.0.0.1:5343", false, false, new NullProgressMonitor()); + info = fService.createSession("mysession", null, "tcp://172.0.0.1", "tcp://172.0.0.1:5343", new NullProgressMonitor()); assertNotNull(info); assertEquals("mysession", info.getName()); assertEquals("", info.getSessionPath()); // TODO: currently there is a bug in LTTng tracer and it returns string null assertTrue(info.isStreamedTrace()); fService.destroySession("mysession", new NullProgressMonitor()); - info = fService.createSession("mysession", "net://172.0.0.1:1234:2345", null, null, false, false, new NullProgressMonitor()); + info = fService.createSession("mysession", "net://172.0.0.1:1234:2345", null, null, new NullProgressMonitor()); assertNotNull(info); assertEquals("mysession", info.getName()); assertEquals("net://172.0.0.1:1234:2345", info.getSessionPath()); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java index 971553d62c..9fc04c2b71 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java @@ -27,8 +27,6 @@ public class CreateSessionDialogStub implements ICreateSessionDialog { private String fNetworkUrl = null; private String fControlUrl = null; private String fDataUrl = null; - private boolean fIsNoConsumer = false; - private boolean fIsDisableConsumer = false; @Override public String getSessionName() { @@ -99,20 +97,4 @@ public class CreateSessionDialogStub implements ICreateSessionDialog { this.fDataUrl = fDataUrl; } - @Override - public boolean isNoConsumer() { - return fIsNoConsumer; - } - public void setNoConsumer(boolean isNoConsumer) { - fIsNoConsumer = isNoConsumer; - } - - @Override - public boolean isDisableConsumer() { - return fIsDisableConsumer; - } - - public void setDisableConsumer(boolean isDisableConsumer) { - fIsDisableConsumer = isDisableConsumer; - } } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg b/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg index e0d79d1e70..9b06e93148 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg +++ b/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/CreateSessionTest.cfg @@ -76,53 +76,18 @@ PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello #################################################################### # Scenario: Test "lttng create with LTTng 2.1 options #################################################################### - -CreateSessionNoConsumer - -lttng create mysession --no-consumer - - -0 - - -Session mysession created. -Traces will be written in - - - -lttng list mysession - - -0 - - -Tracing session mysession: [inactive] - Trace path: - - - - -lttng destroy mysession - - -0 - - -Session mysession destroyed. - - ################################################################## -CreateSessionDisableConsumer +CreateSessionFileProto -lttng create mysession --disable-consumer +lttng create mysession -U file:///tmp 0 Session mysession created. -Traces will be written in /home/user/lttng-traces/mysession-20120209-095418 +Traces will be written in file:///tmp @@ -133,7 +98,7 @@ lttng list mysession Tracing session mysession: [inactive] - Trace path: /home/user/lttng-traces/mysession-20120209-095418 + Trace path: file:///tmp @@ -150,16 +115,17 @@ Session mysession destroyed. ################################################################## -CreateSessionFileProto +CreateSessionControlData -lttng create mysession -U file:///tmp +lttng create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343 0 Session mysession created. -Traces will be written in file:///tmp +Control URL tcp://172.0.0.1 set for session mysession +Data URL tcp://172.0.0.1:5343 set for session mysession @@ -170,7 +136,7 @@ lttng list mysession Tracing session mysession: [inactive] - Trace path: file:///tmp + Trace path: tcp://172.0.0.1:5342 [data: 5343] @@ -187,17 +153,16 @@ Session mysession destroyed. ################################################################## -CreateSessionControlData +CreateSessionNetwork -lttng create mysession -C tcp://172.0.0.1 -D tcp://172.0.0.1:5343 +lttng create mysession -U net://172.0.0.1:1234:2345 0 Session mysession created. -Control URL tcp://172.0.0.1 set for session mysession -Data URL tcp://172.0.0.1:5343 set for session mysession +Traces will be written in net://172.0.0.1:1234:2345 @@ -208,7 +173,7 @@ lttng list mysession Tracing session mysession: [inactive] - Trace path: tcp://172.0.0.1:5342 [data: 5343] + Trace path: net://172.0.0.1:1234 [data: 2345] @@ -219,22 +184,23 @@ lttng destroy mysession 0 -Session mysession destroyed. +Session mysession2 destroyed. + ################################################################## -CreateSessionNetwork +CreateSessionNetwork2 -lttng create mysession -U net://172.0.0.1:1234:2345 +lttng create mysession -U net6://[ffff::eeee:dddd:cccc:0] 0 Session mysession created. -Traces will be written in net://172.0.0.1:1234:2345 +Traces will be written in net6://[ffff::eeee:dddd:cccc:0] @@ -245,7 +211,7 @@ lttng list mysession Tracing session mysession: [inactive] - Trace path: net://172.0.0.1:1234 [data: 2345] + Trace path: net://[ffff::eeee:dddd:cccc:0]:5342/mysession-20130221-144451 [data: 5343] diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg b/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg index fc6a15d507..9c6e49573f 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg +++ b/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg @@ -846,51 +846,9 @@ Kernel calibration done #################################################################### CreateSessionLttng2.1 - -lttng create mysession --no-consumer - - -0 - - -Session mysession created. -Traces will be written in - - - -lttng create mysession -U file:///tmp --no-consumer - - -0 - - -Session mysession created. -Traces will be written in - - - -lttng destroy mysession - - -0 - - -Session mysession destroyed. - -lttng create mysession --disable-consumer - - -0 - - -Session mysession created. -Traces will be written in /home/user/lttng-traces/mysession-20120209-095418 - - - -lttng create mysession -U net://172.0.0.1 --disable-consumer +lttng create mysession -U net://172.0.0.1 0 @@ -934,4 +892,14 @@ Session mysession created. Traces will be written in net://172.0.0.1:1234:2345 + +lttng destroy mysession + + +0 + + +Session mysession destroyed. + + diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java index f021a63cf8..fb61d3d1ee 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java @@ -26,8 +26,8 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; @@ -103,6 +103,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog * The text widget for the session name */ private Text fSessionNameText = null; + /** + * The label widget for the session path. + */ + private Label fSessionPathLabel = null; /** * The text widget for the session path. */ @@ -119,6 +123,10 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog * The composite with streaming configuration parameter. */ private Composite fStreamingComposite = null; + /** + * The text widget for the trace path. + */ + private Text fTracePathText = null; /** * The button to link data protocol/Address with control protocol. */ @@ -131,10 +139,14 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog * A selection listener that copies the protocol from control to data when being linked. */ private ControlProtocolSelectionListener fCopyProtocolSelectionListener; - + /** + * A selection listener updates the control port text depending on the control protocol selected. + */ private ProtocolComboSelectionListener fControlProtocolSelectionListener; + /** + * A selection listener updates the data port text depending on the data protocol selected. + */ private ProtocolComboSelectionListener fDataProtocolSelectionListener; - /** * The text box for the host/IP address of the control channel. */ @@ -142,7 +154,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog /** * A key listener that copies the host address from control to data when being linked. */ - private CopyKeyListener fControlUrlKeyListener; + private CopyModifyListener fControlUrlKeyListener; /** * The text box for the control port. */ @@ -159,14 +171,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog * The text box for the data port. */ private Text fDataPortText = null; - /** - * The button to not activate a consumer. - */ - private Button fNoConsumerButton = null; - /** - * The button to disable the consumer. - */ - private Button fDisableConsumerButton = null; /** * The parent where the new node should be added. */ @@ -203,13 +207,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ private String fDataUrl = null; /** - * Flag for not activating a consumer for this session. - */ - private boolean fIsNoConsumer = false; - /** - * Flag for disabling a consumer for this session. + * The trace path string. */ - private boolean fIsDisableConsumer = false; + private String fTracePath = null; // ------------------------------------------------------------------------ // Constructors @@ -268,8 +268,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fNetworkUrl = null; fControlUrl = null; fDataUrl = null; - fIsNoConsumer = false; - fIsDisableConsumer = false; } @Override @@ -289,16 +287,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return fDataUrl; } - @Override - public boolean isNoConsumer() { - return fIsNoConsumer; - } - - @Override - public boolean isDisableConsumer() { - return fIsDisableConsumer; - } - // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -351,8 +339,8 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fSessionNameText = new Text(sessionGroup, SWT.NONE); fSessionNameText.setToolTipText(Messages.TraceControl_CreateSessionNameTooltip); - Label sessionPath = new Label(sessionGroup, SWT.RIGHT); - sessionPath.setText(Messages.TraceControl_CreateSessionPathLabel); + fSessionPathLabel = new Label(sessionGroup, SWT.RIGHT); + fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel); fSessionPathText = new Text(sessionGroup, SWT.NONE); fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip); @@ -367,38 +355,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fSessionPathText.setLayoutData(data); if (fParent.isNetworkStreamingSupported()) { - fNoConsumerButton = new Button(sessionGroup, SWT.CHECK); - fNoConsumerButton.setText(Messages.TraceControl_CreateSessionNoConsumertText); - fNoConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionNoConsumertTooltip); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - fNoConsumerButton.setLayoutData(data); - - fDisableConsumerButton = new Button(sessionGroup, SWT.CHECK); - fDisableConsumerButton.setText(Messages.TraceControl_CreateSessionDisableConsumertText); - fDisableConsumerButton.setToolTipText(Messages.TraceControl_CreateSessionDisableConsumertTooltip); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - fDisableConsumerButton.setLayoutData(data); - - fNoConsumerButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (fNoConsumerButton.getSelection()) { - fDisableConsumerButton.setSelection(false); - } - } - }); - - fDisableConsumerButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (fDisableConsumerButton.getSelection()) { - fNoConsumerButton.setSelection(false); - } - } - }); - createAdvancedOptionsComposite(); } @@ -412,7 +368,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fMainStreamingGroup.setLayout(new GridLayout(1, true)); fConfigureStreamingButton = new Button(fMainStreamingGroup, SWT.PUSH); - fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$ + fConfigureStreamingButton.setText(Messages.TraceControl_CreateSessionConfigureStreamingButtonText + " >>>"); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip); fConfigureStreamingButton.addSelectionListener(new SelectionAdapter() { @Override @@ -421,11 +377,16 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fIsStreamedTrace = false; fConfigureStreamingButton.setText(">>> " + Messages.TraceControl_CreateSessionConfigureStreamingButtonText); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionConfigureStreamingButtonTooltip); + fSessionPathText.setEnabled(true); + fSessionPathLabel.setText(Messages.TraceControl_CreateSessionPathLabel); disposeConfigureStreamingComposite(); } else { fIsStreamedTrace = true; fConfigureStreamingButton.setText("<<< " + Messages.TraceControl_CreateSessionNoStreamingButtonText); //$NON-NLS-1$ fConfigureStreamingButton.setToolTipText(Messages.TraceControl_CreateSessionNoStreamingButtonTooltip); + fSessionPathText.setEnabled(false); + fSessionPathText.setText(""); //$NON-NLS-1$ + fSessionPathLabel.setText(""); //$NON-NLS-1$ createConfigureStreamingComposite(); } @@ -450,10 +411,20 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog urlGroup.setLayout(layout); urlGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); + Label tracePathLabel = new Label(urlGroup, SWT.RIGHT); + tracePathLabel.setText(Messages.TraceControl_CreateSessionTracePathText); + fTracePathText = new Text(urlGroup, SWT.NONE); + fTracePathText.setToolTipText(Messages.TraceControl_CreateSessionTracePathTooltip); + + // layout widgets + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 6; + fTracePathText.setLayoutData(data); + fLinkDataWithControlButton = new Button(urlGroup, SWT.CHECK); fLinkDataWithControlButton.setText(Messages.TraceControl_CreateSessionLinkButtonText); fLinkDataWithControlButton.setToolTipText(Messages.TraceControl_CreateSessionLinkButtonTooltip); - GridData data = new GridData(GridData.FILL_HORIZONTAL); + data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 7; fLinkDataWithControlButton.setLayoutData(data); fLinkDataWithControlButton.setSelection(true); @@ -545,19 +516,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener); - fControlUrlKeyListener = new CopyKeyListener(fControlHostAddressText, fDataHostAddressText); - fControlHostAddressText.addKeyListener(fControlUrlKeyListener); - -// InetAddress inet = null; -// try { -// inet = InetAddress.getLocalHost(); -// inet = InetAddress.getByName(inet.getHostName()); -// } catch (UnknownHostException e1) { -// } -// if (inet != null) { -// fControlUrlAddressText.setText(inet.getHostAddress()); -// fDataUrlAddressText.setText(inet.getHostAddress()); -// } + fControlUrlKeyListener = new CopyModifyListener(fControlHostAddressText, fDataHostAddressText); + fControlHostAddressText.addModifyListener(fControlUrlKeyListener); + fControlProtocolCombo.select(DEFAULT_URL_INDEX); fDataProtocolCombo.select(DEFAULT_URL_INDEX); @@ -575,7 +536,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.removeSelectionListener(fControlProtocolSelectionListener); fDataProtocolCombo.removeSelectionListener(fDataProtocolSelectionListener); fControlProtocolCombo.addSelectionListener(fCopyProtocolSelectionListener); - fControlHostAddressText.addKeyListener(fControlUrlKeyListener); + fControlHostAddressText.addModifyListener(fControlUrlKeyListener); // Get previous selection and validate int currentSelection = fControlProtocolCombo.getSelectionIndex() <= COMMON_URL_LAST_INDEX ? @@ -606,7 +567,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlProtocolCombo.removeSelectionListener(fCopyProtocolSelectionListener); fControlProtocolCombo.addSelectionListener(fControlProtocolSelectionListener); fDataProtocolCombo.addSelectionListener(fDataProtocolSelectionListener); - fControlHostAddressText.removeKeyListener(fControlUrlKeyListener); + fControlHostAddressText.removeModifyListener(fControlUrlKeyListener); // Update combo box items int currentSelection = fControlProtocolCombo.getSelectionIndex(); @@ -706,6 +667,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fDataUrl = null; if (fIsStreamedTrace) { + // Validate input data + fTracePath = fTracePathText.getText(); + if (fControlProtocolCombo.getSelectionIndex() < 0) { MessageDialog.openError(getShell(), Messages.TraceControl_CreateSessionDialogTitle, @@ -739,19 +703,19 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fControlHostAddressText.getText(), fControlPortText.getText(), null, - fSessionPath); + fTracePath); fDataUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()), fDataHostAddressText.getText(), null, fDataPortText.getText(), - fSessionPath); + fTracePath); } else { fNetworkUrl = getUrlString(fControlProtocolCombo.getItem(fDataProtocolCombo.getSelectionIndex()), fControlHostAddressText.getText(), fControlPortText.getText(), fDataPortText.getText(), - fSessionPath); + fTracePath); } } @@ -771,11 +735,6 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return; } - if (fParent.isNetworkStreamingSupported()) { - fIsNoConsumer = fNoConsumerButton.getSelection(); - fIsDisableConsumer = fDisableConsumerButton.getSelection(); - } - // validation successful -> call super.okPressed() super.okPressed(); } @@ -804,17 +763,17 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog return stringBuilder.toString(); } - private static class CopyKeyListener extends KeyAdapter { + private static class CopyModifyListener implements ModifyListener { private Text fSource; private Text fDestination; - public CopyKeyListener(Text source, Text destination) { + public CopyModifyListener(Text source, Text destination) { fSource = source; fDestination = destination; } @Override - public void keyReleased(KeyEvent e) { + public void modifyText(ModifyEvent e) { fDestination.setText(fSource.getText()); } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java index c7f6b10803..066b1458a6 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ICreateSessionDialog.java @@ -77,16 +77,6 @@ public interface ICreateSessionDialog { */ public String getDataUrl(); - /** - * @return for not activating a consumer for this session - */ - public boolean isNoConsumer(); - - /** - * @return for disabling a consumer for this session - */ - public boolean isDisableConsumer(); - // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java index aaaefe96ba..a53477ed42 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableUstEvents.java @@ -80,4 +80,4 @@ public interface IEnableUstEvents { */ public String getFilterExpression(); -} \ No newline at end of file +} diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java index 2377ac3043..e42d9c31f4 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java @@ -74,11 +74,10 @@ public class CreateSessionHandler extends BaseControlViewHandler { try { if (dialog.isStreamedTrace()) { sessionGroup.createSession(dialog.getSessionName(), dialog.getNetworkUrl(), dialog.getControlUrl(), - dialog.getDataUrl(), dialog.isNoConsumer(), dialog.isDisableConsumer(), monitor); + dialog.getDataUrl(), monitor); } else { String sessionPath = dialog.isDefaultSessionPath() ? null : dialog.getSessionPath(); - sessionGroup.createSession(dialog.getSessionName(), sessionPath, dialog.isNoConsumer(), - dialog.isDisableConsumer(), monitor); + sessionGroup.createSession(dialog.getSessionName(), sessionPath, monitor); } } catch (ExecutionException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); 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 61afa31d15..cad9d6b7db 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 @@ -103,6 +103,8 @@ final public class Messages extends NLS { public static String TraceControl_CreateSessionConfigureStreamingButtonTooltip; public static String TraceControl_CreateSessionNoStreamingButtonText; public static String TraceControl_CreateSessionNoStreamingButtonTooltip; + public static String TraceControl_CreateSessionTracePathText; + public static String TraceControl_CreateSessionTracePathTooltip; public static String TraceControl_CreateSessionLinkButtonText; public static String TraceControl_CreateSessionLinkButtonTooltip; public static String TraceControl_CreateSessionProtocolLabelText; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties index e6a89c578a..0001a33226 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties @@ -82,10 +82,12 @@ TraceControl_CreateSessionNameTooltip=The name of the session to be created. TraceControl_CreateSessionPathLabel=Session Path TraceControl_CreateSessionPathTooltip=The session path (keep empty for default location) -TraceControl_CreateSessionConfigureStreamingButtonText=Configure Streaming -TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure streaming parameters -TraceControl_CreateSessionNoStreamingButtonText=Remove Streaming -TraceControl_CreateSessionNoStreamingButtonTooltip=Remove streaming configuration +TraceControl_CreateSessionConfigureStreamingButtonText=Advanced +TraceControl_CreateSessionConfigureStreamingButtonTooltip=Configure advanced options +TraceControl_CreateSessionNoStreamingButtonText=Basic +TraceControl_CreateSessionNoStreamingButtonTooltip=Use basic options +TraceControl_CreateSessionTracePathText=Trace Path +TraceControl_CreateSessionTracePathTooltip=The trace path (keep empty for default location) TraceControl_CreateSessionLinkButtonText=Synchronize data with control configuration TraceControl_CreateSessionLinkButtonTooltip=Synchronize data protocol and host address with control channel configuration TraceControl_CreateSessionProtocolLabelText=Protocol diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java index 20e315d99a..8dea7aeb06 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2012 Ericsson + * Copyright (c) 2012, 2013 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,6 +8,7 @@ * * Contributors: * Bernd Hufmann - Initial API and implementation + * Bernd Hufmann - Updated for support of LTTng Tools 2.1 **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl; @@ -108,15 +109,11 @@ public class TraceSessionGroup extends TraceControlComponent { * - a session name to create * @param sessionPath * - a path for storing the traces (use null for default) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer) throws ExecutionException { - createSession(sessionName, sessionPath, noConsumer, disableConsumer, new NullProgressMonitor()); + public void createSession(String sessionName, String sessionPath) throws ExecutionException { + createSession(sessionName, sessionPath, new NullProgressMonitor()); } /** @@ -126,17 +123,13 @@ public class TraceSessionGroup extends TraceControlComponent { * - a session name to create * @param sessionPath * - a path for storing the traces (use null for default) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, noConsumer, disableConsumer, 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( @@ -158,15 +151,11 @@ public class TraceSessionGroup extends TraceControlComponent { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer) throws ExecutionException { - createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, new NullProgressMonitor()); + public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl) throws ExecutionException { + createSession(sessionName, networkUrl, controlUrl, dataUrl, new NullProgressMonitor()); } /** @@ -181,17 +170,13 @@ public class TraceSessionGroup extends TraceControlComponent { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @throws ExecutionException * If the command fails */ - public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, noConsumer, disableConsumer, monitor); + public void createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException { + ISessionInfo sessionInfo = getControlService().createSession(sessionName, networkUrl, controlUrl, dataUrl, monitor); if (sessionInfo != null) { TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this); 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 b07196028b..cecee4fd6d 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 @@ -118,29 +118,7 @@ public interface ILttngControlService { * @throws ExecutionException * If the command fails */ - public ISessionInfo createSession(String sessionName, String sessionPath, - IProgressMonitor monitor) throws ExecutionException; - - /** - * 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 noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer - * @param monitor - * - a progress monitor - * @return the session information - * @throws ExecutionException - * If the command fails - */ - public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException; - + public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException; /** * Creates a session with given session name and location. @@ -154,18 +132,13 @@ public interface ILttngControlService { * - a URL for control channel (networkUrl has to be null, dataUrl has to be set) * @param dataUrl * - a URL for data channel (networkUrl has to be null, controlUrl has to be set) - * @param noConsumer - * - a flag to indicate no consumer - * @param disableConsumer - * - a flag to disable consumer * @param monitor * - a progress monitor * @return the session information * @throws ExecutionException * If the command fails */ - public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException; + public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException; /** * Destroys a session with given session name. diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java index c31c31e872..fd056175be 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java @@ -201,34 +201,42 @@ public class LTTngControlService implements ILttngControlService { if (matcher.matches()) { // Create Domain IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_KernelDomainDisplayName); - sessionInfo.addDomain(domainInfo); // in domain kernel ArrayList channels = new ArrayList(); index = parseDomain(result.getOutput(), index, channels); - // set channels - domainInfo.setChannels(channels); + if (channels.size() > 0) { + // add domain + sessionInfo.addDomain(domainInfo); - // set kernel flag - domainInfo.setIsKernel(true); + // set channels + domainInfo.setChannels(channels); + + // set kernel flag + domainInfo.setIsKernel(true); + } continue; } matcher = LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line); if (matcher.matches()) { IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_UstGlobalDomainDisplayName); - sessionInfo.addDomain(domainInfo); // in domain UST ArrayList channels = new ArrayList(); index = parseDomain(result.getOutput(), index, channels); - // set channels - domainInfo.setChannels(channels); + if (channels.size() > 0) { + // add domain + sessionInfo.addDomain(domainInfo); + + // set channels + domainInfo.setChannels(channels); - // set kernel flag - domainInfo.setIsKernel(false); + // set kernel flag + domainInfo.setIsKernel(false); + } continue; } index++; @@ -355,12 +363,6 @@ public class LTTngControlService implements ILttngControlService { */ @Override public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { - return createSession(sessionName, sessionPath, false, false, monitor); - } - - @Override - public ISessionInfo createSession(String sessionName, String sessionPath, boolean noConsumer, boolean disableConsumer, - IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); String newPath = formatParameter(sessionPath); @@ -372,12 +374,6 @@ public class LTTngControlService implements ILttngControlService { command.append(newPath); } - if (noConsumer) { - command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER); - } else if (disableConsumer) { - command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER); - } - ICommandResult result = executeCommand(command.toString(), monitor); //Session myssession2 created. @@ -405,27 +401,25 @@ public class LTTngControlService implements ILttngControlService { SessionInfo sessionInfo = new SessionInfo(name); - if (!noConsumer) { - // Get and verify session path - matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); - String path = null; + // 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)); - } + 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)); + } - if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { - // Unexpected path - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ - } - sessionInfo.setSessionPath(path); + if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { + // Unexpected path + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ } + sessionInfo.setSessionPath(path); return sessionInfo; @@ -433,11 +427,10 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) */ @Override - public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, - String dataUrl, boolean noConsumer, boolean disableConsumer, IProgressMonitor monitor) throws ExecutionException { + public ISessionInfo createSession(String sessionName, String networkUrl, String controlUrl, String dataUrl, IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION, newName); @@ -453,12 +446,6 @@ public class LTTngControlService implements ILttngControlService { command.append(dataUrl); } - if (noConsumer) { - command.append(LTTngControlServiceConstants.OPTION_NO_CONSUMER); - } else if (disableConsumer) { - command.append(LTTngControlServiceConstants.OPTION_DISABLE_CONSUMER); - } - ICommandResult result = executeCommand(command.toString(), monitor); //Session myssession2 created. @@ -482,7 +469,7 @@ public class LTTngControlService implements ILttngControlService { String path = null; SessionInfo sessionInfo = new SessionInfo(name); - if (!noConsumer && (networkUrl != null)) { + if (networkUrl != null) { if (matcher.matches()) { path = String.valueOf(matcher.group(1).trim()); } else { @@ -1005,6 +992,8 @@ public class LTTngControlService implements ILttngControlService { String line = output[index]; Matcher outerMatcher = LTTngControlServiceConstants.CHANNELS_SECTION_PATTERN.matcher(line); + Matcher noKernelChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_KERNEL_CHANNEL_PATTERN.matcher(line); + Matcher noUstChannelMatcher = LTTngControlServiceConstants.DOMAIN_NO_UST_CHANNEL_PATTERN.matcher(line); if (outerMatcher.matches()) { IChannelInfo channelInfo = null; while (index < output.length) { @@ -1069,6 +1058,10 @@ public class LTTngControlService implements ILttngControlService { } index++; } + } else if (noKernelChannelMatcher.matches() || noUstChannelMatcher.matches()) { + // domain indicates that no channels were found -> return + index++; + return index; } index++; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java index ac50f4fa36..79295b5fad 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java @@ -214,14 +214,6 @@ public class LTTngControlServiceConstants { * Command line option for configuring the streaming data URL. */ public final static String OPTION_DATA_URL = " -D "; //$NON-NLS-1$ - /** - * Command line option for configuring of no consumer. - */ - public final static String OPTION_NO_CONSUMER = " --no-consumer "; //$NON-NLS-1$ - /** - * Command line option for disabling the consumer. - */ - public final static String OPTION_DISABLE_CONSUMER = " --disable-consumer "; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Parsing constants @@ -247,9 +239,10 @@ public class LTTngControlServiceConstants { */ public final static Pattern TRACE_SESSION_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(.*)"); //$NON-NLS-1$ /** - * Patter to match session path for network tracing (lttng list ) + * Pattern to match session path for network tracing (lttng list ) + * Note: file for protocol is not considered as network trace since local consumer will be used. */ - public final static Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|file|tcp|tcp6|)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$ + public final static Pattern TRACE_NETWORK_PATH_PATTERN = Pattern.compile("\\s*Trace\\s+path\\:\\s+(net|net6|tcp|tcp6|)\\:\\/\\/(.*)(\\:(\\d*)\\/(.*)\\[data\\:\\s+(\\d*)\\]){0,1}"); //$NON-NLS-1$ /** * Pattern to match for kernel domain information (lttng list ) */ @@ -258,6 +251,14 @@ public class LTTngControlServiceConstants { * Pattern to match for ust domain information (lttng list ) */ public final static Pattern DOMAIN_UST_GLOBAL_PATTERN = Pattern.compile("=== Domain: UST global ==="); //$NON-NLS-1$ + /** + * Pattern to match for matching warning about no kernel channel + */ + public final static Pattern DOMAIN_NO_KERNEL_CHANNEL_PATTERN = Pattern.compile("\\s*Warning\\:\\s+No kernel\\s+channel.*"); //$NON-NLS-1$ + /** + * Pattern to match for matching warning about no UST channel + */ + public final static Pattern DOMAIN_NO_UST_CHANNEL_PATTERN = Pattern.compile("\\s*Error\\:\\s+UST\\s+channel\\s+not\\s+found.*"); //$NON-NLS-1$ /** * Pattern to match for channels section (lttng list ) */ @@ -329,7 +330,6 @@ public class LTTngControlServiceConstants { /** * Pattern to match event fields */ - // field: content (string) public final static Pattern EVENT_FIELD_PATTERN = Pattern.compile("\\s*(field:)\\s+(.*)\\s+\\((.*)\\)"); //$NON-NLS-1$ /** * Pattern to match for UST provider information (lttng list -u) -- 2.34.1