| 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.tests.control; |
| 13 | |
| 14 | import org.eclipse.linuxtools.lttng.event.LttngEvent; |
| 15 | import org.eclipse.linuxtools.lttng.tests.LttngTestPreparation; |
| 16 | import org.eclipse.linuxtools.tmf.experiment.TmfExperiment; |
| 17 | import org.eclipse.linuxtools.tmf.request.TmfEventRequest; |
| 18 | |
| 19 | @SuppressWarnings("nls") |
| 20 | public class LTTngSyntheticEventProviderTest extends LttngTestPreparation { |
| 21 | // ======================================================================== |
| 22 | // Tests |
| 23 | // ======================================================================== |
| 24 | |
| 25 | public void testPlainDataRequest() { |
| 26 | // prepare |
| 27 | init(); |
| 28 | TmfExperiment<LttngEvent> experiment = prepareExperimentToTest(); |
| 29 | TmfEventRequest<LttngEvent> request = prepareEventRequest( |
| 30 | LttngEvent.class, 0, 31); |
| 31 | |
| 32 | // execute |
| 33 | experiment.sendRequest(request); |
| 34 | try { |
| 35 | request.waitForCompletion(); |
| 36 | } catch (InterruptedException e) { |
| 37 | e.printStackTrace(); |
| 38 | } |
| 39 | |
| 40 | // finish |
| 41 | assertEquals("Unexpected eventCount", 15316, feventCount); |
| 42 | boolean expected = true; |
| 43 | assertEquals("Events received out of expected order", expected, |
| 44 | validSequence); |
| 45 | } |
| 46 | |
| 47 | public void testSyntheticEventRequest() { |
| 48 | System.out.println("testSyntheticEventRequest: test removed"); |
| 49 | // init(); |
| 50 | // // Create a new Experiment manager context |
| 51 | // IStateExperimentManager expManager = prepareExperimentContext(false); |
| 52 | // |
| 53 | // // make sure a TmfExperiment instance is registered as provider and |
| 54 | // // selected as current |
| 55 | // TmfExperiment<LttngEvent> experiment = prepareExperimentToTest(); |
| 56 | // |
| 57 | // // experiment selected, build experiment selection context and trigger |
| 58 | // // check point creation |
| 59 | // expManager.experimentSelected_prep(experiment); |
| 60 | // // builds check points in parallel |
| 61 | // expManager.experimentSelected(this, experiment); |
| 62 | // |
| 63 | // // Obtain the singleton event provider |
| 64 | // LttngSyntheticEventProvider synProvider = LttngCoreProviderFactory |
| 65 | // .getEventProvider(); |
| 66 | // |
| 67 | // // prepare synthetic event requests |
| 68 | // boolean printExpectedEvents = false; |
| 69 | // TmfEventRequest<LttngSyntheticEvent> request1 = prepareEventRequest(LttngSyntheticEvent.class, 5, 9, |
| 70 | // printExpectedEvents); /* 2001 events */ |
| 71 | // TmfEventRequest<LttngSyntheticEvent> request2 = prepareEventRequest(LttngSyntheticEvent.class, 11, 13, |
| 72 | // printExpectedEvents); /* 1001 events */ |
| 73 | // |
| 74 | // // execute |
| 75 | // synProvider.sendRequest(request1); |
| 76 | // try { |
| 77 | // request1.waitForCompletion(); |
| 78 | // } catch (InterruptedException e) { |
| 79 | // e.printStackTrace(); |
| 80 | // } |
| 81 | // System.out.println("EventCount " + feventCount); |
| 82 | // |
| 83 | // synProvider.sendRequest(request2); |
| 84 | // try { |
| 85 | // request2.waitForCompletion(); |
| 86 | // } catch (InterruptedException e) { |
| 87 | // e.printStackTrace(); |
| 88 | // } |
| 89 | // System.out.println("EventCount " + feventCount); |
| 90 | // |
| 91 | // // finish |
| 92 | // assertEquals("Unexpected eventCount", 3002, feventCount); |
| 93 | } |
| 94 | |
| 95 | } |