Search in sources :

Example 1 with TmfAnalysisEventRequirement

use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement in project tracecompass by tracecompass.

the class AnalysisEventRequirementTest method testAtLeastOneRequirements.

/**
 * Test with {@link PriorityLevel#AT_LEAST_ONE} requirements
 */
@Test
public void testAtLeastOneRequirements() {
    /* Test mandatory requirement */
    TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1), PriorityLevel.AT_LEAST_ONE);
    assertTrue(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.AT_LEAST_ONE);
    assertTrue(req.test(fTrace));
    /* Event 3 is not an event of the trace */
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2, EVENT3), PriorityLevel.AT_LEAST_ONE);
    assertTrue(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT3), PriorityLevel.AT_LEAST_ONE);
    assertFalse(req.test(fTrace));
}
Also used : TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) Test(org.junit.Test)

Example 2 with TmfAnalysisEventRequirement

use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement in project tracecompass by tracecompass.

the class AnalysisEventRequirementTest method testNoPreDefinedEvents.

/**
 * Test event requirements on a trace with no pre-defined events. They
 * should all pass
 */
@Test
public void testNoPreDefinedEvents() {
    /* A simple trace with no pre-defined events */
    TmfTrace traceNoEvents = new TmfTraceStub();
    TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT3), PriorityLevel.MANDATORY);
    assertTrue(req.test(traceNoEvents));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.OPTIONAL);
    assertTrue(req.test(traceNoEvents));
    traceNoEvents.dispose();
}
Also used : TmfTrace(org.eclipse.tracecompass.tmf.core.trace.TmfTrace) TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) Test(org.junit.Test)

Example 3 with TmfAnalysisEventRequirement

use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement in project tracecompass by tracecompass.

the class AnalysisEventRequirementTest method testMandatoryRequirements.

/**
 * Test with mandatory requirements
 */
@Test
public void testMandatoryRequirements() {
    /* Test mandatory requirement */
    TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1), PriorityLevel.MANDATORY);
    assertTrue(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.MANDATORY);
    assertTrue(req.test(fTrace));
    /* Event 3 is not an event of the trace */
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2, EVENT3), PriorityLevel.MANDATORY);
    assertFalse(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT3), PriorityLevel.MANDATORY);
    assertFalse(req.test(fTrace));
}
Also used : TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) Test(org.junit.Test)

Example 4 with TmfAnalysisEventRequirement

use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement in project tracecompass by tracecompass.

the class AnalysisEventRequirementTest method testOptionalRequirements.

/**
 * Test with optional requirements
 */
@Test
public void testOptionalRequirements() {
    /* Test optional requirement */
    TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1));
    assertTrue(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT3));
    assertTrue(req.test(fTrace));
    /* FIXME: if no optional requirement is fulfilled it should fail */
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT3));
    assertTrue(req.test(fTrace));
}
Also used : TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) Test(org.junit.Test)

Example 5 with TmfAnalysisEventRequirement

use of org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement in project tracecompass by tracecompass.

the class AnalysisEventRequirementTest method testAllOrNothingRequirements.

/**
 * Test with {@link PriorityLevel#ALL_OR_NOTHING} requirements
 */
@Test
public void testAllOrNothingRequirements() {
    /* Test mandatory requirement */
    TmfAbstractAnalysisRequirement req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1), PriorityLevel.ALL_OR_NOTHING);
    assertTrue(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2), PriorityLevel.ALL_OR_NOTHING);
    assertTrue(req.test(fTrace));
    /* Event 3 is not an event of the trace */
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT1, EVENT2, EVENT3), PriorityLevel.ALL_OR_NOTHING);
    assertFalse(req.test(fTrace));
    req = new TmfAnalysisEventRequirement(ImmutableSet.of(EVENT3), PriorityLevel.ALL_OR_NOTHING);
    assertTrue(req.test(fTrace));
}
Also used : TmfAbstractAnalysisRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement) TmfAnalysisEventRequirement(org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement) Test(org.junit.Test)

Aggregations

TmfAbstractAnalysisRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement)6 TmfAnalysisEventRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement)6 Test (org.junit.Test)5 NonNull (org.eclipse.jdt.annotation.NonNull)1 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)1 LttngUstTrace (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)1 ILttngUstEventLayout (org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)1 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)1