diff options
author | Alexander Knoblauch | 2020-01-17 15:51:25 +0000 |
---|---|---|
committer | Matthias Koller | 2020-04-03 06:36:22 +0000 |
commit | 2bcda02b58c25450a31f8d80bed32a1f4a4d0f27 (patch) | |
tree | c264462b9a36089f52f09e16f926bb00046a933d | |
parent | 1c06a3ed52f71c5ba5d27fbc33c8f6e2d0b86825 (diff) | |
download | org.eclipse.mdm.api.default-2bcda02b58c25450a31f8d80bed32a1f4a4d0f27.tar.gz org.eclipse.mdm.api.default-2bcda02b58c25450a31f8d80bed32a1f4a4d0f27.tar.xz org.eclipse.mdm.api.default-2bcda02b58c25450a31f8d80bed32a1f4a4d0f27.zip |
added methods to create teststeps without context data
Signed-off-by: Alexander Knoblauch <a.knoblauch@peak-solution.de>
-rw-r--r-- | src/main/java/org/eclipse/mdm/api/dflt/model/EntityFactory.java | 68 |
1 files changed, 59 insertions, 9 deletions
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 @@ public abstract class EntityFactory extends BaseEntityFactory { } /** + * 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 @@ public abstract class EntityFactory extends BaseEntityFactory { */ // 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)); |