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