From 0ad9fc89aaa085757a1cced36b6e7d2b23a3b1de Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Julien Date: Fri, 15 Aug 2014 17:37:37 -0400 Subject: [PATCH] tmf: lttngControl: new enum TraceChannelOutputType Change-Id: Ia2e77d9043f1cdbd08a4fdfcf265700b2bba194e Signed-off-by: Jonathan Rajotte Julien Reviewed-on: https://git.eclipse.org/r/31787 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann Reviewed-by: Matthew Khouzam --- .../tests/model/impl/ChannelInfoTest.java | 8 +- .../control/core/model/IChannelInfo.java | 7 +- .../core/model/TraceChannelOutputType.java | 74 +++++++++++++++++++ .../control/core/model/impl/ChannelInfo.java | 14 +++- .../core/session/SessionConfigGenerator.java | 2 +- .../TraceControlKernelProviderTests.java | 4 +- .../TraceControlKernelSessionTests.java | 7 +- .../component/TraceControlTreeModelTest.java | 18 +++-- .../TraceControlUstProviderTests.java | 4 +- .../TraceControlUstSessionTests.java | 7 +- .../service/LTTngControlServiceTest.java | 13 +++- .../model/impl/TraceChannelComponent.java | 11 ++- .../property/TraceChannelPropertySource.java | 2 +- 13 files changed, 144 insertions(+), 27 deletions(-) create mode 100644 org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceChannelOutputType.java diff --git a/org.eclipse.linuxtools.lttng2.control.core.tests/src/org/eclipse/linuxtools/lttng2/control/core/tests/model/impl/ChannelInfoTest.java b/org.eclipse.linuxtools.lttng2.control.core.tests/src/org/eclipse/linuxtools/lttng2/control/core/tests/model/impl/ChannelInfoTest.java index 6dc8b9436e..44a078e012 100644 --- a/org.eclipse.linuxtools.lttng2.control.core.tests/src/org/eclipse/linuxtools/lttng2/control/core/tests/model/impl/ChannelInfoTest.java +++ b/org.eclipse.linuxtools.lttng2.control.core.tests/src/org/eclipse/linuxtools/lttng2/control/core/tests/model/impl/ChannelInfoTest.java @@ -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(); diff --git a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/IChannelInfo.java b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/IChannelInfo.java index 6cf9e118ec..8018ea0458 100644 --- a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/IChannelInfo.java +++ b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/IChannelInfo.java @@ -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 index 0000000000..7e53f81f96 --- /dev/null +++ b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/TraceChannelOutputType.java @@ -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 diff --git a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/impl/ChannelInfo.java b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/impl/ChannelInfo.java index 951b91fa33..6e2f626992 100644 --- a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/impl/ChannelInfo.java +++ b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/internal/lttng2/control/core/model/impl/ChannelInfo.java @@ -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 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); diff --git a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/lttng2/control/core/session/SessionConfigGenerator.java b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/lttng2/control/core/session/SessionConfigGenerator.java index 5f896b76c1..dcb59bc7f1 100644 --- a/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/lttng2/control/core/session/SessionConfigGenerator.java +++ b/org.eclipse.linuxtools.lttng2.control.core/src/org/eclipse/linuxtools/lttng2/control/core/session/SessionConfigGenerator.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java index 31f76f7b23..2a77d8c477 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelProviderTests.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java index 7f1d4332d2..3ae9a82730 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlKernelSessionTests.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java index ac0b810833..e932107845 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlTreeModelTest.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java index 58b91d3114..8d7b0666e9 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstProviderTests.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java index 760f2cc623..5fa6c7e54a 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/model/component/TraceControlUstSessionTests.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/service/LTTngControlServiceTest.java b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/service/LTTngControlServiceTest.java index 96a1e0dd8b..3052baeab2 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/service/LTTngControlServiceTest.java +++ b/org.eclipse.linuxtools.lttng2.control.ui.tests/src/org/eclipse/linuxtools/lttng2/control/ui/tests/service/LTTngControlServiceTest.java @@ -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()); diff --git a/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceChannelComponent.java b/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceChannelComponent.java index 8ad26cf5cd..7316a456de 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceChannelComponent.java +++ b/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/model/impl/TraceChannelComponent.java @@ -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). */ diff --git a/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TraceChannelPropertySource.java b/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TraceChannelPropertySource.java index d5e640c097..790a6dd01e 100644 --- a/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TraceChannelPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/property/TraceChannelPropertySource.java @@ -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; } -- 2.34.1