1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.state
.experiment
;
14 import org
.eclipse
.linuxtools
.lttng
.LttngConstants
;
15 import org
.eclipse
.linuxtools
.lttng
.LttngTestPreparation
;
16 import org
.eclipse
.linuxtools
.lttng
.event
.LttngEvent
;
17 import org
.eclipse
.linuxtools
.lttng
.model
.LTTngTreeNode
;
18 import org
.eclipse
.linuxtools
.lttng
.state
.trace
.StateTraceManager
;
19 import org
.eclipse
.linuxtools
.tmf
.experiment
.TmfExperiment
;
25 @SuppressWarnings("nls")
26 public class StateExperimentManagerTextTest
extends LttngTestPreparation
{
29 * Test method for {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)}.
31 // public void testExperimentSelected_text() {
32 // // make sure a TmfExperiment instance is registered as provider and
33 // // selected as current
34 // TmfExperiment<LttngEvent> experiment = prepareTextExperimentToTest();
36 // // Create a new Experiment manager
37 // IStateExperimentManager expManager = StateManagerFactory
38 // .getExperimentManager();
39 // expManager.waitForCompletion(true);
40 // // Configure the interval to create check points so this can be tested
41 // // with medium size files i.e. default is 50000 events
42 // StateManagerFactory.setTraceCheckPointInterval(1000L);
45 // expManager.experimentSelected_prep(experiment);
47 // expManager.experimentSelected(this, experiment);
49 // // Access context tree for Validation
50 // // access to the context tree
51 // LTTngTreeNode experimentNode = expManager.getSelectedExperiment();
52 // StateTraceManager traceManager = (StateTraceManager) experimentNode
56 // int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length;
57 // assertEquals("Total number of processes created", 276, numProcesses);
63 * {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)}
66 public void testExperimentSelected_real() {
67 // Create a new Experiment manager context
68 IStateExperimentManager expManager
= prepareExperimentContext(true);
69 expManager
.waitForCompletion(true);
71 // make sure a TmfExperiment instance is registered as provider and
72 // selected as current
73 TmfExperiment
<LttngEvent
> experiment
= prepareExperimentToTest();
76 expManager
.experimentSelected_prep(experiment
);
78 expManager
.experimentSelected(this, experiment
);
80 // Access context tree for Validation
81 // access to the context tree
82 LTTngTreeNode experimentNode
= expManager
.getSelectedExperiment();
83 StateTraceManager traceManager
= (StateTraceManager
) experimentNode
84 .getChildById(1L | LttngConstants
.STATS_TRACE_NAME_ID
);
87 int numProcesses
= traceManager
.getCheckPointStateModel().getProcesses().length
;
88 assertEquals("Total number of processes created", 276, numProcesses
);