use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule in project tracecompass by tracecompass.
the class TmfAnalysisModuleHelperXml method newModule.
@Override
@Nullable
public final IAnalysisModule newModule(ITmfTrace trace) throws TmfAnalysisException {
String analysisid = getId();
IAnalysisModule module = null;
switch(fType) {
case STATE_SYSTEM:
TmfXmlStateProviderCu compile = TmfXmlStateProviderCu.compile(fSourceFile.toPath(), analysisid);
if (compile == null) {
return null;
}
module = new DataDrivenAnalysisModule(analysisid, compile);
module.setName(getName());
break;
case PATTERN:
TmfXmlPatternCu patternCu = TmfXmlPatternCu.compile(fSourceFile.toPath(), analysisid);
if (patternCu == null) {
return null;
}
module = new XmlPatternAnalysis(analysisid, patternCu);
module.setName(getName());
XmlPatternAnalysis paModule = (XmlPatternAnalysis) module;
paModule.setViewLabelPrefix(getViewLabelPrefix());
break;
case OTHER:
String name = getName();
module = createOtherModule(analysisid, name);
break;
default:
break;
}
if (module != null) {
if (module.setTrace(trace)) {
TmfAnalysisManager.analysisModuleCreated(module);
} else {
/*
* The analysis does not apply to the trace, dispose of the
* module
*/
module.dispose();
module = null;
}
}
return module;
}
use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule in project tracecompass by tracecompass.
the class TmfStateValueTest method testStateValueScript.
/**
* Test that a script state value is returning the right value.
*
* @throws StateSystemDisposedException
* Exceptions thrown during state system verification
* @throws AttributeNotFoundException
* Exceptions thrown during state system verification
*/
@Test
public void testStateValueScript() throws AttributeNotFoundException, StateSystemDisposedException {
DataDrivenAnalysisModule module = fModule;
assertNotNull(module);
ITmfStateSystem ss = module.getStateSystem();
assertNotNull(ss);
int quark = ss.getQuarkAbsolute("script");
final int[] expectedStarts = { 1, 3, 5, 7, 10, 20, 20 };
ITmfStateValue[] expectedValues = { TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE"), TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE"), TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE") };
XmlUtilsTest.verifyStateIntervals("testStateValueScript", ss, quark, expectedStarts, expectedValues);
}
use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule in project tracecompass by tracecompass.
the class TmfStateValueTest method testStateValueUpdate.
/**
* Test that the ongoing state is updated instead of creating a new state
*
* @throws StateSystemDisposedException
* Exceptions thrown during state system verification
* @throws AttributeNotFoundException
* Exceptions thrown during state system verification
*/
@Test
public void testStateValueUpdate() throws AttributeNotFoundException, StateSystemDisposedException {
DataDrivenAnalysisModule module = fModule;
assertNotNull(module);
ITmfStateSystem ss = module.getStateSystem();
assertNotNull(ss);
int quark = ss.getQuarkAbsolute("update", "0");
final int[] expectedStarts = { 1, 3, 5, 7, 20 };
ITmfStateValue[] expectedValues = { TmfStateValue.newValueString("GOOD"), TmfStateValue.nullValue(), TmfStateValue.newValueString("BAD"), TmfStateValue.nullValue() };
XmlUtilsTest.verifyStateIntervals("testStateValueUpdate", ss, quark, expectedStarts, expectedValues);
}
use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule in project tracecompass by tracecompass.
the class TmfStateValueTest method testStateValueMapping.
/**
* Test the mapping groups. This test verifies that, when needed, the mapped
* value is used. In this test, the mapping group is used on the 'entry'
* event.
*
* @throws StateSystemDisposedException
* Exceptions thrown during state system verification
* @throws AttributeNotFoundException
* Exceptions thrown during state system verification
*/
@Test
public void testStateValueMapping() throws AttributeNotFoundException, StateSystemDisposedException {
DataDrivenAnalysisModule module = fModule;
assertNotNull(module);
ITmfStateSystem ss = module.getStateSystem();
assertNotNull(ss);
int quark = ss.getQuarkAbsolute("mapped");
final int[] expectedStarts = { 1, 3, 5, 7, 10, 20, 20 };
ITmfStateValue[] expectedValues = { TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE"), TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE"), TmfStateValue.newValueString("TRUE"), TmfStateValue.newValueString("FALSE") };
XmlUtilsTest.verifyStateIntervals("testMappingGroups", ss, quark, expectedStarts, expectedValues);
}
use of org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule in project tracecompass by tracecompass.
the class TmfStateValueTest method cleanUp.
/**
* Dispose the module and the trace
*/
@After
public void cleanUp() {
ITmfTrace trace = fTrace;
if (trace != null) {
trace.dispose();
}
DataDrivenAnalysisModule module = fModule;
if (module != null) {
module.dispose();
}
}
Aggregations