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.control; | |
13 | ||
14 | ||
15 | ||
16 | import org.eclipse.linuxtools.lttng.LttngTestPreparation; | |
17 | import org.eclipse.linuxtools.lttng.event.LttngEvent; | |
18 | import org.eclipse.linuxtools.lttng.event.LttngSyntheticEvent; | |
19 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; | |
20 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; | |
21 | ||
22 | public class LTTngSyntheticEventProviderTextTest extends LttngTestPreparation { | |
23 | ||
24 | // ======================================================================== | |
25 | // Tests | |
26 | // ======================================================================== | |
27 | /** | |
28 | * | |
29 | */ | |
30 | public void testPlainDataRequest() { | |
31 | // prepare | |
32 | init(); | |
33 | TmfExperiment<LttngEvent> experiment = prepareTextExperimentToTest(); | |
34 | TmfEventRequest<LttngEvent> request = prepareEventRequest( | |
35 | LttngEvent.class, 0, 31); | |
36 | ||
37 | // execute | |
38 | experiment.sendRequest(request); | |
39 | try { | |
40 | request.waitForCompletion(); | |
41 | } catch (InterruptedException e) { | |
42 | e.printStackTrace(); | |
43 | } | |
44 | ||
45 | // finish | |
46 | assertEquals("Unexpected eventCount", 15316, feventCount); | |
47 | boolean expected = true; | |
48 | assertEquals("Events received out of expected order", expected, | |
49 | validSequence); | |
50 | } | |
51 | ||
52 | /** | |
53 | * | |
54 | */ | |
55 | public void testSyntheticEventRequest() { | |
56 | init(); | |
57 | // make sure a synthetic event provider exists and it's registered | |
58 | LttngSyntheticEventProvider synProvider = LttngCoreProviderFactory | |
59 | .getEventProvider(); | |
60 | ||
61 | // make sure a TmfExperiment instance is registered as provider and | |
62 | // selected as current | |
63 | prepareTextExperimentToTest(); | |
64 | ||
65 | // prepare synthetic event request | |
66 | TmfEventRequest<LttngSyntheticEvent> request = prepareEventRequest( | |
67 | LttngSyntheticEvent.class, 0, 31); | |
68 | ||
69 | // execute | |
70 | synProvider.sendRequest(request); | |
71 | try { | |
72 | request.waitForCompletion(); | |
73 | } catch (InterruptedException e) { | |
74 | e.printStackTrace(); | |
75 | } | |
76 | ||
77 | // finish | |
78 | assertEquals("Unexpected eventCount", 15316, feventCount); | |
79 | } | |
80 | } |