use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class TmfTraceManagerTest method testTraceSetNestedExperiment.
/**
* Test the contents of a trace set with a nested experiment.
*/
@Test
public void testTraceSetNestedExperiment() {
final ITmfTrace localTrace1 = trace1;
final ITmfTrace localTrace2 = trace2;
final ITmfTrace localTrace3 = trace3;
assertNotNull(localTrace1);
assertNotNull(localTrace2);
assertNotNull(localTrace3);
TmfExperiment nestedExp = createExperiment(localTrace2, localTrace3);
TmfExperiment exp = createExperiment(localTrace1, nestedExp);
Collection<ITmfTrace> expected = ImmutableSet.of(localTrace1, localTrace2, localTrace3);
Collection<ITmfTrace> actual = TmfTraceManager.getTraceSet(exp);
assertEquals(expected, actual);
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class CtfExperimentCheckpointIndexTest method setUpTraces.
private static void setUpTraces() {
fTestTraces = new ITmfTrace[2];
fTestTraces[0] = CtfTmfTestTraceUtils.getTrace(TEST_TRACE1);
fTestTraces[1] = CtfTmfTestTraceUtils.getTrace(TEST_TRACE2);
fExperiment = new TmfExperiment(ITmfEvent.class, EXPERIMENT, fTestTraces, BLOCK_SIZE, null) {
@Override
protected ITmfTraceIndexer createIndexer(int interval) {
fIndexer = new TestIndexer(this, interval);
return fIndexer;
}
};
fExperiment.indexTrace(true);
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class CtfTmfExperimentTrimmingTest method setup.
/**
* Test setup
*/
@Before
public void setup() {
WaitUtils.waitForJobs();
SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click();
SWTBotUtils.activateEditor(fBot, "Experiment");
SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME);
SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment");
experimentItem.select();
TmfTraceManager traceManager = TmfTraceManager.getInstance();
ITmfTrace trace = traceManager.getActiveTrace();
assertTrue(String.valueOf(trace), trace instanceof TmfExperiment);
TmfExperiment experiment = (TmfExperiment) trace;
assertNotNull(experiment);
ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true);
assertTrue(elem instanceof TmfExperimentElement);
fOriginalExperiment = experiment;
TmfTimeRange traceCutRange = getTraceCutRange(experiment);
assertNotNull(traceCutRange);
fRequestedTraceCutRange = traceCutRange;
ITmfTimestamp requestedTraceCutEnd = traceCutRange.getEndTime();
ITmfTimestamp requestedTraceCutStart = traceCutRange.getStartTime();
assertTrue(experiment.getTimeRange().contains(traceCutRange));
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, requestedTraceCutStart, requestedTraceCutEnd, experiment));
experimentItem.contextMenu("Export Time Selection as New Trace...").click();
SWTBotShell shell = fBot.shell("Export trace section to...").activate();
SWTBot dialogBot = shell.bot();
assertEquals("Experiment", dialogBot.text().getText());
dialogBot.text().setText("Experiment-trimmed");
dialogBot.button("OK").click();
SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed");
newExperiment.setFocus();
fNewExperiment = traceManager.getActiveTrace();
assertNotNull("No active trace", fNewExperiment);
assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName());
WaitUtils.waitForJobs();
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class AnalysisModuleHelperTest method testAppliesToExperiment.
/**
* Test the analysis modules with a differing result for experiments
*/
@Test
public void testAppliesToExperiment() {
ITmfTrace trace1 = TmfTestTrace.A_TEST_10K.getTrace();
ITmfTrace trace2 = TmfTestTrace.A_TEST_10K2.getTrace();
ITmfTrace trace3 = TmfTestTrace.A_TEST_10K2.getTraceAsStub2();
/* Create an experiment with TmfTraceStub */
ITmfTrace[] tracesExp1 = { trace1, trace2 };
TmfExperiment exp1 = new TmfExperiment(tracesExp1[0].getEventType(), "Experiment 1", tracesExp1, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
/* Create an experiment containing some TmfTraceStub2 */
ITmfTrace[] tracesExp2 = { trace1, trace3 };
TmfExperiment exp2 = new TmfExperiment(tracesExp2[0].getEventType(), "Experiment 1", tracesExp2, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
try {
/* fModule should return null for both experiments */
IAnalysisModule module = null;
try {
module = fModule.newModule(exp1);
assertNull(module);
} catch (TmfAnalysisException e) {
fail();
} finally {
if (module != null) {
module.dispose();
}
}
try {
module = fModule.newModule(exp2);
assertNull(module);
} catch (TmfAnalysisException e) {
fail();
} finally {
if (module != null) {
module.dispose();
}
}
/* fModuleOther should throw exception for exp1, but not exp2 */
try {
module = fModuleOther.newModule(exp1);
assertNull(module);
} catch (TmfAnalysisException e) {
fail();
} finally {
if (module != null) {
module.dispose();
}
}
try {
module = fModuleOther.newModule(exp2);
assertNotNull(module);
} catch (TmfAnalysisException e) {
fail();
} finally {
if (module != null) {
module.dispose();
}
}
} finally {
exp2.dispose();
exp1.dispose();
}
}
use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.
the class Uml2SDTestFacility method disposeExperiment.
/**
* Disposes the experiment.
*/
public void disposeExperiment() {
TmfExperiment experiment = fExperiment;
if (experiment == null) {
throw new IllegalStateException();
}
experiment.broadcast(new TmfTraceClosedSignal(this, experiment));
experiment.dispose();
delay(IUml2SDTestConstants.GUI_REFESH_DELAY);
}
Aggregations