ctf: Depend on the tracecompass-test-traces project
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.kernel.core.tests / src / org / eclipse / tracecompass / lttng2 / kernel / core / tests / analysis / kernel / statesystem / PartialStateSystemTest.java
CommitLineData
1b9d3765 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2015 Ericsson
1b9d3765
AM
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
6a769f6a 10 * Bernd Hufmann - Use state system analysis module instead of factory
1b9d3765
AM
11 ******************************************************************************/
12
42d5b5f2 13package org.eclipse.tracecompass.lttng2.kernel.core.tests.analysis.kernel.statesystem;
1b9d3765 14
6a769f6a 15import static org.junit.Assert.assertTrue;
947504fa 16import static org.junit.Assert.fail;
1b9d3765
AM
17
18import java.io.File;
1b9d3765 19
c1831960
AM
20import org.eclipse.jdt.annotation.NonNull;
21import org.eclipse.jdt.annotation.NonNullByDefault;
22import org.eclipse.jdt.annotation.Nullable;
6d16f5a9 23import org.eclipse.tracecompass.analysis.os.linux.core.kernelanalysis.KernelAnalysisModule;
e894a508 24import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
2bdf0193 25import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
2bdf0193
AM
26import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
27import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
c4d57ac1 28import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTraceUtils;
9722e5d7 29import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
392bf486
AM
30import org.junit.AfterClass;
31import org.junit.BeforeClass;
9f630534 32import org.junit.Ignore;
1b9d3765
AM
33import org.junit.Test;
34
35/**
36 * State system tests using a partial history.
37 *
38 * @author Alexandre Montplaisir
39 */
9f630534 40@Ignore
1b9d3765
AM
41public class PartialStateSystemTest extends StateSystemTest {
42
c1831960 43 private static final @NonNull String TEST_FILE_NAME = "test-partial";
6a769f6a 44
c4d57ac1 45 private static CtfTmfTrace trace;
392bf486
AM
46 private static File stateFile;
47 private static TestLttngKernelAnalysisModule module;
48
49 /**
50 * Test class setup
51 */
52 @BeforeClass
53 public static void initialize() {
c4d57ac1 54 trace = CtfTmfTestTraceUtils.getTrace(testTrace);
bd64ee73 55
c4d57ac1 56 stateFile = new File(TmfTraceManager.getSupplementaryFileDir(trace) + TEST_FILE_NAME);
6a769f6a
BH
57 if (stateFile.exists()) {
58 stateFile.delete();
59 }
1b9d3765 60
bd64ee73 61 module = new TestLttngKernelAnalysisModule(TEST_FILE_NAME);
6a769f6a 62 try {
c4d57ac1 63 assertTrue(module.setTrace(trace));
6a769f6a 64 } catch (TmfAnalysisException e) {
947504fa 65 fail();
1b9d3765 66 }
6a769f6a 67 module.schedule();
7d6122fc 68 assertTrue(module.waitForCompletion());
392bf486
AM
69
70 fixture = module.getStateSystem();
1b9d3765
AM
71 }
72
947504fa
AM
73 /**
74 * Class clean-up
75 */
392bf486
AM
76 @AfterClass
77 public static void cleanup() {
edbdb7ea 78 if (module != null) {
03f0b0b1 79 module.dispose();
edbdb7ea
AM
80 }
81 if (stateFile != null) {
82 stateFile.delete();
83 }
392bf486
AM
84 if (fixture != null) {
85 fixture.dispose();
86 }
c4d57ac1
AM
87 if (trace != null) {
88 trace.dispose();
89 }
392bf486
AM
90 module = null;
91 fixture = null;
c4d57ac1 92 trace = null;
947504fa
AM
93 }
94
1b9d3765
AM
95 /**
96 * Partial histories cannot get the intervals' end times. The fake value that
97 * is returned is equal to the query's timestamp. So override this here
98 * so that {@link #testFullQueryThorough} keeps working.
99 */
100 @Override
101 protected long getEndTimes(int idx) {
102 return interestingTimestamp1;
103 }
104
105 // ------------------------------------------------------------------------
106 // Skip tests using single-queries (unsupported in partial history)
107 // ------------------------------------------------------------------------
108
109 @Override
110 @Test(expected = UnsupportedOperationException.class)
111 public void testSingleQuery1() {
112 super.testSingleQuery1();
113 }
114
115 @Override
116 @Test(expected = UnsupportedOperationException.class)
117 public void testRangeQuery1() {
118 super.testRangeQuery1();
119 }
120
121 @Override
122 @Test(expected = UnsupportedOperationException.class)
123 public void testRangeQuery2() {
124 super.testRangeQuery2();
125 }
126
127 @Override
128 @Test(expected = UnsupportedOperationException.class)
129 public void testRangeQuery3() {
130 super.testRangeQuery3();
131 }
132
133 @Override
134 @Test(expected = UnsupportedOperationException.class)
135 public void testSingleQueryInvalidTime1() throws TimeRangeException {
136 super.testSingleQueryInvalidTime1();
137 }
138
139 @Override
140 @Test(expected = UnsupportedOperationException.class)
141 public void testSingleQueryInvalidTime2() throws TimeRangeException {
142 super.testSingleQueryInvalidTime2();
143 }
144
145 @Override
146 @Test(expected = UnsupportedOperationException.class)
147 public void testRangeQueryInvalidTime1() throws TimeRangeException {
148 super.testRangeQueryInvalidTime1();
149 }
150
151 @Override
152 @Test(expected = UnsupportedOperationException.class)
153 public void testRangeQueryInvalidTime2() throws TimeRangeException {
154 super.testRangeQueryInvalidTime2();
155 }
6a769f6a 156
c1831960 157 @NonNullByDefault
6d16f5a9 158 private static class TestLttngKernelAnalysisModule extends KernelAnalysisModule {
6a769f6a
BH
159
160 private final String htFileName;
161
162 /**
163 * Constructor adding the views to the analysis
164 * @param htFileName
165 * The History File Name
166 */
167 public TestLttngKernelAnalysisModule(String htFileName) {
168 super();
169 this.htFileName = htFileName;
170 }
171
172 @Override
f479550c 173 public boolean setTrace(@Nullable ITmfTrace trace) throws TmfAnalysisException {
6a769f6a 174 if (!(trace instanceof CtfTmfTrace)) {
f479550c 175 return false;
6a769f6a 176 }
f479550c 177 return super.setTrace(trace);
6a769f6a
BH
178 }
179
6a769f6a
BH
180 @Override
181 protected StateSystemBackendType getBackendType() {
182 return StateSystemBackendType.PARTIAL;
183 }
184
185 @Override
186 protected String getSsFileName() {
187 return htFileName;
188 }
189
190 }
1b9d3765 191}
This page took 0.085129 seconds and 5 git commands to generate.