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 | ||
14 | import static org.junit.Assume.assumeTrue; | |
15 | ||
16 | import java.io.File; | |
17 | import java.io.IOException; | |
18 | ||
d3ba47d4 | 19 | import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.LttngKernelStateProvider; |
1b9d3765 AM |
20 | import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException; |
21 | import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException; | |
3f436e7c | 22 | import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemFactory; |
1b9d3765 AM |
23 | import org.junit.BeforeClass; |
24 | import org.junit.Test; | |
25 | ||
26 | /** | |
27 | * State system tests using a partial history. | |
28 | * | |
29 | * @author Alexandre Montplaisir | |
30 | */ | |
31 | public class PartialStateSystemTest extends StateSystemTest { | |
32 | ||
33 | /** | |
34 | * Initialization | |
35 | */ | |
36 | @BeforeClass | |
37 | public static void initialize() { | |
9ac63b5b | 38 | assumeTrue(testTrace.exists()); |
1b9d3765 AM |
39 | File stateFile = null; |
40 | try { | |
4e0b52e0 | 41 | stateFile = File.createTempFile("test-partial", ".ht"); |
1b9d3765 AM |
42 | stateFile.deleteOnExit(); |
43 | ||
9ac63b5b | 44 | input = new LttngKernelStateProvider(testTrace.getTrace()); |
3f436e7c | 45 | ssq = TmfStateSystemFactory.newPartialHistory(stateFile, input, true); |
1b9d3765 AM |
46 | } catch (IOException e) { |
47 | e.printStackTrace(); | |
48 | } catch (TmfTraceException e) { | |
49 | e.printStackTrace(); | |
50 | } | |
51 | } | |
52 | ||
53 | /** | |
54 | * Partial histories cannot get the intervals' end times. The fake value that | |
55 | * is returned is equal to the query's timestamp. So override this here | |
56 | * so that {@link #testFullQueryThorough} keeps working. | |
57 | */ | |
58 | @Override | |
59 | protected long getEndTimes(int idx) { | |
60 | return interestingTimestamp1; | |
61 | } | |
62 | ||
63 | // ------------------------------------------------------------------------ | |
64 | // Skip tests using single-queries (unsupported in partial history) | |
65 | // ------------------------------------------------------------------------ | |
66 | ||
67 | @Override | |
68 | @Test(expected = UnsupportedOperationException.class) | |
69 | public void testSingleQuery1() { | |
70 | super.testSingleQuery1(); | |
71 | } | |
72 | ||
73 | @Override | |
74 | @Test(expected = UnsupportedOperationException.class) | |
75 | public void testRangeQuery1() { | |
76 | super.testRangeQuery1(); | |
77 | } | |
78 | ||
79 | @Override | |
80 | @Test(expected = UnsupportedOperationException.class) | |
81 | public void testRangeQuery2() { | |
82 | super.testRangeQuery2(); | |
83 | } | |
84 | ||
85 | @Override | |
86 | @Test(expected = UnsupportedOperationException.class) | |
87 | public void testRangeQuery3() { | |
88 | super.testRangeQuery3(); | |
89 | } | |
90 | ||
91 | @Override | |
92 | @Test(expected = UnsupportedOperationException.class) | |
93 | public void testSingleQueryInvalidTime1() throws TimeRangeException { | |
94 | super.testSingleQueryInvalidTime1(); | |
95 | } | |
96 | ||
97 | @Override | |
98 | @Test(expected = UnsupportedOperationException.class) | |
99 | public void testSingleQueryInvalidTime2() throws TimeRangeException { | |
100 | super.testSingleQueryInvalidTime2(); | |
101 | } | |
102 | ||
103 | @Override | |
104 | @Test(expected = UnsupportedOperationException.class) | |
105 | public void testRangeQueryInvalidTime1() throws TimeRangeException { | |
106 | super.testRangeQueryInvalidTime1(); | |
107 | } | |
108 | ||
109 | @Override | |
110 | @Test(expected = UnsupportedOperationException.class) | |
111 | public void testRangeQueryInvalidTime2() throws TimeRangeException { | |
112 | super.testRangeQueryInvalidTime2(); | |
113 | } | |
114 | } |