From 5c5bb640a193315db83232b732ab96291ff67d8b Mon Sep 17 00:00:00 2001 From: Florian Lambers <fl462057@fh-muenster.de> Date: Tue, 16 Nov 2021 15:34:41 +0100 Subject: [PATCH] added flag to activity --- .../MatchingTestcollectionOld.java | 10 +++++ .../migration/MigrationService.java | 38 ++++++++++++++++--- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java index d12572e..07d66c6 100644 --- a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java +++ b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java @@ -651,7 +651,12 @@ public class MatchingTestcollectionOld { @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) public void casetill1() { + ProcessInstance processInstance = runtimeService() // + .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, true, VAR_ERSTATTUNG, true, VAR_KUNDENNUMMER, "123")); // + assertThat(processInstance) // + .isStarted() // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // @@ -691,6 +696,7 @@ public class MatchingTestcollectionOld { complete(getLockedTask(lockedTasks0, ServiceTasks.KUNDENDATEN_ERMITTELN), ExternalServiceMockProvider.customerProvider(variableSnapshot0)); assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // @@ -727,6 +733,7 @@ public class MatchingTestcollectionOld { complete(task(UserTasks.MANUELLE_PRUEFUNG)); assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // @@ -763,6 +770,7 @@ public class MatchingTestcollectionOld { complete(task(UserTasks.PAKET_PACKEN)); assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // @@ -799,6 +807,7 @@ public class MatchingTestcollectionOld { complete(task(UserTasks.PAKET_PRUEFEN)); assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // @@ -835,6 +844,7 @@ public class MatchingTestcollectionOld { complete(task(UserTasks.PAKET_SENDEN)); assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java index c9059e6..0550da4 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java @@ -24,9 +24,11 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElementReference; import de.fhmuenster.masterthesis.testgeneratorDSL.ManualTaskFlowElement; +import de.fhmuenster.masterthesis.testgeneratorDSL.MockReference; import de.fhmuenster.masterthesis.testgeneratorDSL.UserTaskFlowElement; import de.fhmuenster.masterthesis.testgeneratorDSL.SequenceFlowElement; import de.fhmuenster.masterthesis.testgeneratorDSL.ServiceTaskFlowElement; +import de.fhmuenster.masterthesis.testgeneratorDSL.TestgeneratorDSLFactory; import de.fhmuenster.masterthesis.testgeneratorDSL.BusinessRuleTaskFlowElement; import de.fhmuenster.masterthesis.testgeneratorDSL.Flag; import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; @@ -66,16 +68,29 @@ public class MigrationService { + " mit Status: " + fcw.getMigrationResult().getPriority()); try { + //"maximalen" Flag-Wert noch ermitteln, jetzt erstmal nur YELLOW als Standard newDSL.getFlow(fcw.getFlow().getName()).setFlag(Flag.YELLOW); - - List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements(); + EList<FlowElementReference> inclElements = newDSL.getFlow(fcw.getFlow().getName()).getInclElements(); - for(FlowElementReference fer : fers) { - fer.setFlag(Flag.GREEN); - System.out.println(fer.getRef().getName()); + for(FlowElementReference elementReference : inclElements) { + if(elementReference.getRef().getName().equals(fcw.getFlowElement().getName())) { + elementReference.setFlag(this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus())); + } } + //fers.clear(); + //fers.addAll(fers); + + //newDSL.updateInclElements(fers); + + //fcw.getFlow().getInclElements().addAll(newDSL.updateInclElements(fers, fcw.getFlow().getName())); + + + + + //fcw.getFlow().getInclElements().addAll(newDSL.updateInclElements(fers, fcw.getFlow().getName())); + //newDSL.updateInclElements(fers, fcw.getFlow().getName()); //newDSL.getFlow(fcw.getFlow().getName()).getInclElements().clear(); //newDSL.getFlow(fcw.getFlow().getName()).getInclElements().replaceAll(fers); @@ -194,6 +209,19 @@ public class MigrationService { } } + private Flag convertMigrationResultToFlag(MigrationResultStatus status) { + switch(status) { + case GREEN: + return Flag.GREEN; + case YELLOW: + return Flag.YELLOW; + case RED: + return Flag.RED; + default: + return Flag.GREEN; + } + } + public MigrationResultWrapperDTO convertMigrationResultWrapper(MigrationResultWrapper wrapper) { MigrationResultWrapperDTO dto = new MigrationResultWrapperDTO(); dto = wrapper.convertToDTO(); -- GitLab