added methods to create teststeps without context data
Signed-off-by: Alexander Knoblauch <a.knoblauch@peak-solution.de>
diff --git a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
index a582ec4..0d9bb33 100644
--- a/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
+++ b/src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java
@@ -1035,6 +1035,64 @@
}
/**
+ * Creates a new {@link TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep} and {@link Classification}. Doesn't create context
+ * roots
+ *
+ * @param test The parent {@code Test}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @param classification The {@link Classification} for the created
+ * {@link TestStep}.
+ * @return The created {@code TestStep} is returned.
+ */
+ public TestStep createTestStepWithOutContextRoots(Test test, TemplateTestStep templateTestStep,
+ Classification classification) {
+ TestStep testStep = createTestStepWithOutContextRoots(test, templateTestStep);
+ getCore(testStep).getMutableStore().set(classification);
+ return testStep;
+ }
+
+ /**
+ * Creates a new {@link TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep}. Doesn't create context roots
+ *
+ * @param test The parent {@code Test}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @return The created {@code TestStep} is returned.
+ */
+ public TestStep createTestStepWithOutContextRoots(Test test, TemplateTestStep templateTestStep) {
+ return createTestStepWithOutContextRoots(test, null, templateTestStep);
+ }
+
+ /**
+ * Creates a new {@link TestStep} for given {@link Test} using given
+ * {@link TemplateTestStep}.
+ *
+ * @param test The parent {@code Test}.
+ * @param status The related {@link Status}.
+ * @param templateTestStep The template the returned {@code TestStep} will be
+ * derived from.
+ * @return The created {@code TestStep} is returned.
+ */
+ // TODO make a decision: status in or out!
+ protected TestStep createTestStepWithOutContextRoots(Test test, Status status, TemplateTestStep templateTestStep) {
+ TemplateTest templateTest = TemplateTest.of(test)
+ .orElseThrow(() -> new IllegalArgumentException("Template test is not available."));
+ if (!templateTest.contains(templateTestStep)) {
+ throw new IllegalArgumentException("Template test step is not part of the test template.");
+ }
+
+ TestStep testStep = createTestStep(templateTestStep.getName(), test, status);
+
+ // relations
+ getCore(testStep).getMutableStore().set(templateTestStep);
+
+ return testStep;
+ }
+
+ /**
* Creates a new {@link Test} for given {@link Pool}.
*
* @param name Name of the created {@code Test}.
@@ -1078,16 +1136,8 @@
*/
// TODO make a decision: status in or out!
protected TestStep createTestStep(Test test, Status status, TemplateTestStep templateTestStep) {
- TemplateTest templateTest = TemplateTest.of(test)
- .orElseThrow(() -> new IllegalArgumentException("Template test is not available."));
- if (!templateTest.contains(templateTestStep)) {
- throw new IllegalArgumentException("Template test step is not part of the test template.");
- }
- TestStep testStep = createTestStep(templateTestStep.getName(), test, status);
-
- // relations
- getCore(testStep).getMutableStore().set(templateTestStep);
+ TestStep testStep = createTestStepWithOutContextRoots(test, status, templateTestStep);
// create initial context roots
templateTestStep.getTemplateRoots().forEach(templateRoot -> createContextRoot(testStep, templateRoot));