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