1 /*******************************************************************************
2 * Copyright (c) 2014 É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 * Mathieu Rail - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.tests
.stubs
.analysis
;
17 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
18 import org
.eclipse
.jdt
.annotation
.NonNull
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.TmfAbstractAnalysisModule
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.analysis
.requirements
.TmfAbstractAnalysisRequirement
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfAnalysisException
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
23 import org
.eclipse
.tracecompass
.tmf
.tests
.stubs
.trace
.TmfTraceStub
;
25 import com
.google
.common
.collect
.ImmutableSet
;
28 * Analysis type to test requirements acquisition
30 @SuppressWarnings({ "javadoc", "nls" })
31 public class TestRequirementAnalysis
extends TmfAbstractAnalysisModule
{
32 /* Test requirement types */
33 public static final @NonNull String EVENT_TYPE
= "event";
34 public static final @NonNull String FIELD_TYPE
= "field";
36 /* A few event names */
37 public static final @NonNull String EXIT_SYSCALL
= "exit_syscall";
38 public static final @NonNull String SCHED_SWITCH
= "sched_switch";
39 public static final @NonNull String SCHED_WAKEUP
= "sched_wakeup";
42 public static final @NonNull String PID
= "pid";
43 public static final @NonNull String TID
= "tid";
46 public boolean canExecute(ITmfTrace trace
) {
47 /* This just makes sure the trace is a ctf stub trace */
48 return (TmfTraceStub
.class.isAssignableFrom(trace
.getClass()));
52 protected void canceling() {
57 protected boolean executeAnalysis(final IProgressMonitor monitor
) {
62 public boolean setTrace(ITmfTrace trace
) throws TmfAnalysisException
{
63 return super.setTrace(trace
);
67 public Iterable
<TmfAbstractAnalysisRequirement
> getAnalysisRequirements() {
68 Set
<TmfAbstractAnalysisRequirement
> requirements
= ImmutableSet
.of(
69 AnalysisRequirementFactory
.REQUIREMENT_1
,
70 AnalysisRequirementFactory
.REQUIREMENT_3
);