Commit | Line | Data |
---|---|---|
1b9d3765 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 Ericsson | |
3 | * All rights reserved. This program and the accompanying materials are | |
4 | * made available under the terms of the Eclipse Public License v1.0 which | |
5 | * accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Alexandre Montplaisir - Initial API and implementation | |
10 | ******************************************************************************/ | |
11 | ||
12 | package org.eclipse.linuxtools.lttng2.kernel.core.tests.stateprovider; | |
13 | ||
947504fa | 14 | import static org.junit.Assert.fail; |
1b9d3765 AM |
15 | import static org.junit.Assume.assumeTrue; |
16 | ||
17 | import java.io.File; | |
18 | import java.io.IOException; | |
19 | ||
d3ba47d4 | 20 | import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider; |
1b9d3765 AM |
21 | import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException; |
22 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; | |
3f436e7c | 23 | import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory; |
947504fa | 24 | import org.junit.AfterClass; |
1b9d3765 AM |
25 | import org.junit.BeforeClass; |
26 | import org.junit.Test; | |
27 | ||
28 | /** | |
29 | * State system tests using a partial history. | |
30 | * | |
31 | * @author Alexandre Montplaisir | |
32 | */ | |
33 | public class PartialStateSystemTest extends StateSystemTest { | |
34 | ||
947504fa AM |
35 | private static File stateFile; |
36 | ||
1b9d3765 AM |
37 | /** |
38 | * Initialization | |
39 | */ | |
40 | @BeforeClass | |
41 | public static void initialize() { | |
9ac63b5b | 42 | assumeTrue(testTrace.exists()); |
1b9d3765 | 43 | try { |
4e0b52e0 | 44 | stateFile = File.createTempFile("test-partial", ".ht"); |
1b9d3765 | 45 | |
9ac63b5b | 46 | input = new LttngKernelStateProvider(testTrace.getTrace()); |
3f436e7c | 47 | ssq = TmfStateSystemFactory.newPartialHistory(stateFile, input, true); |
1b9d3765 | 48 | } catch (IOException e) { |
947504fa | 49 | fail(); |
1b9d3765 | 50 | } catch (TmfTraceException e) { |
947504fa | 51 | fail(); |
1b9d3765 AM |
52 | } |
53 | } | |
54 | ||
947504fa AM |
55 | /** |
56 | * Class clean-up | |
57 | */ | |
58 | @AfterClass | |
59 | public static void tearDownClass() { | |
60 | stateFile.delete(); | |
61 | } | |
62 | ||
1b9d3765 AM |
63 | /** |
64 | * Partial histories cannot get the intervals' end times. The fake value that | |
65 | * is returned is equal to the query's timestamp. So override this here | |
66 | * so that {@link #testFullQueryThorough} keeps working. | |
67 | */ | |
68 | @Override | |
69 | protected long getEndTimes(int idx) { | |
70 | return interestingTimestamp1; | |
71 | } | |
72 | ||
73 | // ------------------------------------------------------------------------ | |
74 | // Skip tests using single-queries (unsupported in partial history) | |
75 | // ------------------------------------------------------------------------ | |
76 | ||
77 | @Override | |
78 | @Test(expected = UnsupportedOperationException.class) | |
79 | public void testSingleQuery1() { | |
80 | super.testSingleQuery1(); | |
81 | } | |
82 | ||
83 | @Override | |
84 | @Test(expected = UnsupportedOperationException.class) | |
85 | public void testRangeQuery1() { | |
86 | super.testRangeQuery1(); | |
87 | } | |
88 | ||
89 | @Override | |
90 | @Test(expected = UnsupportedOperationException.class) | |
91 | public void testRangeQuery2() { | |
92 | super.testRangeQuery2(); | |
93 | } | |
94 | ||
95 | @Override | |
96 | @Test(expected = UnsupportedOperationException.class) | |
97 | public void testRangeQuery3() { | |
98 | super.testRangeQuery3(); | |
99 | } | |
100 | ||
101 | @Override | |
102 | @Test(expected = UnsupportedOperationException.class) | |
103 | public void testSingleQueryInvalidTime1() throws TimeRangeException { | |
104 | super.testSingleQueryInvalidTime1(); | |
105 | } | |
106 | ||
107 | @Override | |
108 | @Test(expected = UnsupportedOperationException.class) | |
109 | public void testSingleQueryInvalidTime2() throws TimeRangeException { | |
110 | super.testSingleQueryInvalidTime2(); | |
111 | } | |
112 | ||
113 | @Override | |
114 | @Test(expected = UnsupportedOperationException.class) | |
115 | public void testRangeQueryInvalidTime1() throws TimeRangeException { | |
116 | super.testRangeQueryInvalidTime1(); | |
117 | } | |
118 | ||
119 | @Override | |
120 | @Test(expected = UnsupportedOperationException.class) | |
121 | public void testRangeQueryInvalidTime2() throws TimeRangeException { | |
122 | super.testRangeQueryInvalidTime2(); | |
123 | } | |
124 | } |