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));
}
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();
}
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));
}
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));
}
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));
}
Aggregations