Search in sources :

Example 11 with DataDrivenAnalysisModule

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;
}
Also used : TmfXmlPatternCu(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlPatternCu) TmfXmlStateProviderCu(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlStateProviderCu) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) XmlPatternAnalysis(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis) DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 12 with DataDrivenAnalysisModule

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);
}
Also used : DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) ITmfStateValue(org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test) XmlUtilsTest(org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)

Example 13 with DataDrivenAnalysisModule

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);
}
Also used : DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) ITmfStateValue(org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test) XmlUtilsTest(org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)

Example 14 with DataDrivenAnalysisModule

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);
}
Also used : DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) ITmfStateValue(org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test) XmlUtilsTest(org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)

Example 15 with DataDrivenAnalysisModule

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();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) After(org.junit.After)

Aggregations

DataDrivenAnalysisModule (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule)19 Test (org.junit.Test)12 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)10 XmlUtilsTest (org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)10 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)8 ITmfStateValue (org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue)7 TmfXmlStateProviderCu (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlStateProviderCu)5 Element (org.w3c.dom.Element)5 TmfXmlPatternCu (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlPatternCu)4 XmlPatternAnalysis (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis)4 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)3 TmfTimeGraphCompositeDataProvider (org.eclipse.tracecompass.internal.tmf.core.model.timegraph.TmfTimeGraphCompositeDataProvider)2 AttributeNotFoundException (org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException)2 StateSystemDisposedException (org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException)2 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)2 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)2 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)2 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)2 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)2 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)2