ctf: Depend on the tracecompass-test-traces project
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.ctf.core.tests / shared / org / eclipse / tracecompass / ctf / core / tests / shared / CtfTestTraceUtils.java
1 /*******************************************************************************
2 * Copyright (c) 2013, 2015 Ericsson, EfficiOS Inc. and others
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.ctf.core.tests.shared;
11
12 import java.io.IOException;
13
14 import org.eclipse.core.runtime.FileLocator;
15 import org.eclipse.tracecompass.ctf.core.CTFException;
16 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
17 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
18
19 /**
20 * Wrapper for the CTF test traces, instantiating {@link CTFTrace} objects from
21 * them.
22 *
23 * @author Alexandre Montplaisir
24 */
25 public final class CtfTestTraceUtils {
26
27 private CtfTestTraceUtils() {}
28
29 /**
30 * Get a CTFTrace instance of a test trace.
31 *
32 * @param trace
33 * The test trace to use
34 * @return The CTFTrace object
35 * @throws CTFException
36 * If there is an error initializing the trace
37 */
38 public static synchronized CTFTrace getTrace(CtfTestTrace trace) throws CTFException {
39 String tracePath;
40 try {
41 tracePath = FileLocator.toFileURL(trace.getTraceURL()).getPath();
42 } catch (IOException e) {
43 throw new IllegalStateException();
44 }
45
46 return new CTFTrace(tracePath);
47 }
48 }
This page took 0.049809 seconds and 5 git commands to generate.