aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2012-09-07 08:18:32 (EDT)
committerBernd Hufmann2012-09-07 08:54:03 (EDT)
commit3cfb6eceb590bb1a98c83c9476c9d75f4ed645b5 (patch)
tree55468fbeb45554204c684c40550572c983a83760
parent2e6d2a009b651e5f39f5cdcf4d0c75bdabc60184 (diff)
downloadorg.eclipse.linuxtools-3cfb6eceb590bb1a98c83c9476c9d75f4ed645b5.zip
org.eclipse.linuxtools-3cfb6eceb590bb1a98c83c9476c9d75f4ed645b5.tar.gz
org.eclipse.linuxtools-3cfb6eceb590bb1a98c83c9476c9d75f4ed645b5.tar.bz2
Allow LTTng Control to connect to LTTng 2.x.y nodes (Bug 388545)
Commit includes - Support of remote nodes that have LTTng Tools 2.x.y installed - Display of LTTng Tools version in Properties View - Update JUnit tests Change-Id: I3dd19cf8ded4ffd74a2ff9f92fbd55c8e1b38c4c Signed-off-by: Bernd Hufmann <bhufmann@gmail.com> Reviewed-on: https://git.eclipse.org/r/7584 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java11
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TargetNodePropertySource.java33
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java9
9 files changed, 46 insertions, 18 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
index df0eda5..3b9f876 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java
@@ -160,6 +160,7 @@ public class TraceControlPropertiesTest extends TestCase {
assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
assertEquals("LOCALHOST", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
assertEquals(TargetNodeState.CONNECTED.name(), source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_STATE_PROPERTY_ID));
+ assertEquals("2.0.0", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_VERSION_PROPERTY_ID));
assertNull(source.getPropertyValue("test"));
adapter = node.getAdapter(IChannelInfo.class);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
index cf0abba..4bce2d1 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
@@ -131,7 +131,7 @@ public class LTTngControlServiceTest extends TestCase {
fShell.setScenario(SCEN_LTTNG_VERSION);
ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell);
assertNotNull(service);
- assertEquals("2.0.0", service.getVersion());
+ assertEquals("2.1.0", service.getVersion());
} catch (ExecutionException e) {
fail("Exeption thrown " + e);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
index 42b4004..283aa48 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
@@ -37,7 +37,7 @@ lttng version
0
</COMMAND_RESULT>
<COMMAND_OUTPUT>
-lttng version 2.0.0 - Annedd'ale
+lttng version 2.1.0 - Basse Messe
Web site: http://lttng.org/
lttng is free software and under the GPL license and part LGPL
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
index 32629d5..de3c042 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java
@@ -201,6 +201,7 @@ final public class Messages extends NLS {
public static String TraceControl_EventTypePropertyName;
public static String TraceControl_LogLevelPropertyName;
public static String TraceControl_StatePropertyName;
+ public static String TraceControl_VersionPropertyName;
public static String TraceControl_DomainNamePropertyName;
public static String TraceControl_ChannelNamePropertyName;
public static String TraceControl_OverwriteModePropertyName;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
index f6b2ed1..f0d1e50 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/messages.properties
@@ -184,6 +184,7 @@ TraceControl_EventNamePropertyName=Event Name
TraceControl_EventTypePropertyName=Event Type
TraceControl_LogLevelPropertyName=Log Level
TraceControl_StatePropertyName=State
+TraceControl_VersionPropertyName=Version
TraceControl_DomainNamePropertyName=Domain Name
TraceControl_ChannelNamePropertyName=Channel Name
TraceControl_OverwriteModePropertyName=Overwrite Mode
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
index a5d1a00..acfb61f 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java
@@ -207,6 +207,17 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
return new TraceSessionComponent[0];
}
+ /**
+ * @return node version
+ */
+ public String getNodeVersion() {
+ // Control service is null during connection to node
+ if (getControlService() != null) {
+ return getControlService().getVersion();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TargetNodePropertySource.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TargetNodePropertySource.java
index 1fbb2a7..4d82be2 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TargetNodePropertySource.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TargetNodePropertySource.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;
@@ -20,7 +20,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor;
* <p>
* Property source implementation for the target node component.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class TargetNodePropertySource extends BasePropertySource {
@@ -41,7 +41,12 @@ public class TargetNodePropertySource extends BasePropertySource {
*/
public static final String TARGET_NODE_STATE_PROPERTY_ID = "target.node.state"; //$NON-NLS-1$
/**
- * The node name property name.
+ * The node version property ID.
+ */
+ public static final String TARGET_NODE_VERSION_PROPERTY_ID = "target.node.version"; //$NON-NLS-1$
+
+ /**
+ * The node name property name.
*/
public static final String TARGET_NODE_NAME_PROPERTY_NAME = Messages.TraceControl_HostNamePropertyName;
/**
@@ -52,15 +57,19 @@ public class TargetNodePropertySource extends BasePropertySource {
* The state address property name.
*/
public static final String TARGET_NODE_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName;
-
+ /**
+ * The node version property name.
+ */
+ public static final String TARGET_NODE_VERSION_PROPERTY_NAME = Messages.TraceControl_VersionPropertyName;
+
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
- * The node component which this property source is for.
+ * The node component which this property source is for.
*/
private final TargetNodeComponent fTargetNode;
-
+
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
@@ -71,7 +80,7 @@ public class TargetNodePropertySource extends BasePropertySource {
public TargetNodePropertySource(TargetNodeComponent component) {
fTargetNode = component;
}
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -84,7 +93,8 @@ public class TargetNodePropertySource extends BasePropertySource {
return new IPropertyDescriptor[] {
new TextPropertyDescriptor(TARGET_NODE_NAME_PROPERTY_ID, TARGET_NODE_NAME_PROPERTY_NAME),
new TextPropertyDescriptor(TARGET_NODE_ADDRESS_PROPERTY_ID, TARGET_NODE_ADDRESS_PROPERTY_NAME),
- new TextPropertyDescriptor(TARGET_NODE_STATE_PROPERTY_ID, TARGET_NODE_STATE_PROPERTY_NAME)};
+ new TextPropertyDescriptor(TARGET_NODE_STATE_PROPERTY_ID, TARGET_NODE_STATE_PROPERTY_NAME),
+ new TextPropertyDescriptor(TARGET_NODE_VERSION_PROPERTY_ID, TARGET_NODE_VERSION_PROPERTY_NAME)};
}
/*
@@ -102,6 +112,9 @@ public class TargetNodePropertySource extends BasePropertySource {
if (TARGET_NODE_STATE_PROPERTY_ID.equals(id)) {
return fTargetNode.getTargetNodeState().name();
}
+ if (TARGET_NODE_VERSION_PROPERTY_ID.equals(id)) {
+ return fTargetNode.getNodeVersion();
+ }
return null;
}
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
index 5e84b86..d73ca76 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
@@ -26,9 +26,9 @@ public class LTTngControlServiceConstants {
// Version constants
// ------------------------------------------------------------------------
/**
- * Constant for the LTTng toolchain version 2.0
+ * Pattern to match the LTTng toolchain version 2.x.y.
*/
- public final static String LTTNG_MAJOR_VERSION_2_0 = "2.0"; //$NON-NLS-1$
+ public final static Pattern VERSION_2_PATTERN = Pattern.compile("(2\\.\\d+\\.\\d+).*"); //$NON-NLS-1$
// ------------------------------------------------------------------------
// Command constants
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
index 26649d5..130d89e 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java
@@ -90,10 +90,11 @@ public class LTTngControlServiceFactory {
int index = 0;
while (index < result.getOutput().length) {
String line = result.getOutput()[index];
- Matcher matcher = LTTngControlServiceConstants.VERSION_PATTERN.matcher(line);
- if (matcher.matches()) {
- String version = matcher.group(1).trim();
- if (version.startsWith(LTTngControlServiceConstants.LTTNG_MAJOR_VERSION_2_0)) {
+ Matcher versionMatcher = LTTngControlServiceConstants.VERSION_PATTERN.matcher(line);
+ if (versionMatcher.matches()) {
+ String version = versionMatcher.group(1).trim();
+ Matcher matcher = LTTngControlServiceConstants.VERSION_2_PATTERN.matcher(version);
+ if (matcher.matches()) {
LTTngControlService service = new LTTngControlService(shell);
service.setVersion(version);
return service;