use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider in project tracecompass by tracecompass.
the class CounterStateProviderTest method testGetNewInstance.
/**
* Test the cloning of a <code>CounterStateProvider</code> object.
*/
@Test
public void testGetNewInstance() {
ITmfStateProvider clone = fStateProvider.getNewInstance();
assertNotSame("The original CounterStateProvider and its clone do not share the same reference.", fStateProvider, clone);
assertEquals(fStateProvider.getVersion(), clone.getVersion());
assertEquals(fStateProvider.getTrace(), clone.getTrace());
}
use of org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider in project tracecompass by tracecompass.
the class StateSystemAnalysisModuleTest method testFaultyStateProvider.
/**
* Test the behavior of a state provider that causes a runtime exception at
* different moments of the analysis. The analyses should be marked as
* failed
*
* @throws TmfAnalysisException
* An exception when setting the trace
*/
@Test
public void testFaultyStateProvider() throws TmfAnalysisException {
ITmfTrace trace = fTrace;
assertNotNull(trace);
// Test failure on the last event
TmfStateSystemAnalysisModule module = new TestStateSystemModule() {
@Override
@NonNull
protected ITmfStateProvider createStateProvider() {
return new BreakingTest(trace, 7, "Expected exception: should be caught by the analysis itself");
}
};
try {
module.setTrace(trace);
module.schedule();
assertFalse(module.waitForCompletion());
} finally {
module.dispose();
}
// Test failure when the analysis the request finishes before the queue
// is full
module = new TestStateSystemModule() {
@Override
@NonNull
protected ITmfStateProvider createStateProvider() {
return new BreakingTest(trace, 5, "Expected exception: should be caught by either the analysis or the event request");
}
};
try {
module.setTrace(trace);
module.schedule();
assertFalse(module.waitForCompletion());
} finally {
module.dispose();
}
// Test failure when the queue should be full
module = new TestStateSystemModule() {
@Override
@NonNull
protected ITmfStateProvider createStateProvider() {
return new BreakingTest(trace, 1, "Expected exception: should be caught by the event request thread");
}
};
try {
module.setTrace(trace);
module.schedule();
assertFalse(module.waitForCompletion());
} finally {
module.dispose();
}
}
Aggregations