Merge branch 'master' into lttng_2_0_control_dev
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / TestParams.java
1 package org.eclipse.linuxtools.ctf.core.tests;
2
3 import java.io.File;
4
5 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
6 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
7
8 /**
9 * Here are the definitions common to all the CTF parser tests.
10 *
11 * @author alexmont
12 *
13 */
14 public abstract class TestParams {
15
16 /* Path to test traces */
17 private static final String testTracePath1 = "Tests/traces/trace20m"; //$NON-NLS-1$
18 private static CTFTrace testTrace1 = null;
19 private static CTFTrace testTraceFromFile1 = null;
20
21 private static final File emptyFile = new File(""); //$NON-NLS-1$
22 private static CTFTrace emptyTrace = null;
23
24 public static File getEmptyFile() {
25 return emptyFile;
26 }
27
28 public static CTFTrace getEmptyTrace() {
29 if (emptyTrace == null) {
30 try {
31 emptyTrace = new CTFTrace(""); //$NON-NLS-1$
32 } catch (CTFReaderException e) {
33 /* We know this trace should exist */
34 throw new RuntimeException(e);
35 }
36 }
37 return emptyTrace;
38 }
39
40 public static CTFTrace createTrace() {
41 if (testTrace1 == null) {
42 try {
43 testTrace1 = new CTFTrace(testTracePath1);
44 } catch (CTFReaderException e) {
45 /* We know this trace should exist */
46 throw new RuntimeException(e);
47 }
48 }
49 return testTrace1;
50 }
51
52 public static CTFTrace createTraceFromFile() {
53 if (testTraceFromFile1 == null) {
54 try {
55 testTraceFromFile1 = new CTFTrace(new File(testTracePath1));
56 } catch (CTFReaderException e) {
57 /* We know this trace should exist */
58 throw new RuntimeException(e);
59 }
60 }
61 return testTraceFromFile1;
62 }
63 }
This page took 0.034324 seconds and 6 git commands to generate.