tmf: lttngControl: new enum TraceChannelOutputType
authorJonathan Rajotte Julien <jonathan.rajotte-julien@ericsson.com>
Fri, 15 Aug 2014 21:37:37 +0000 (17:37 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 27 Aug 2014 15:35:20 +0000 (11:35 -0400)
Change-Id: Ia2e77d9043f1cdbd08a4fdfcf265700b2bba194e
Signed-off-by: Jonathan Rajotte Julien <jonathan.rajotte-julien@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/31787
Tested-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
13 files changed:
org.eclipse.linuxtools.lttng2.control.core.tests/src/org/eclipse/linuxtools/lttng2/control/core/tests/model/impl/ChannelInfoTest.java
org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/IChannelInfo.java
org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceChannelOutputType.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/impl/ChannelInfo.java
org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/lttng2/control/core/session/SessionConfigGenerator.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java
org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/service/LTTngControlServiceTest.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceChannelComponent.java
org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TraceChannelPropertySource.java

index 6dc8b9436ef2766270dc1319ff2995232437310b..44a078e0123827d8a9cc7a1fc6c379be01b25fcc 100644 (file)
@@ -20,6 +20,7 @@ import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.BufferType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
@@ -72,7 +73,8 @@ public class ChannelInfoTest {
 
         assertEquals("test", result.getName());
         assertEquals(0, result.getNumberOfSubBuffers());
-        assertEquals("", result.getOutputType());
+        assertEquals("unknown", result.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.UNKNOWN, result.getOutputType());
         assertEquals(false, result.isOverwriteMode());
         assertEquals(0, result.getReadTimer());
         assertEquals("disabled", result.getState().getInName());
@@ -184,7 +186,7 @@ public class ChannelInfoTest {
         long numSubBuffers = fixture.getNumberOfSubBuffers();
         assertEquals(4, numSubBuffers);
 
-        String outputType = fixture.getOutputType();
+        String outputType = fixture.getOutputType().getInName();
         assertEquals("splice()", outputType);
 
         long subBufferSize = fixture.getSubBufferSize();
@@ -225,7 +227,7 @@ public class ChannelInfoTest {
         numSubBuffers = fixture.getNumberOfSubBuffers();
         assertEquals(7, numSubBuffers);
 
-        outputType = fixture.getOutputType();
+        outputType = fixture.getOutputType().getInName();
         assertEquals("mmap()", outputType);
 
         subBufferSize = fixture.getSubBufferSize();
index 6cf9e118ec5ae00823b3b128f02f076bd4d29c18..8018ea0458ad0f6c5f42adf2c5f45af5f7058d1c 100644 (file)
@@ -86,12 +86,17 @@ public interface IChannelInfo extends ITraceInfo {
     /**
      * @return the output type.
      */
-    String getOutputType();
+    TraceChannelOutputType getOutputType();
     /**
      * Sets the output type to the given value.
      * @param type - type to set.
      */
     void setOutputType(String type);
+    /**
+     * Sets the output type to the given value.
+     * @param type - type to set.
+     */
+    void setOutputType(TraceChannelOutputType type);
 
     /**
      * @return the channel state (enabled or disabled).
diff --git a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceChannelOutputType.java b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceChannelOutputType.java
new file mode 100644 (file)
index 0000000..7e53f81
--- /dev/null
@@ -0,0 +1,74 @@
+/**********************************************************************
+ * Copyright (c) 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
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Jonathan Rajotte - Initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.control.core.model;
+
+/**
+ * Trace domain type enumeration.
+ *
+ * @author Jonathan Rajotte
+ */
+public enum TraceChannelOutputType {
+    /** Channel output type : splice */
+    SPLICE("splice()", "SPLICE" ), //$NON-NLS-1$ //$NON-NLS-2$
+    /** Channel output type : mmap */
+    MMAP("mmap()", "MMAP"), //$NON-NLS-1$ //$NON-NLS-2$
+    /** Channel output type : unknown */
+    UNKNOWN("unknown", "unknown"); //$NON-NLS-1$ //$NON-NLS-2$
+
+    private final String fInName;
+    private final String fInMiName;
+
+    private TraceChannelOutputType(String name, String miName) {
+        fInName = name;
+        fInMiName = miName;
+    }
+
+    /**
+     * Get the type's name
+     *
+     * @return The type's name
+     */
+    public String getInName() {
+        return fInName;
+    }
+
+    /**
+     * Get the type's name
+     *
+     * @return The type's name
+     */
+    public String getInMiName() {
+        return fInMiName;
+    }
+
+    /**
+     * Return the corresponding {@link TraceChannelOutputType} of string miName
+     *
+     * @param name
+     *            name of the Trace domain type to look for
+     * @return the corresponding {@link TraceChannelOutputType}
+     */
+    public static TraceChannelOutputType valueOfString(String name) {
+        if (name == null) {
+            throw new IllegalArgumentException();
+        }
+        for (TraceChannelOutputType tdType : TraceChannelOutputType.values()) {
+            boolean isEqual = tdType.getInName().equalsIgnoreCase(name) || tdType.getInMiName().equalsIgnoreCase(name);
+            if (isEqual) {
+                return tdType;
+            }
+        }
+        // Unknown domain
+        return UNKNOWN;
+    }
+}
\ No newline at end of file
index 951b91fa330cdd7b37d7ea41a0e3613d468ad2ba..6e2f6269921b8bcd2887787bd3dd6027b196b253 100644 (file)
@@ -19,6 +19,7 @@ import java.util.List;
 
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 
 /**
@@ -55,7 +56,7 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
     /**
      * The Output type of the channel.
      */
-    private String fOutputType = ""; //$NON-NLS-1$
+    private TraceChannelOutputType fOutputType = TraceChannelOutputType.UNKNOWN;
     /**
      * The channel enable state.
      */
@@ -106,7 +107,7 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
         fMaxSizeTraceFiles = other.fMaxSizeTraceFiles;
         fMaxNumberTraceFiles = other.fMaxNumberTraceFiles;
         fBufferType = other.fBufferType;
-        fOutputType = (other.fOutputType == null ? null : String.valueOf(other.fOutputType));
+        fOutputType = (other.fOutputType == null ? null : other.fOutputType);
         fState = other.fState;
         for (Iterator<IEventInfo> iterator = other.fEvents.iterator(); iterator.hasNext();) {
             IEventInfo event = iterator.next();
@@ -173,12 +174,17 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
     }
 
     @Override
-    public String getOutputType() {
+    public TraceChannelOutputType getOutputType() {
         return fOutputType;
     }
 
     @Override
     public void setOutputType(String type) {
+        fOutputType = TraceChannelOutputType.valueOfString(type);
+    }
+
+    @Override
+    public void setOutputType(TraceChannelOutputType type) {
         fOutputType = type;
     }
 
@@ -297,7 +303,7 @@ public class ChannelInfo extends TraceInfo implements IChannelInfo {
         output.append(",ReadTimer=");
         output.append(fReadTimer);
         output.append(",output=");
-        output.append(fOutputType);
+        output.append(fOutputType.getInName());
         if ((fBufferType != null) && !fBufferType.equals(BufferType.BUFFER_TYPE_UNKNOWN) && !fBufferType.equals(BufferType.BUFFER_SHARED)) {
             output.append(",BufferType=");
             output.append(fBufferType);
index 5f896b76c1cf5fba5b8d1d8f2a84ce23ded6fa54..dcb59bc7f1c219b43d6a3ab40f92952294886631 100644 (file)
@@ -319,7 +319,7 @@ public final class SessionConfigGenerator {
             addElementContent(document, channelElement, SessionConfigStrings.CONFIG_ELEMENT_SWITCH_TIMER_INTERVAL, channel.getSwitchTimer());
             addElementContent(document, channelElement, SessionConfigStrings.CONFIG_ELEMENT_READ_TIMER_INTERVAL, channel.getReadTimer());
 
-            String outputType = channel.getOutputType().startsWith(SessionConfigStrings.CONFIG_OUTPUT_TYPE_MMAP) ?
+            String outputType = channel.getOutputType().getInName().startsWith(SessionConfigStrings.CONFIG_OUTPUT_TYPE_MMAP) ?
                     outputType = SessionConfigStrings.CONFIG_OUTPUT_TYPE_MMAP : SessionConfigStrings.CONFIG_OUTPUT_TYPE_SPLICE;
             addElementContent(document, channelElement, SessionConfigStrings.CONFIG_ELEMENT_OUTPUT_TYPE, outputType);
             addElementContent(document, channelElement, SessionConfigStrings.CONFIG_ELEMENT_TRACEFILE_SIZE, channel.getMaxSizeTraceFiles());
index 31f76f7b23e9b18c95db4d5642e4a90adec8d183..2a77d8c477e3e54e87407964548c0a3629de7224 100644 (file)
@@ -27,6 +27,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.DestroyConfi
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -199,7 +200,8 @@ public class TraceControlKernelProviderTests {
         TraceChannelComponent channel = (TraceChannelComponent) channels[0];
         assertEquals("channel0", channel.getName());
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
index 7f1d4332d20b98e69192016f701f06b0cec308eb..3ae9a827301052d102ee62533729de3a02c0a80b 100644 (file)
@@ -34,6 +34,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableEvents
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -190,7 +191,8 @@ public class TraceControlKernelSessionTests {
         TraceChannelComponent channel = (TraceChannelComponent) channels[0];
         assertEquals("mychannel", channel.getName());
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
         assertEquals(true, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
@@ -225,7 +227,8 @@ public class TraceControlKernelSessionTests {
         channel = (TraceChannelComponent) channels[1];
         assertEquals("mychannel2", channel.getName());
         assertEquals(2, channel.getNumberOfSubBuffers());
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
index ac0b8108331e8795b08074f31a5fd205301e34f8..e9321078452c8754023f67cc63dd4e2e209650aa 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.core.runtime.Path;
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -294,7 +295,8 @@ public class TraceControlTreeModelTest {
         TraceChannelComponent channel = (TraceChannelComponent) channels[0];
         assertEquals("channel0", channel.getName());
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
@@ -358,7 +360,8 @@ public class TraceControlTreeModelTest {
         assertEquals("channel1", channels[1].getName());
         channel = (TraceChannelComponent) channels[1];
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
         assertEquals(true, channel.isOverwriteMode());
         assertEquals(400, channel.getReadTimer());
         assertEquals(TraceEnablement.DISABLED, channel.getState());
@@ -388,7 +391,8 @@ public class TraceControlTreeModelTest {
         channel = (TraceChannelComponent) ustChannels[0];
         assertEquals("mychannel1", channel.getName());
         assertEquals(8, channel.getNumberOfSubBuffers());
-        assertEquals("mmap()", channel.getOutputType());
+        assertEquals("mmap()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
         assertEquals(true, channel.isOverwriteMode());
         assertEquals(100, channel.getReadTimer());
         assertEquals(TraceEnablement.DISABLED, channel.getState());
@@ -410,7 +414,8 @@ public class TraceControlTreeModelTest {
         channel = (TraceChannelComponent) ustChannels[1];
         assertEquals("channel0", channel.getName());
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("mmap()", channel.getOutputType());
+        assertEquals("mmap()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
@@ -623,7 +628,7 @@ public class TraceControlTreeModelTest {
         // save original values
         String name = channel.getName();
         int nbSubBuffers = channel.getNumberOfSubBuffers();
-        String type = channel.getOutputType();
+        TraceChannelOutputType type = channel.getOutputType();
         boolean mode = channel.isOverwriteMode();
         long readTimer = channel.getReadTimer();
         TraceEnablement state =  channel.getState();
@@ -638,7 +643,8 @@ public class TraceControlTreeModelTest {
         assertEquals(2, channel.getNumberOfSubBuffers());
 
         channel.setOutputType("splice()");
-        assertEquals("splice()", channel.getOutputType());
+        assertEquals("splice()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.SPLICE, channel.getOutputType());
 
         channel.setOverwriteMode(false);
         assertEquals(false, channel.isOverwriteMode());
index 58b91d31144d87bf15f3ab905ddd3ff38feeecea..8d7b0666e99b71460a1c79d725895297886f4aa1 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.EnableChanne
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfoDialogStub;
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -202,7 +203,8 @@ public class TraceControlUstProviderTests {
         TraceChannelComponent channel = (TraceChannelComponent) channels[0];
         assertEquals("mychannel", channel.getName());
         assertEquals(2, channel.getNumberOfSubBuffers());
-        assertEquals("mmap()", channel.getOutputType());
+        assertEquals("mmap()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(100, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
index 760f2cc6238da5c144364bcd9884e656af067dc9..5fa6c7e54a4a7cf2adec7fd1d12da5e237ff6f2a 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.stubs.dialogs.GetEventInfo
 import org.eclipse.linuxtools.internal.lttng2.control.stubs.service.TestRemoteSystemProxy;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -185,7 +186,8 @@ public class TraceControlUstSessionTests {
         TraceChannelComponent channel = (TraceChannelComponent) channels[0];
         assertEquals("mychannel", channel.getName());
         assertEquals(4, channel.getNumberOfSubBuffers());
-        assertEquals("mmap()", channel.getOutputType());
+        assertEquals("mmap()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
         assertEquals(true, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
@@ -220,7 +222,8 @@ public class TraceControlUstSessionTests {
         channel = (TraceChannelComponent) channels[1];
         assertEquals("mychannel2", channel.getName());
         assertEquals(2, channel.getNumberOfSubBuffers());
-        assertEquals("mmap()", channel.getOutputType());
+        assertEquals("mmap()", channel.getOutputType().getInName());
+        assertEquals(TraceChannelOutputType.MMAP, channel.getOutputType());
         assertEquals(false, channel.isOverwriteMode());
         assertEquals(200, channel.getReadTimer());
         assertEquals(TraceEnablement.ENABLED, channel.getState());
index 96a1e0dd8bba943fc83dfd5d6318021bdd9d1114..3052baeab232d898cf82807425643e56bb980acd 100644 (file)
@@ -41,6 +41,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISessionInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.ISnapshotInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IUstProviderInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEventType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
@@ -306,7 +307,8 @@ public class LTTngControlServiceTest {
             // Verify Kernel's channel0
             assertEquals("channel0", channels[0].getName());
             assertEquals(4, channels[0].getNumberOfSubBuffers());
-            assertEquals("splice()", channels[0].getOutputType());
+            assertEquals("splice()", channels[0].getOutputType().getInName());
+            assertEquals(TraceChannelOutputType.SPLICE, channels[0].getOutputType());
             assertEquals(false, channels[0].isOverwriteMode());
             assertEquals(200, channels[0].getReadTimer());
             assertEquals(TraceEnablement.ENABLED, channels[0].getState());
@@ -330,7 +332,8 @@ public class LTTngControlServiceTest {
             // Verify Kernel's channel1
             assertEquals("channel1", channels[1].getName());
             assertEquals(4, channels[1].getNumberOfSubBuffers());
-            assertEquals("splice()", channels[1].getOutputType());
+            assertEquals("splice()", channels[1].getOutputType().getInName());
+            assertEquals(TraceChannelOutputType.SPLICE, channels[1].getOutputType());
             assertEquals(true, channels[1].isOverwriteMode());
             assertEquals(400, channels[1].getReadTimer());
             assertEquals(TraceEnablement.DISABLED, channels[1].getState());
@@ -349,7 +352,8 @@ public class LTTngControlServiceTest {
             // Verify UST global's mychannel1
             assertEquals("mychannel1", ustChannels[0].getName());
             assertEquals(8, ustChannels[0].getNumberOfSubBuffers());
-            assertEquals("mmap()", ustChannels[0].getOutputType());
+            assertEquals("mmap()", ustChannels[0].getOutputType().getInName());
+            assertEquals(TraceChannelOutputType.MMAP, ustChannels[0].getOutputType());
             assertEquals(true, ustChannels[0].isOverwriteMode());
             assertEquals(100, ustChannels[0].getReadTimer());
             assertEquals(TraceEnablement.DISABLED, ustChannels[0].getState());
@@ -363,7 +367,8 @@ public class LTTngControlServiceTest {
             // Verify UST global's channel0
             assertEquals("channel0", ustChannels[1].getName());
             assertEquals(4, ustChannels[1].getNumberOfSubBuffers());
-            assertEquals("mmap()", ustChannels[1].getOutputType());
+            assertEquals("mmap()", ustChannels[1].getOutputType().getInName());
+            assertEquals(TraceChannelOutputType.MMAP, ustChannels[1].getOutputType());
             assertEquals(false, ustChannels[1].isOverwriteMode());
             assertEquals(200, ustChannels[1].getReadTimer());
             assertEquals(TraceEnablement.ENABLED, ustChannels[1].getState());
index 8ad26cf5cd0d117dc84643f3571af3063dcac9fa..7316a456de1a97f8810ccc3c1b0b4929444cdd58 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IChannelInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.IEventInfo;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.LogLevelType;
+import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceChannelOutputType;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceEnablement;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.TraceLogLevel;
 import org.eclipse.linuxtools.internal.lttng2.control.core.model.impl.ChannelInfo;
@@ -190,9 +191,16 @@ public class TraceChannelComponent extends TraceControlComponent {
     /**
      * @return the output type.
      */
-    public String getOutputType() {
+    public TraceChannelOutputType getOutputType() {
         return fChannelInfo.getOutputType();
     }
+    /**
+     * Sets the output type to the given value.
+     * @param type - type to set.
+     */
+    public void setOutputType(TraceChannelOutputType type) {
+        fChannelInfo.setOutputType(type);
+    }
     /**
      * Sets the output type to the given value.
      * @param type - type to set.
@@ -200,6 +208,7 @@ public class TraceChannelComponent extends TraceControlComponent {
     public void setOutputType(String type) {
         fChannelInfo.setOutputType(type);
     }
+
     /**
      * @return the channel state (enabled or disabled).
      */
index d5e640c097943b2a0cae9a6cd320954fd93fbb93..790a6dd01e162ee9af5dc454c0fc29c4a12b7998 100644 (file)
@@ -153,7 +153,7 @@ public class TraceChannelPropertySource extends BasePropertySource {
             return String.valueOf(fChannel.getReadTimer());
         }
         if(TRACE_CHANNEL_OUTPUT_TYPE_PROPERTY_ID.equals(id)) {
-            return fChannel.getOutputType();
+            return fChannel.getOutputType().getInName();
         }
         return null;
     }
This page took 0.035557 seconds and 5 git commands to generate.