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 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.state.experiment; | |
13 | ||
b12f4544 | 14 | import org.eclipse.linuxtools.lttng.LttngConstants; |
03c71d1e ASL |
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; | |
20 | ||
21 | /** | |
22 | * @author alvaro | |
23 | * | |
24 | */ | |
3b38ea61 | 25 | @SuppressWarnings("nls") |
03c71d1e ASL |
26 | public class StateExperimentManagerTextTest extends LttngTestPreparation { |
27 | ||
28 | /** | |
29 | * Test method for {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)}. | |
30 | */ | |
9b635e61 FC |
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(); | |
35 | // | |
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); | |
43 | // | |
44 | // // preparation | |
45 | // expManager.experimentSelected_prep(experiment); | |
46 | // // Action trigger | |
47 | // expManager.experimentSelected(this, experiment); | |
48 | // | |
49 | // // Access context tree for Validation | |
50 | // // access to the context tree | |
51 | // LTTngTreeNode experimentNode = expManager.getSelectedExperiment(); | |
52 | // StateTraceManager traceManager = (StateTraceManager) experimentNode | |
53 | // .getChildById(0L); | |
54 | // | |
55 | // // validate | |
56 | // int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length; | |
57 | // assertEquals("Total number of processes created", 276, numProcesses); | |
58 | // | |
59 | // } | |
03c71d1e ASL |
60 | |
61 | /** | |
62 | * Test method for | |
63 | * {@link org.eclipse.linuxtools.lttng.state.experiment.StateExperimentManager#experimentSelected_prep(org.eclipse.linuxtools.tmf.experiment.TmfExperiment)} | |
64 | * . | |
65 | */ | |
66 | public void testExperimentSelected_real() { | |
67 | // Create a new Experiment manager context | |
68 | IStateExperimentManager expManager = prepareExperimentContext(true); | |
69 | expManager.waitForCompletion(true); | |
70 | ||
71 | // make sure a TmfExperiment instance is registered as provider and | |
72 | // selected as current | |
73 | TmfExperiment<LttngEvent> experiment = prepareExperimentToTest(); | |
74 | ||
75 | // preparation | |
76 | expManager.experimentSelected_prep(experiment); | |
77 | // Action trigger | |
78 | expManager.experimentSelected(this, experiment); | |
79 | ||
80 | // Access context tree for Validation | |
81 | // access to the context tree | |
82 | LTTngTreeNode experimentNode = expManager.getSelectedExperiment(); | |
83 | StateTraceManager traceManager = (StateTraceManager) experimentNode | |
b12f4544 | 84 | .getChildById(1L | LttngConstants.STATS_TRACE_NAME_ID); |
03c71d1e ASL |
85 | |
86 | // validate | |
550d787e | 87 | int numProcesses = traceManager.getCheckPointStateModel().getProcesses().length; |
03c71d1e ASL |
88 | assertEquals("Total number of processes created", 276, numProcesses); |
89 | ||
90 | } | |
91 | ||
92 | } |