1 /*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.tmf
.core
.tests
.shared
;
16 import java
.io
.IOException
;
17 import java
.net
.URISyntaxException
;
20 import org
.eclipse
.core
.runtime
.FileLocator
;
21 import org
.eclipse
.core
.runtime
.Path
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
23 import org
.eclipse
.linuxtools
.tmf
.core
.tests
.TmfCoreTestPlugin
;
24 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.ITmfTrace
;
25 import org
.eclipse
.linuxtools
.tmf
.tests
.stubs
.trace
.TmfTraceStub
;
28 * Wrapper, imitating the {@link CtfTmfTestTrace} class for the non-ctf traces
30 * @author Geneviève Bastien
32 public enum TmfTestTrace
{
34 A_TEST_10K("A-Test-10K"),
36 A_TEST_10K2("A-Test-10K-2"),
38 E_TEST_10K("E-Test-10K"),
40 O_TEST_10K("O-Test-10K"),
41 /** And oh! a fifth trace */
42 R_TEST_10K("R-Test-10K");
45 private final String fPath
;
46 private final String fDirectory
= "testfiles";
47 private ITmfTrace fTrace
= null;
49 private TmfTestTrace(String file
) {
54 * Get the path of the trace
56 * @return The path of this trace
58 public String
getPath() {
63 * Get the full path of the trace
65 * @return The full path of the trace
67 public String
getFullPath() {
68 return fDirectory
+ File
.separator
+ fPath
;
72 * Return a ITmfTrace object of this test trace. It will be already
75 * @return A {@link ITmfTrace} reference to this trace
77 public ITmfTrace
getTrace() {
79 TmfTraceStub trace
= null;
80 final URL location
= FileLocator
.find(TmfCoreTestPlugin
.getDefault().getBundle(), new Path(fDirectory
+ File
.separator
+ fPath
), null);
82 File test
= new File(FileLocator
.toFileURL(location
).toURI());
83 trace
= new TmfTraceStub(test
.toURI().getPath(), ITmfTrace
.DEFAULT_TRACE_CACHE_SIZE
, false, null, null);
85 } catch (URISyntaxException e
) {
86 throw new RuntimeException(e
);
87 } catch (IOException e
) {
88 throw new RuntimeException(e
);
89 } catch (TmfTraceException e
) {
90 throw new RuntimeException(e
);
This page took 0.031548 seconds and 5 git commands to generate.