Commit | Line | Data |
---|---|---|
03c71d1e ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 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 | ||
13 | package org.eclipse.linuxtools.lttng.tests.state; | |
14 | ||
86de1b08 ASL |
15 | import java.util.Set; |
16 | ||
03c71d1e ASL |
17 | import junit.framework.TestCase; |
18 | ||
86de1b08 | 19 | import org.eclipse.linuxtools.lttng.TraceDebug; |
e31e01e8 | 20 | import org.eclipse.linuxtools.lttng.event.LttngEvent; |
86de1b08 | 21 | import org.eclipse.linuxtools.lttng.state.StateManager; |
03c71d1e | 22 | import org.eclipse.linuxtools.lttng.trace.LTTngTrace; |
e31e01e8 | 23 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; |
03c71d1e ASL |
24 | |
25 | /** | |
26 | * @author alvaro | |
27 | * | |
28 | */ | |
29 | public class TestStateManager extends TestCase { | |
86de1b08 | 30 | |
03c71d1e ASL |
31 | public void testSetTraceSelection() { |
32 | String logName = "traceset/trace1"; | |
33 | ||
34 | LTTngTrace testStream = null; | |
35 | try { | |
36 | testStream = new LTTngTrace(logName); | |
37 | } catch (Exception e) { | |
38 | e.printStackTrace(); | |
39 | } | |
40 | ||
41 | if (testStream != null) { | |
42 | LTTngTrace[] streamList = new LTTngTrace[1]; | |
43 | streamList[0] = testStream; | |
e31e01e8 | 44 | TmfExperiment<LttngEvent> newExp = new TmfExperiment<LttngEvent>(LttngEvent.class, logName, streamList); |
03c71d1e ASL |
45 | |
46 | //Get the Test StateManager | |
86de1b08 | 47 | StateManager manager = StateManagerFactoryTestSupport.getManager(newExp.getExperimentId()); |
03c71d1e | 48 | //Start execution. |
86de1b08 | 49 | manager.setTraceSelection(newExp, false); |
03c71d1e ASL |
50 | |
51 | //Print events not handled. | |
86de1b08 ASL |
52 | Set<String> notHandledEvents = manager.getEventsNotHandled(); |
53 | StringBuilder sb = new StringBuilder(); | |
54 | for (String event : notHandledEvents) { | |
55 | sb.append("\n" + event); | |
56 | } | |
57 | TraceDebug.debug("Events not Handled: " + sb.toString()); | |
03c71d1e ASL |
58 | } |
59 | } | |
60 | } |