aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilliano Molaire2014-04-21 10:48:58 (EDT)
committerGenevieve Bastien2014-04-30 11:04:55 (EDT)
commit15c70063a58856e117db806c87d725785df09c6d (patch)
treeafaa3b4633422ddc9e95a7bb8523f3ad5ecc56e7
parent11f869fcb7e7e86b1f441513d02dad86990991b6 (diff)
downloadorg.eclipse.linuxtools-15c70063a58856e117db806c87d725785df09c6d.zip
org.eclipse.linuxtools-15c70063a58856e117db806c87d725785df09c6d.tar.gz
org.eclipse.linuxtools-15c70063a58856e117db806c87d725785df09c6d.tar.bz2
TMF: Add support for requirements in AnalysisModuleTestHelperrefs/changes/84/24284/11
Implementation of getRequirements and getValidTraceTypes in the analysis module test helper so it can be used by test cases. An analysis requirement factory has been added for the same purpose. Change-Id: Ibfb3c9beb28893b77a2b80453b3ea75d407105a9 Signed-off-by: Guilliano Molaire <guilliamo-jaime.molaire@polymtl.ca> Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-on: https://git.eclipse.org/r/24284 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Hudson CI Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java20
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisRequirementFactory.java72
2 files changed, 90 insertions, 2 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java
index dc8165b..aa9cdff 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisModuleTestHelper.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Geneviève Bastien - Initial API and implementation
+ * Guilliano Molaire - Implementation of requirements and valid trace types getters
*******************************************************************************/
package org.eclipse.linuxtools.tmf.tests.stubs.analysis;
@@ -24,6 +25,8 @@ import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub;
import org.eclipse.linuxtools.tmf.tests.stubs.trace.TmfTraceStub2;
import org.osgi.framework.Bundle;
+import com.google.common.collect.ImmutableList;
+
/**
* Analysis Module Helper for the stub analysis source
*
@@ -122,11 +125,24 @@ public class AnalysisModuleTestHelper implements IAnalysisModuleHelper {
@Override
public Iterable<Class<? extends ITmfTrace>> getValidTraceTypes() {
- return Collections.EMPTY_SET;
+ return ImmutableList.<Class<? extends ITmfTrace>> of(
+ TmfTraceStub.class,
+ TmfTraceStub2.class);
}
@Override
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() {
- return Collections.EMPTY_SET;
+ switch (fModule) {
+ case TEST:
+ return ImmutableList.of(
+ AnalysisRequirementFactory.REQUIREMENT_1,
+ AnalysisRequirementFactory.REQUIREMENT_3);
+ case TEST2:
+ return ImmutableList.of(
+ AnalysisRequirementFactory.REQUIREMENT_2,
+ AnalysisRequirementFactory.REQUIREMENT_3);
+ default:
+ return Collections.EMPTY_SET;
+ }
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisRequirementFactory.java b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisRequirementFactory.java
new file mode 100644
index 0000000..21f5b98
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.tmf.core.tests/stubs/org/eclipse/linuxtools/tmf/tests/stubs/analysis/AnalysisRequirementFactory.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2014 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Guilliano Molaire - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.tests.stubs.analysis;
+
+import java.util.Set;
+
+import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement;
+import org.eclipse.linuxtools.tmf.core.analysis.TmfAnalysisRequirement.ValuePriorityLevel;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Factory class to facilitate requirement usage across test case
+ */
+@SuppressWarnings("javadoc")
+public final class AnalysisRequirementFactory {
+
+ private AnalysisRequirementFactory() {}
+
+ public static final String REQUIREMENT_TYPE_1 = "car";
+ public static final String REQUIREMENT_TYPE_2 = "factory";
+ public static final String REQUIREMENT_TYPE_3 = "code";
+
+ public static final String REQUIREMENT_VALUE_1 = "value1";
+ public static final String REQUIREMENT_VALUE_2 = "value2";
+ public static final String REQUIREMENT_VALUE_3 = "value3";
+ public static final String REQUIREMENT_VALUE_4 = "value4";
+ public static final String REQUIREMENT_VALUE_5 = "value5";
+
+ public static final Set<String> REQUIREMENT_VALUES_1 = ImmutableSet.of(
+ REQUIREMENT_VALUE_1,
+ REQUIREMENT_VALUE_2,
+ REQUIREMENT_VALUE_3,
+ REQUIREMENT_VALUE_5
+ );
+
+ public static final Set<String> REQUIREMENT_VALUES_2 = ImmutableSet.of(
+ REQUIREMENT_VALUE_2,
+ REQUIREMENT_VALUE_3
+ );
+
+ public static final Set<String> REQUIREMENT_VALUES_3 = ImmutableSet.of(
+ REQUIREMENT_VALUE_3,
+ REQUIREMENT_VALUE_4,
+ REQUIREMENT_VALUE_5
+ );
+
+ public static final TmfAnalysisRequirement REQUIREMENT_1 =
+ new TmfAnalysisRequirement(REQUIREMENT_TYPE_1, REQUIREMENT_VALUES_1, ValuePriorityLevel.MANDATORY);
+ public static final TmfAnalysisRequirement REQUIREMENT_2 =
+ new TmfAnalysisRequirement(REQUIREMENT_TYPE_2);
+ public static final TmfAnalysisRequirement REQUIREMENT_3 =
+ new TmfAnalysisRequirement(REQUIREMENT_TYPE_3, REQUIREMENT_VALUES_3, ValuePriorityLevel.MANDATORY);
+
+ static {
+ REQUIREMENT_2.addValue(REQUIREMENT_VALUE_1, ValuePriorityLevel.MANDATORY);
+ REQUIREMENT_2.addValue(REQUIREMENT_VALUE_2, ValuePriorityLevel.OPTIONAL);
+ REQUIREMENT_2.addValue(REQUIREMENT_VALUE_3, ValuePriorityLevel.MANDATORY);
+ REQUIREMENT_2.addValue(REQUIREMENT_VALUE_4, ValuePriorityLevel.OPTIONAL);
+ REQUIREMENT_2.addValue(REQUIREMENT_VALUE_5, ValuePriorityLevel.MANDATORY);
+ }
+}