aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2013-03-12 16:21:00 (EDT)
committerMatthew Khouzam2013-03-15 16:42:00 (EDT)
commitef03ffda4cfca9a3d9eeea1a990c32ae6bd7e109 (patch)
treed2b3d922d5400a0ec872ad21caf5c76ee32cc399
parenta91c3901a0a35f7233cd11ad74e4596ce0f4b7a9 (diff)
downloadorg.eclipse.linuxtools-ef03ffda4cfca9a3d9eeea1a990c32ae6bd7e109.zip
org.eclipse.linuxtools-ef03ffda4cfca9a3d9eeea1a990c32ae6bd7e109.tar.gz
org.eclipse.linuxtools-ef03ffda4cfca9a3d9eeea1a990c32ae6bd7e109.tar.bz2
tmf: keep event fields ordering as per ctf metadatarefs/changes/90/11090/4
* While there, change the HashMap type of the fields to interface type map * Change unit tests with new field ordering Change-Id: I4fb1fec8b922f01e62573c415ca6f23826ec072a Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/11090 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> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/StructDefinitionTest.java4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/EventDefinition.java6
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/StructDefinition.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java4
5 files changed, 13 insertions, 11 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/StructDefinitionTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/StructDefinitionTest.java
index 0e58b46..6d3813e 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/StructDefinitionTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/StructDefinitionTest.java
@@ -17,7 +17,7 @@ import static org.junit.Assert.assertNull;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.HashMap;
+import java.util.Map;
import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
@@ -148,7 +148,7 @@ public class StructDefinitionTest {
*/
@Test
public void testGetDefinitions_1() {
- HashMap<String, Definition> result = fixture.getDefinitions();
+ Map<String, Definition> result = fixture.getDefinitions();
assertNotNull(result);
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/EventDefinition.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/EventDefinition.java
index f4df158..6008a48 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/EventDefinition.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/EventDefinition.java
@@ -12,8 +12,8 @@
package org.eclipse.linuxtools.ctf.core.event;
-import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.linuxtools.ctf.core.event.types.Definition;
@@ -136,7 +136,7 @@ public class EventDefinition implements IDefinitionScope {
StructDeclaration mergedDeclaration = new StructDeclaration(1);
/* Add fields from the stream */
- HashMap<String, Definition> defs = streamContext.getDefinitions();
+ Map<String, Definition> defs = streamContext.getDefinitions();
for (Entry<String, Definition> entry : defs.entrySet()) {
mergedDeclaration.addField(entry.getKey(), entry.getValue().getDeclaration());
}
@@ -239,7 +239,7 @@ public class EventDefinition implements IDefinitionScope {
@Override
public String toString() {
- HashMap<String, Definition> definitions;
+ Map<String, Definition> definitions;
List<String> list;
StringBuilder retString = new StringBuilder();
final String cr = System.getProperty("line.separator");//$NON-NLS-1$
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/StructDefinition.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/StructDefinition.java
index cf2c7d8..b760349 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/StructDefinition.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/StructDefinition.java
@@ -12,9 +12,10 @@
package org.eclipse.linuxtools.ctf.core.event.types;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
+import java.util.Map;
import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
@@ -36,7 +37,7 @@ public class StructDefinition extends Definition implements IDefinitionScope {
// ------------------------------------------------------------------------
private final StructDeclaration declaration;
- private final HashMap<String, Definition> definitions = new HashMap<String, Definition>();
+ private final Map<String, Definition> definitions = new LinkedHashMap<String, Definition>();
// ------------------------------------------------------------------------
// Constructors
@@ -78,8 +79,9 @@ public class StructDefinition extends Definition implements IDefinitionScope {
/**
* @return The definitions of all the fields
+ * @since 2.0
*/
- public HashMap<String, Definition> getDefinitions() {
+ public Map<String, Definition> getDefinitions() {
return definitions;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
index 1e55fed..9a11af0 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/ctfadaptor/CtfTmfEventTest.java
@@ -179,7 +179,7 @@ public class CtfTmfEventTest {
@Test
public void testToString() {
String s = fixture.getContent().toString();
- assertEquals("pid=1922, inode=917738, flags=0x8000075, end=0xb73ec000, start=0xb73ea000, pgoff=0", s); //$NON-NLS-1$
+ assertEquals("pid=1922, start=0xb73ea000, end=0xb73ec000, flags=0x8000075, inode=917738, pgoff=0", s); //$NON-NLS-1$
}
/**
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
index 95a4e06..b2974d2 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventFactory.java
@@ -13,9 +13,9 @@
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
@@ -103,7 +103,7 @@ public final class CtfTmfEventFactory {
List<CtfTmfEventField> fields = new ArrayList<CtfTmfEventField>();
StructDefinition structFields = eventDef.getFields();
- HashMap<String, Definition> definitions = structFields.getDefinitions();
+ Map<String, Definition> definitions = structFields.getDefinitions();
String curFieldName = null;
Definition curFieldDef;
CtfTmfEventField curField;