Commit | Line | Data |
---|---|---|
03c71d1e ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2010 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
11 | *******************************************************************************/ | |
29465de6 | 12 | package org.eclipse.linuxtools.lttng.tests.state.experiment; |
03c71d1e | 13 | |
b12f4544 | 14 | import org.eclipse.linuxtools.lttng.LttngConstants; |
03c71d1e ASL |
15 | import org.eclipse.linuxtools.lttng.event.LttngEvent; |
16 | import org.eclipse.linuxtools.lttng.model.LTTngTreeNode; | |
29465de6 | 17 | import org.eclipse.linuxtools.lttng.state.experiment.IStateExperimentManager; |
03c71d1e | 18 | import org.eclipse.linuxtools.lttng.state.trace.StateTraceManager; |
29465de6 | 19 | import org.eclipse.linuxtools.lttng.tests.LttngTestPreparation; |
03c71d1e ASL |
20 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; |
21 | ||
22 | /** | |
23 | * @author alvaro | |
24 | * | |
25 | */ | |
3b38ea61 | 26 | @SuppressWarnings("nls") |
03c71d1e ASL |
27 | public class StateExperimentManagerTextTest extends LttngTestPreparation { |
28 | ||
29 | /** | |
30 | * Test method for {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)}. | |
31 | */ | |
9b635e61 FC |
32 | // public void testExperimentSelected_text() { |
33 | // // make sure a TmfExperiment instance is registered as provider and | |
34 | // // selected as current | |
35 | // TmfExperiment<LttngEvent> experiment = prepareTextExperimentToTest(); | |
36 | // | |
37 | // // Create a new Experiment manager | |
38 | // IStateExperimentManager expManager = StateManagerFactory | |
39 | // .getExperimentManager(); | |
40 | // expManager.waitForCompletion(true); | |
41 | // // Configure the interval to create check points so this can be tested | |
42 | // // with medium size files i.e. default is 50000 events | |
43 | // StateManagerFactory.setTraceCheckPointInterval(1000L); | |
44 | // | |
45 | // // preparation | |
46 | // expManager.experimentSelected_prep(experiment); | |
47 | // // Action trigger | |
48 | // expManager.experimentSelected(this, experiment); | |
49 | // | |
50 | // // Access context tree for Validation | |
51 | // // access to the context tree | |
52 | // LTTngTreeNode experimentNode = expManager.getSelectedExperiment(); | |
53 | // StateTraceManager traceManager = (StateTraceManager) experimentNode | |
54 | // .getChildById(0L); | |
55 | // | |
56 | // // validate | |
57 | // int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length; | |
58 | // assertEquals("Total number of processes created", 276, numProcesses); | |
59 | // | |
60 | // } | |
03c71d1e ASL |
61 | |
62 | /** | |
63 | * Test method for | |
64 | * {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)} | |
65 | * . | |
66 | */ | |
67 | public void testExperimentSelected_real() { | |
68 | // Create a new Experiment manager context | |
69 | IStateExperimentManager expManager = prepareExperimentContext(true); | |
70 | expManager.waitForCompletion(true); | |
71 | ||
72 | // make sure a TmfExperiment instance is registered as provider and | |
73 | // selected as current | |
74 | TmfExperiment<LttngEvent> experiment = prepareExperimentToTest(); | |
75 | ||
76 | // preparation | |
77 | expManager.experimentSelected_prep(experiment); | |
78 | // Action trigger | |
79 | expManager.experimentSelected(this, experiment); | |
80 | ||
81 | // Access context tree for Validation | |
82 | // access to the context tree | |
83 | LTTngTreeNode experimentNode = expManager.getSelectedExperiment(); | |
84 | StateTraceManager traceManager = (StateTraceManager) experimentNode | |
b12f4544 | 85 | .getChildById(1L | LttngConstants.STATS_TRACE_NAME_ID); |
03c71d1e ASL |
86 | |
87 | // validate | |
550d787e | 88 | int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length; |
03c71d1e ASL |
89 | assertEquals("Total number of processes created", 276, numProcesses); |
90 | ||
91 | } | |
92 | ||
93 | } |