1 /*******************************************************************************
2 * Copyright (c) 2010 Ericsson
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
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.control
;
14 import org
.eclipse
.linuxtools
.lttng
.LttngTestPreparation
;
15 import org
.eclipse
.linuxtools
.lttng
.event
.LttngEvent
;
16 import org
.eclipse
.linuxtools
.lttng
.event
.LttngSyntheticEvent
;
17 import org
.eclipse
.linuxtools
.lttng
.state
.experiment
.IStateExperimentManager
;
18 import org
.eclipse
.linuxtools
.tmf
.experiment
.TmfExperiment
;
19 import org
.eclipse
.linuxtools
.tmf
.request
.TmfEventRequest
;
21 public class LTTngSyntheticEventProviderTest
extends LttngTestPreparation
{
22 // ========================================================================
24 // ========================================================================
26 public void testPlainDataRequest() {
29 TmfExperiment
<LttngEvent
> experiment
= prepareExperimentToTest();
30 TmfEventRequest
<LttngEvent
> request
= prepareEventRequest(
31 LttngEvent
.class, 0, 31);
34 experiment
.sendRequest(request
);
36 request
.waitForCompletion();
37 } catch (InterruptedException e
) {
42 assertEquals("Unexpected eventCount", 15316, feventCount
);
43 boolean expected
= true;
44 assertEquals("Events received out of expected order", expected
,
51 public void testSyntheticEventRequest() {
53 // Create a new Experiment manager context
54 IStateExperimentManager expManager
= prepareExperimentContext(false);
56 // make sure a TmfExperiment instance is registered as provider and
57 // selected as current
58 TmfExperiment
<LttngEvent
> experiment
= prepareExperimentToTest();
60 // experiment selected, build experiment selection context and trigger
61 // check point creation
62 expManager
.experimentSelected_prep(experiment
);
64 expManager
.experimentSelected(this, experiment
);
66 // Obtain the singleton event provider
67 LttngSyntheticEventProvider synProvider
= LttngCoreProviderFactory
70 // prepare synthetic event requests
71 TmfEventRequest
<LttngSyntheticEvent
> request1
= prepareEventRequest(
72 LttngSyntheticEvent
.class, 5, 9); /* 2001 events*/
73 TmfEventRequest
<LttngSyntheticEvent
> request2
= prepareEventRequest(
74 LttngSyntheticEvent
.class, 11, 13); /* 1001 events */
77 synProvider
.sendRequest(request1
);
78 synProvider
.sendRequest(request2
);
80 request2
.waitForCompletion();
81 } catch (InterruptedException e
) {
87 assertEquals("Unexpected eventCount", 3002, feventCount
);