XmlUtilsTest.verifyStateIntervals("testMappingGroups", ss, quark, expectedStarts, expectedValues);
}
+
+ /**
+ * Test using the HostID event field. It should give the host ID for value
+ *
+ * @throws StateSystemDisposedException
+ * Exceptions thrown during state system verification
+ * @throws AttributeNotFoundException
+ * Exceptions thrown during state system verification
+ */
+ @Test
+ public void testStateValueHostId() throws AttributeNotFoundException, StateSystemDisposedException {
+ XmlStateSystemModule module = fModule;
+ assertNotNull(module);
+
+ ITmfStateSystem ss = module.getStateSystem();
+ assertNotNull(ss);
+
+ int quark = ss.getQuarkAbsolute("hostID");
+
+ final int[] expectedStarts = { 1, 7 };
+ ITmfStateValue[] expectedValues = { TmfStateValue.newValueString("testTrace4.xml") };
+ XmlUtilsTest.verifyStateIntervals("testHostId", ss, quark, expectedStarts, expectedValues);
+
+ }
}
<stateAttribute type="eventField" value="cpu" />
<stateValue type="string" value="UNKNOWN" />
</stateChange>
+ <stateChange>
+ <stateAttribute type="constant" value="hostID" />
+ <stateValue type="eventField" value="hostID" />
+ </stateChange>
<stateChange>
<stateAttribute type="constant" value="stack"/>
<stateValue stack="push" type="eventField" value="timestamp" />
return getQuarkRelativeAndAdd(startQuark, cpu.toString());
}
return IXmlStateSystemContainer.ERROR_QUARK;
+ } else if (name.equalsIgnoreCase(TmfXmlStrings.HOSTID)) {
+ /* Return the host ID of the trace containing the event */
+ return getQuarkRelativeAndAdd(startQuark, event.getTrace().getHostId());
}
/* Search between the trace event aspects */
fieldValue = TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), name, event);
* event
*/
return TmfStateValue.newValueLong(event.getTimestamp().getValue());
+ } else if (fieldName.equalsIgnoreCase(TmfXmlStrings.HOSTID)) {
+ /* Return the host ID of the trace containing the event */
+ return TmfStateValue.newValueString(event.getTrace().getHostId());
}
// This will allow to use any column as input
fieldValue = TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), fieldName, event);
String STACK_PUSH = "push";
String STACK_PEEK = "peek";
String CPU = "cpu";
+ String HOSTID = "hostId";
String TIMESTAMP = "timestamp";