Commit | Line | Data |
---|---|---|
efc403bb AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 Ericsson | |
3 | * Copyright (c) 2010, 2011 École Polytechnique de Montréal | |
4 | * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com> | |
5 | * | |
6 | * All rights reserved. This program and the accompanying materials are | |
7 | * made available under the terms of the Eclipse Public License v1.0 which | |
8 | * accompanies this distribution, and is available at | |
9 | * http://www.eclipse.org/legal/epl-v10.html | |
10 | * | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider; | |
14 | ||
15 | import java.io.File; | |
16 | ||
dc0f7bfe | 17 | import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateInput; |
efc403bb AM |
18 | import org.eclipse.linuxtools.tmf.core.statesystem.StateHistorySystem; |
19 | import org.eclipse.linuxtools.tmf.core.statesystem.backend.historytree.ThreadedHistoryTreeBackend; | |
20 | import org.eclipse.linuxtools.tmf.core.statesystem.helpers.HistoryBuilder; | |
21 | import org.eclipse.linuxtools.tmf.core.statesystem.helpers.IStateChangeInput; | |
22 | import org.eclipse.linuxtools.tmf.core.statesystem.helpers.IStateHistoryBackend; | |
23 | ||
24 | import org.junit.BeforeClass; | |
25 | import org.junit.Test; | |
26 | ||
27 | /** | |
28 | * Variant of the StateSystemFullHistoryTest, which uses the threaded event | |
29 | * handler instead. | |
30 | * | |
31 | * @author alexmont | |
32 | * | |
33 | */ | |
34 | public class StateSystemFullThreadedHistoryTest extends | |
35 | StateSystemFullHistoryTest { | |
36 | ||
37 | /* Hiding the static method in the superclass */ | |
38 | protected static String getTestFileName() { | |
39 | return "/tmp/statefile-threaded.ht"; //$NON-NLS-1$ | |
40 | } | |
41 | ||
42 | @BeforeClass | |
43 | public static void initialize() { | |
44 | stateFile = new File(getTestFileName()); | |
45 | stateFileBenchmark = new File(getTestFileName() + ".benchmark"); //$NON-NLS-1$ | |
46 | try { | |
dc0f7bfe | 47 | input = new CtfKernelStateInput(CtfTestFiles.getTestTrace()); |
efc403bb AM |
48 | hp = new ThreadedHistoryTreeBackend(stateFile, |
49 | input.getStartTime(), 2000); | |
50 | builder = new HistoryBuilder(input, hp); | |
51 | } catch (Exception e) { | |
52 | e.printStackTrace(); | |
53 | } | |
54 | builder.run(); | |
55 | shs = (StateHistorySystem) builder.getSS(); | |
fee997a5 | 56 | builder.close(); /* Waits for the construction to finish */ |
efc403bb AM |
57 | } |
58 | ||
59 | @Override | |
60 | @Test | |
61 | public void testBuild() { | |
62 | HistoryBuilder zebuilder; | |
63 | IStateChangeInput zeinput; | |
64 | IStateHistoryBackend zehp; | |
65 | ||
66 | try { | |
dc0f7bfe | 67 | zeinput = new CtfKernelStateInput(CtfTestFiles.getTestTrace()); |
efc403bb AM |
68 | zehp = new ThreadedHistoryTreeBackend(stateFileBenchmark, |
69 | zeinput.getStartTime(), 2000); | |
70 | zebuilder = new HistoryBuilder(zeinput, zehp); | |
71 | zebuilder.run(); | |
72 | } catch (Exception e) { | |
73 | e.printStackTrace(); | |
74 | } | |
75 | } | |
76 | } |