diff --git a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java index 07d66c6070c407e18888ed69eab858f909bfb640..d12572e23371f2aa42a9b3b402f4705c38ff8046 100644 --- a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java +++ b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/MatchingTestcollectionOld.java @@ -651,12 +651,7 @@ 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) // @@ -696,7 +691,6 @@ 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) // @@ -733,7 +727,6 @@ 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) // @@ -770,7 +763,6 @@ 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) // @@ -807,7 +799,6 @@ 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) // @@ -844,7 +835,6 @@ 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/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection-old.java b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection-old.java index 94c502e2cd7c99ab20e2216f5b5f17ed0312287d..fcfc89b210c7ee3e4e861f567464984d341cbaad 100644 --- a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection-old.java +++ b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection-old.java @@ -13,6 +13,9 @@ import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.test.Deployment; import org.camunda.bpm.engine.test.ProcessEngineRule; import org.camunda.bpm.engine.externaltask.LockedExternalTask; +import org.camunda.bpm.engine.test.mock.Mocks; +import de.sample.onlineschuhdemo.externalaccess.LagerService; +import de.sample.onlineschuhdemo.externalaccess.WarennummerErmittelnDelegate; import org.camunda.bpm.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRuleBuilder; import org.junit.Before; import org.junit.ClassRule; @@ -27,6 +30,22 @@ public class Testcollection-old { @Rule public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build(); + private static final String VAR_KUNDENNUMMER = "kundennummer"; + private static final String VAR_MARKE = "marke"; + private static final String VAR_IBAN = "iban"; + private static final String VAR_VORNAME = "vorname"; + private static final String VAR_NACHNAME = "nachname"; + private static final String VAR_PAKETTYP = "pakettyp"; + private static final String VAR_EMAILGESENDET = "emailGesendet"; + private static final String VAR_FIRSTNAME = "firstname"; + private static final String VAR_LASTNAME = "lastname"; + private static final String VAR_IBANREFUND = "ibanRefund"; + private static final String VAR_CONFIRMATIONEMAILSENT = "confirmationEmailSent"; + private static final String VAR_SERVICEIDENTIFIER = "serviceIdentifier"; + private static final String VAR_PREIS = "preis"; + private static final String VAR_ERSTATTUNG = "erstattung"; + private static final String VAR_PAKET = "paket"; + private static final String VAR_BESCHAEDIGT = "beschaedigt"; static { LogFactory.useSlf4jLogging(); @@ -35,5 +54,1081 @@ public class Testcollection-old { @Before public void setup() { init(rule.getProcessEngine()); + + LagerService lagerService = new LagerService(); + + WarennummerErmittelnDelegate warennummerErmittelnDelegate = new WarennummerErmittelnDelegate(); + warennummerErmittelnDelegate.setLagerService(lagerService); + + Mocks.register("warennummer", warennummerErmittelnDelegate); + } + + @Test + @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) + public void normalverpackungAuspacken() { + + ProcessInstance processInstance = runtimeService() // + .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, false, VAR_ERSTATTUNG, false, VAR_KUNDENNUMMER, "C-123A456")); // + + assertThat(processInstance) // + .isStarted() // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot0 = runtimeService() // + .getVariables(processInstance.getId()); // + List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.PAKET_PACKEN), withVariables(VAR_PAKETTYP, "Normalverpackung")); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.PAKET_PRUEFEN), withVariables(VAR_PAKET, false)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.PAKET_PACKEN), withVariables(VAR_PAKETTYP, "Luxusverpackung")); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.PAKET_PRUEFEN), withVariables(VAR_PAKET, true)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasPassed(Gateways.GATEWAY_14EVKAP) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(UserTasks.PAKET_SENDEN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isEnded() // + .variables() // + .contains(entry(VAR_KUNDENNUMMER, "C-123A456"), entry(VAR_VORNAME, "Max"), entry(VAR_ERSTATTUNG, false), entry(VAR_NACHNAME, "Mustermann"), entry(VAR_BESCHAEDIGT, false)); // + + } + + @Test + @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) + public void vernichtenErstattung() { + + ProcessInstance processInstance = runtimeService() // + .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, true, VAR_ERSTATTUNG, true, VAR_KUNDENNUMMER, "C-123A456")); // + + assertThat(processInstance) // + .isStarted() // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.WARENDATEN_ERFASSEN), withVariables(VAR_MARKE, "Luxury Foot", VAR_PREIS, 350)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + complete(task(UserTasks.WARE_VERNICHTEN)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasPassed(UserTasks.WARE_VERNICHTEN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot0 = runtimeService() // + .getVariables(processInstance.getId()); // + List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); + 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(UserTasks.WARENDATEN_ERFASSEN) // + .hasPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasPassed(UserTasks.WARE_VERNICHTEN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot1 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); + List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); + complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasPassed(UserTasks.WARE_VERNICHTEN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot2 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); + List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); + complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasPassed(UserTasks.WARE_VERNICHTEN) // + .hasPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasPassed(ServiceTasks.ERSTATTUNG) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isEnded() // + .variables() // + .contains(entry(VAR_KUNDENNUMMER, "C-123A456"), entry(VAR_EMAILGESENDET, "Nein"), entry(VAR_MARKE, "Luxury Foot"), entry(VAR_IBAN, "DE12345678900000123456"), entry(VAR_VORNAME, "Max"), entry(VAR_ERSTATTUNG, true), entry(VAR_NACHNAME, "Mustermann"), entry(VAR_BESCHAEDIGT, true)); // + + } + + @Test + @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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot0 = runtimeService() // + .getVariables(processInstance.getId()); // + List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot1 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); + List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); + complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot2 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); + List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); + complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasPassed(ServiceTasks.ERSTATTUNG) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isEnded() // + .variables() // + .contains(entry(VAR_IBANREFUND, "DE80123084556"), entry(VAR_FIRSTNAME, "Till"), entry(VAR_VORNAME, "till"), entry(VAR_LASTNAME, "Brinkhus"), entry(VAR_SERVICEIDENTIFIER, "getData"), entry(VAR_BESCHAEDIGT, false), entry(VAR_KUNDENNUMMER, "123"), entry(VAR_EMAILGESENDET, "Ja"), entry(VAR_PREIS, 1234), entry(VAR_MARKE, "wer"), entry(VAR_IBAN, "DE80123084556"), entry(VAR_ERSTATTUNG, true), entry(VAR_CONFIRMATIONEMAILSENT, "Ja"), entry(VAR_NACHNAME, "Brinkhus"), entry(VAR_PAKETTYP, "Normalverpackung"), entry(VAR_PAKET, true)); // + + } + + @Test + @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) + public void casetill2() { + + ProcessInstance processInstance = runtimeService() // + .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, true, VAR_ERSTATTUNG, true, VAR_KUNDENNUMMER, "12345")); // + + assertThat(processInstance) // + .isStarted() // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot0 = runtimeService() // + .getVariables(processInstance.getId()); // + List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot1 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); + List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); + complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot2 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); + List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); + complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); + + assertThat(processInstance) // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasPassed(ServiceTasks.ERSTATTUNG) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasPassed(Events.RETOURE_ENDE) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isEnded(); // + + } + + @Test + @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) + public void TestHenninh() { + + ProcessInstance processInstance = runtimeService() // + .startProcessInstanceByKey("Retoure"); // + + assertThat(processInstance) // + .isStarted() // + .hasPassed(Events.RETOURE_START) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // + .hasPassed(ManualTasks.WARE_EINSORTIEREN) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + Map<String, Object> variableSnapshot0 = runtimeService() // + .getVariables(processInstance.getId()); // + List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isNotEnded(); // + + 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) // + .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // + .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(UserTasks.PAKET_SENDEN) // + .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // + .hasNotPassed(Gateways.GATEWAY_14EVKAP) // + .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // + .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // + .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // + .hasNotPassed(UserTasks.WARE_VERNICHTEN) // + .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // + .hasNotPassed(UserTasks.WARE_SPENDEN) // + .isEnded(); // + } } diff --git a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection.java b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection.java index 4eefa28e710583f511c5fdd86ae5296dcec982c0..7d1d74311add9ea8f593a7da767ba8bf14d023ac 100644 --- a/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection.java +++ b/OnlineSchuhDemo/src-gen/de/sample/onlineschuhdemo/Testcollection.java @@ -607,10 +607,10 @@ public class Testcollection { @Test @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) - public void casetill1() { + public void TestHenninh() { ProcessInstance processInstance = runtimeService() // - .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, true, VAR_ERSTATTUNG, true, VAR_KUNDENNUMMER, "123")); // + .startProcessInstanceByKey("Retoure"); // assertThat(processInstance) // .isStarted() // @@ -621,11 +621,6 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // @@ -633,6 +628,11 @@ public class Testcollection { .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -658,11 +658,6 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // @@ -670,44 +665,11 @@ public class Testcollection { .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // - .hasNotPassed(Gateways.GATEWAY_14EVKAP) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // - .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // - .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // - .hasNotPassed(UserTasks.WARE_VERNICHTEN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // - .hasNotPassed(UserTasks.WARE_SPENDEN) // - .isNotEnded(); // - - Map<String, Object> variableSnapshot1 = runtimeService() // - .getVariables(processInstance.getId()); // - variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); - List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); - complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); - - assertThat(processInstance) // - .hasPassed(Events.RETOURE_START) // - .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // - .hasPassed(ManualTasks.WARE_EINSORTIEREN) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // - .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // - .hasNotPassed(UserTasks.PAKET_PRUEFEN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -720,11 +682,7 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - Map<String, Object> variableSnapshot2 = runtimeService() // - .getVariables(processInstance.getId()); // - variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); - List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); - complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); + complete(task(UserTasks.MANUELLE_PRUEFUNG)); assertThat(processInstance) // .hasPassed(Events.RETOURE_START) // @@ -734,62 +692,18 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasPassed(ServiceTasks.ERSTATTUNG) // - .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // .hasNotPassed(UserTasks.PAKET_PACKEN) // .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // - .hasNotPassed(Gateways.GATEWAY_14EVKAP) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // - .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // - .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // - .hasNotPassed(UserTasks.WARE_VERNICHTEN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // - .hasNotPassed(UserTasks.WARE_SPENDEN) // - .isEnded() // - .variables() // - .contains(entry(VAR_IBANREFUND, "DE80123084556"), entry(VAR_FIRSTNAME, "Till"), entry(VAR_VORNAME, "till"), entry(VAR_LASTNAME, "Brinkhus"), entry(VAR_SERVICEIDENTIFIER, "getData"), entry(VAR_BESCHAEDIGT, false), entry(VAR_KUNDENNUMMER, "123"), entry(VAR_EMAILGESENDET, "Ja"), entry(VAR_PREIS, 1234), entry(VAR_MARKE, "wer"), entry(VAR_IBAN, "DE80123084556"), entry(VAR_ERSTATTUNG, true), entry(VAR_CONFIRMATIONEMAILSENT, "Ja"), entry(VAR_NACHNAME, "Brinkhus"), entry(VAR_PAKETTYP, "Normalverpackung"), entry(VAR_PAKET, true)); // - - } - - @Test - @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) - public void casetill2() { - - ProcessInstance processInstance = runtimeService() // - .startProcessInstanceByKey("Retoure", withVariables(VAR_BESCHAEDIGT, true, VAR_ERSTATTUNG, true, VAR_KUNDENNUMMER, "12345")); // - - assertThat(processInstance) // - .isStarted() // - .hasPassed(Events.RETOURE_START) // - .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // - .hasPassed(ManualTasks.WARE_EINSORTIEREN) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // - .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // - .hasNotPassed(UserTasks.PAKET_PRUEFEN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -802,10 +716,7 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - Map<String, Object> variableSnapshot0 = runtimeService() // - .getVariables(processInstance.getId()); // - List<LockedExternalTask> lockedTasks0 = lockTasks("customer"); - complete(getLockedTask(lockedTasks0, ServiceTasks.KUNDENDATEN_ERMITTELN), ExternalServiceMockProvider.customerProvider(variableSnapshot0)); + complete(task(UserTasks.PAKET_PACKEN)); assertThat(processInstance) // .hasPassed(Events.RETOURE_START) // @@ -815,18 +726,18 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -839,11 +750,7 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - Map<String, Object> variableSnapshot1 = runtimeService() // - .getVariables(processInstance.getId()); // - variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); - List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); - complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); + complete(task(UserTasks.PAKET_PRUEFEN)); assertThat(processInstance) // .hasPassed(Events.RETOURE_START) // @@ -853,18 +760,18 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // - .hasNotPassed(UserTasks.PAKET_PRUEFEN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -877,11 +784,7 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - Map<String, Object> variableSnapshot2 = runtimeService() // - .getVariables(processInstance.getId()); // - variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); - List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); - complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); + complete(task(UserTasks.PAKET_SENDEN)); assertThat(processInstance) // .hasPassed(Events.RETOURE_START) // @@ -891,18 +794,18 @@ public class Testcollection { .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasPassed(ServiceTasks.ERSTATTUNG) // + .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasPassed(UserTasks.PAKET_PACKEN) // + .hasPassed(UserTasks.PAKET_PRUEFEN) // + .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasPassed(UserTasks.PAKET_SENDEN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasPassed(Events.RETOURE_ENDE) // - .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // - .hasNotPassed(UserTasks.PAKET_PRUEFEN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -919,20 +822,20 @@ public class Testcollection { @Test @Deployment(resources = {"retoure.bpmn", "\\schuh_vernichtung_spende.dmn"}) - public void TestHenninh() { - - ProcessInstance processInstance = runtimeService() // - .startProcessInstanceByKey("Retoure"); // + public void TestHenning() { assertThat(processInstance) // - .isStarted() // - .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasNotPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // @@ -940,11 +843,6 @@ public class Testcollection { .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -963,13 +861,17 @@ public class Testcollection { 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) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // + .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // + .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // + .hasNotPassed(Events.RETOURE_ENDE) // .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // @@ -977,11 +879,6 @@ public class Testcollection { .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -994,62 +891,31 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - complete(task(UserTasks.MANUELLE_PRUEFUNG)); + Map<String, Object> variableSnapshot1 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot1.put(VAR_SERVICEIDENTIFIER, "getData"); + List<LockedExternalTask> lockedTasks1 = lockTasks(lockedTasks0, "financial"); + complete(getLockedTask(lockedTasks1, ServiceTasks.FINANZDATEN_ERMITTELN), ExternalServiceMockProvider.financialMock(variableSnapshot1)); assertThat(processInstance) // - .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasNotPassed(UserTasks.PAKET_PACKEN) // - .hasNotPassed(UserTasks.PAKET_PRUEFEN) // - .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // - .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // - .hasNotPassed(Gateways.GATEWAY_14EVKAP) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // - .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // - .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // - .hasNotPassed(UserTasks.WARE_VERNICHTEN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // - .hasNotPassed(UserTasks.WARE_SPENDEN) // - .isNotEnded(); // - - 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) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // - .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // .hasNotPassed(UserTasks.PAKET_PRUEFEN) // .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -1062,62 +928,31 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_SPENDEN) // .isNotEnded(); // - 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) // - .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // - .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasPassed(UserTasks.PAKET_PACKEN) // - .hasPassed(UserTasks.PAKET_PRUEFEN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasNotPassed(UserTasks.PAKET_SENDEN) // - .hasNotPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // - .hasNotPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // - .hasNotPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // - .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // - .hasNotPassed(Gateways.GATEWAY_14EVKAP) // - .hasNotPassed(ManualTasks.WARE_AUSPACKEN_LUXUS) // - .hasNotPassed(UserTasks.WARENDATEN_ERFASSEN) // - .hasNotPassed(BusinessRuleTasks.VERNICHTUNG_ERMITTELN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG) // - .hasNotPassed(UserTasks.WARE_VERNICHTEN) // - .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // - .hasNotPassed(UserTasks.WARE_SPENDEN) // - .isNotEnded(); // - - complete(task(UserTasks.PAKET_SENDEN)); + Map<String, Object> variableSnapshot2 = runtimeService() // + .getVariables(processInstance.getId()); // + variableSnapshot2.put(VAR_SERVICEIDENTIFIER, "refund"); + List<LockedExternalTask> lockedTasks2 = lockTasks(lockedTasks1, "financial"); + complete(getLockedTask(lockedTasks2, ServiceTasks.ERSTATTUNG), ExternalServiceMockProvider.financialMock(variableSnapshot2)); assertThat(processInstance) // - .hasPassed(Events.RETOURE_START) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT) // .hasPassed(ManualTasks.WARE_EINSORTIEREN) // .hasPassed(Gateways.GATEWAY_BESCHAEDIGT_CLOSE) // .hasPassed(ServiceTasks.KUNDENDATEN_ERMITTELN) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG) // - .hasPassed(UserTasks.MANUELLE_PRUEFUNG) // - .hasPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // - .hasPassed(UserTasks.PAKET_PACKEN) // - .hasPassed(UserTasks.PAKET_PRUEFEN) // - .hasPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // - .hasPassed(UserTasks.PAKET_SENDEN) // + .hasPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // + .hasPassed(ServiceTasks.ERSTATTUNG) // .hasPassed(Gateways.GATEWAY_NEUSENDUNG_CLOSED) // .hasPassed(Gateways.GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED) // .hasPassed(Events.RETOURE_ENDE) // - .hasNotPassed(ServiceTasks.FINANZDATEN_ERMITTELN) // - .hasNotPassed(ServiceTasks.ERSTATTUNG) // + .hasNotPassed(UserTasks.MANUELLE_PRUEFUNG) // + .hasNotPassed(ServiceTasks.WARENNUMMER_ERMITTELN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED) // + .hasNotPassed(UserTasks.PAKET_PACKEN) // + .hasNotPassed(UserTasks.PAKET_PRUEFEN) // + .hasNotPassed(Gateways.GATEWAY_EINPACKUNG_FEHLERHAFT) // + .hasNotPassed(UserTasks.PAKET_SENDEN) // .hasNotPassed(Gateways.GATEWAY_AUSPACKEN) // .hasNotPassed(ManualTasks.WARE_AUSPACKEN_NORMAL) // .hasNotPassed(Gateways.GATEWAY_14EVKAP) // @@ -1128,7 +963,9 @@ public class Testcollection { .hasNotPassed(UserTasks.WARE_VERNICHTEN) // .hasNotPassed(Gateways.GATEWAY_VERNICHTUNG_CLOSE) // .hasNotPassed(UserTasks.WARE_SPENDEN) // - .isEnded(); // + .isEnded() // + .variables() // + .contains(entry(VAR_KUNDENNUMMER, "123123123312")); // } } diff --git a/OnlineSchuhDemo/src/main/resources/backup/1636632989310.zip b/OnlineSchuhDemo/src/main/resources/backup/1636632989310.zip new file mode 100644 index 0000000000000000000000000000000000000000..63fd01fcb7e744234dc9b5a0696367e958012788 Binary files /dev/null and b/OnlineSchuhDemo/src/main/resources/backup/1636632989310.zip differ diff --git a/OnlineSchuhDemo/src/main/resources/backup/1636637866368.zip b/OnlineSchuhDemo/src/main/resources/backup/1636637866368.zip new file mode 100644 index 0000000000000000000000000000000000000000..be14658cf008db510e09957ddedcc42cc957ca00 Binary files /dev/null and b/OnlineSchuhDemo/src/main/resources/backup/1636637866368.zip differ diff --git a/OnlineSchuhDemo/src/main/resources/backup/1636645800372.zip b/OnlineSchuhDemo/src/main/resources/backup/1636645800372.zip new file mode 100644 index 0000000000000000000000000000000000000000..55d3681b4f9eca24e170146cd72954175de10917 Binary files /dev/null and b/OnlineSchuhDemo/src/main/resources/backup/1636645800372.zip differ diff --git a/OnlineSchuhDemo/src/main/resources/backup/1636646099109.zip b/OnlineSchuhDemo/src/main/resources/backup/1636646099109.zip new file mode 100644 index 0000000000000000000000000000000000000000..65391134162a9ee8cb8bbec3454eeb1e44e60ed6 Binary files /dev/null and b/OnlineSchuhDemo/src/main/resources/backup/1636646099109.zip differ diff --git a/OnlineSchuhDemo/src/main/resources/backup/1636646289337.zip b/OnlineSchuhDemo/src/main/resources/backup/1636646289337.zip new file mode 100644 index 0000000000000000000000000000000000000000..c5ec593c7be817a530016966012f4ba34c132512 Binary files /dev/null and b/OnlineSchuhDemo/src/main/resources/backup/1636646289337.zip differ diff --git a/OnlineSchuhDemo/src/test/java/de/sample/onlineschuhdemo/Testcollection.bpmn-testgen b/OnlineSchuhDemo/src/test/java/de/sample/onlineschuhdemo/Testcollection.bpmn-testgen index 8b1f8b599784767922178c7f686a34a8c457157f..799943e7a382b7f053e3f33a21194f139c9ceee3 100644 --- a/OnlineSchuhDemo/src/test/java/de/sample/onlineschuhdemo/Testcollection.bpmn-testgen +++ b/OnlineSchuhDemo/src/test/java/de/sample/onlineschuhdemo/Testcollection.bpmn-testgen @@ -155,14 +155,9 @@ with variables for Warendaten_erfassen : [ marke = "Luxury Foot" , preis = 350 ] with check : [ kundennummer == "C-123A456" , marke == "Luxury Foot" , iban == "DE12345678900000123456" , vorname == "Max" , nachname == "Mustermann" , emailGesendet == "Nein" , erstattung == true , beschaedigt == true ] with mocks : [ financialMock , customerProvider ] ; -Test casetill1 for Flow_0 -with variables for Retoure_Start : [ kundennummer = "123" , erstattung = true , beschaedigt = true ] -with check : [ kundennummer == "123" , marke == "wer" , iban == "DE80123084556" , vorname == "till" , nachname == "Brinkhus" , pakettyp == "Normalverpackung" , emailGesendet == "Ja" , firstname == "Till" , lastname == "Brinkhus" , ibanRefund == "DE80123084556" , confirmationEmailSent == "Ja" , serviceIdentifier == "getData" , preis == 1234 , erstattung == true , paket == true , beschaedigt == false ] -with mocks : [ financialMock , customerProvider ] ; - -Test casetill2 for Flow_0 -with variables for Retoure_Start : [ kundennummer = "12345" , erstattung = true , beschaedigt = true ] -with mocks : [ financialMock , customerProvider ] ; - Test TestHenninh for Flow_1 with mocks : [ Warennummer_ermitteln , customerProvider ] ; + +Test TestHenning for Flow_0 +with priority 100 +with check : [ kundennummer == "123123123312" ] with mocks : [ financialMock , customerProvider ] ; diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/bpmn/data/BPMNTestcase.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/bpmn/data/BPMNTestcase.java index 4df2c271ca64ed7c37f91ecd89563edce05ffba3..325c88590c151e7151b934dbb86ef37d78e55e6c 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/bpmn/data/BPMNTestcase.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/bpmn/data/BPMNTestcase.java @@ -1,65 +1,74 @@ -package de.fhmuenster.masterthesis.Testgenerator.bpmn.data; - -import java.util.ArrayList; -import java.util.List; - -public class BPMNTestcase { - - private String name; - private String flow; - private List<TaskVariables> taskVariableList; - private List<EndCheck> endChecks; - private List<String> mocks; - - public BPMNTestcase() { - this.taskVariableList = new ArrayList<>(); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFlow() { - return flow; - } - - public void setFlow(String flow) { - this.flow = flow; - } - - public List<TaskVariables> getTaskVariableList() { - return taskVariableList; - } - - public void setTaskVariableList(List<TaskVariables> taskVariableList) { - this.taskVariableList = taskVariableList; - } - - public void addTaskVariables(TaskVariables taskVariables) { - taskVariableList.add(taskVariables); - } - - public List<EndCheck> getEndChecks() { - return endChecks; - } - - public void setEndChecks(List<EndCheck> endChecks) { - this.endChecks = endChecks; - } - - public void addEndCheck(EndCheck endCheck) { - this.endChecks.add(endCheck); - } - - public List<String> getMocks() { - return mocks; - } - - public void setMocks(List<String> mocks) { - this.mocks = mocks; - } -} +package de.fhmuenster.masterthesis.Testgenerator.bpmn.data; + +import java.util.ArrayList; +import java.util.List; + +public class BPMNTestcase { + + private String name; + private String flow; + private List<TaskVariables> taskVariableList; + private List<EndCheck> endChecks; + private List<String> mocks; + private int priority; + + public BPMNTestcase() { + this.taskVariableList = new ArrayList<>(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFlow() { + return flow; + } + + public void setFlow(String flow) { + this.flow = flow; + } + + public List<TaskVariables> getTaskVariableList() { + return taskVariableList; + } + + public void setTaskVariableList(List<TaskVariables> taskVariableList) { + this.taskVariableList = taskVariableList; + } + + public void addTaskVariables(TaskVariables taskVariables) { + taskVariableList.add(taskVariables); + } + + public List<EndCheck> getEndChecks() { + return endChecks; + } + + public void setEndChecks(List<EndCheck> endChecks) { + this.endChecks = endChecks; + } + + public void addEndCheck(EndCheck endCheck) { + this.endChecks.add(endCheck); + } + + public List<String> getMocks() { + return mocks; + } + + public void setMocks(List<String> mocks) { + this.mocks = mocks; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } +} diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/prioritization/PrioritizationMetrics.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/prioritization/PrioritizationMetrics.java index 972745f577ffe4734860ab00ea8946f1c7bc1c56..9a8b7f25286e048c6c509339f2434e7f77b4e28d 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/prioritization/PrioritizationMetrics.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/prioritization/PrioritizationMetrics.java @@ -30,7 +30,7 @@ public class PrioritizationMetrics { * Metric 1 (m1) * @author Tim Flicke, Henning Schmeink */ - public List<Flow> m1_flowAffected(List<Flow> newFlows, List<F+low> oldFlows) { + public List<Flow> m1_flowAffected(List<Flow> newFlows, List<Flow> oldFlows) { List<Flow> affectedFlows = new ArrayList<Flow>(); try diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/dto/BPMNTestcaseDTO.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/dto/BPMNTestcaseDTO.java index 3e5dd3abfe78738e6ad3b2053bb208c4a938ee91..a5f29b5c1d26d5b4e8fa34d994287b79693b10f0 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/dto/BPMNTestcaseDTO.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/dto/BPMNTestcaseDTO.java @@ -1,57 +1,66 @@ -package de.fhmuenster.masterthesis.Testgenerator.rest.dto; - -import java.util.ArrayList; -import java.util.List; - -public class BPMNTestcaseDTO { - - private String name; - private String flow; - private List<TaskVariablesDTO> taskVariableList; - private List<EndCheckDTO> endChecks; - private List<String> mocks; - - public BPMNTestcaseDTO() { - this.taskVariableList = new ArrayList<>(); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFlow() { - return flow; - } - - public void setFlow(String flow) { - this.flow = flow; - } - - public List<TaskVariablesDTO> getTaskVariableList() { - return taskVariableList; - } - - public void setTaskVariableList(List<TaskVariablesDTO> taskVariableList) { - this.taskVariableList = taskVariableList; - } - - public List<EndCheckDTO> getEndChecks() { - return endChecks; - } - - public void setEndChecks(List<EndCheckDTO> endChecks) { - this.endChecks = endChecks; - } - - public List<String> getMocks() { - return mocks; - } - - public void setMocks(List<String> mocks) { - this.mocks = mocks; - } -} +package de.fhmuenster.masterthesis.Testgenerator.rest.dto; + +import java.util.ArrayList; +import java.util.List; + +public class BPMNTestcaseDTO { + + private String name; + private String flow; + private List<TaskVariablesDTO> taskVariableList; + private List<EndCheckDTO> endChecks; + private List<String> mocks; + private int priority; + + public BPMNTestcaseDTO() { + this.taskVariableList = new ArrayList<>(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFlow() { + return flow; + } + + public void setFlow(String flow) { + this.flow = flow; + } + + public List<TaskVariablesDTO> getTaskVariableList() { + return taskVariableList; + } + + public void setTaskVariableList(List<TaskVariablesDTO> taskVariableList) { + this.taskVariableList = taskVariableList; + } + + public List<EndCheckDTO> getEndChecks() { + return endChecks; + } + + public void setEndChecks(List<EndCheckDTO> endChecks) { + this.endChecks = endChecks; + } + + public List<String> getMocks() { + return mocks; + } + + public void setMocks(List<String> mocks) { + this.mocks = mocks; + } + + public int getPriority() { + return priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } +} diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/converters/TestConverter.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/converters/TestConverter.java index 4bacc7c4498dc3fad3b65df988791bfe132ca7d8..eae6d7f8aa2a06179786eb7ec8ad50a367272ded 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/converters/TestConverter.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/converters/TestConverter.java @@ -1,170 +1,173 @@ -package de.fhmuenster.masterthesis.Testgenerator.rest.service.converters; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.EndCheck; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.EndCheckCompareOperator; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.TaskVariables; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.VariableValue; -import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLObjectCreator; -import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableNotEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.EndChecks; -import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; -import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; -import de.fhmuenster.masterthesis.testgeneratorDSL.IntVariableEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.IntVariableNotEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.Mock; -import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariableEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariableNotEquals; -import de.fhmuenster.masterthesis.testgeneratorDSL.Test; -import de.fhmuenster.masterthesis.testgeneratorDSL.Variable; -import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration; -import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclarations; -import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; - -public class TestConverter { - - public static Test getTest(BPMNTestcase testcase, Flow flow, List<FlowElement> flowElements, - List<Variable> variables, List<Mock> mocks) { - List<VariableDeclarations> variableDeclarationsList = new ArrayList<>(); - for (TaskVariables entry : testcase.getTaskVariableList()) { - String taskName = entry.getTask(); - FlowElement task = getFlowElement(flowElements, taskName); - List<VariableValue> variableValues = entry.getVariableValues(); - - List<VariableDeclaration> variableDeclaration = new ArrayList<>(); - for (VariableValue variableEntry : variableValues) { - String variableName = variableEntry.getVariable(); - Object variableValue = variableEntry.getValue(); - variableDeclaration.add(VariableConverter.getVariableDeclaration(variables, variableName, variableValue)); - } - - VariableDeclarations variableDeclarations = TestgeneratorDSLObjectCreator.createVariableDeclarations(task, - variableDeclaration); - variableDeclarationsList.add(variableDeclarations); - } - - List<de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck> endChecks = new ArrayList<>(); - for (EndCheck endCheck : testcase.getEndChecks()) { - if(EndCheckCompareOperator.EQUALS.equals(endCheck.getCompareOperator())) { - String variableName = endCheck.getVariable(); - Object variableValue = endCheck.getValue(); - endChecks.add(VariableConverter.getVariableEquals(variables, variableName, variableValue)); - } - - if(EndCheckCompareOperator.NOT_EQUALS.equals(endCheck.getCompareOperator())) { - String variableName = endCheck.getVariable(); - Object variableValue = endCheck.getValue(); - endChecks.add(VariableConverter.getVariableNotEquals(variables, variableName, variableValue)); - } - } - - EndChecks endCheckDeclaration = TestgeneratorDSLObjectCreator.createEndChecks(endChecks); - - return TestgeneratorDSLObjectCreator.createTest(testcase.getName(), flow, variableDeclarationsList, endCheckDeclaration, mocks); - } - - public static FlowElement getFlowElement(List<FlowElement> flowElements, String name) { - Optional<FlowElement> flowElementOpt = flowElements.stream() // - .filter(flowElement -> flowElement.getName().equals(name)) // - .findAny(); - - return flowElementOpt.isPresent() ? flowElementOpt.get() : null; - } - - public static BPMNTestcase getBPMNTestcase(Test testcase) { - List<TaskVariables> taskVariableList = new ArrayList<>(); - for (VariableDeclarations variableDeclarations : TestgeneratorDSLUtils.getVariableDeclarations(testcase)) { - List<VariableValue> variableValues = new ArrayList<>(); - for (VariableDeclaration variableDeclaration : TestgeneratorDSLUtils.getVariables(variableDeclarations)) { - variableValues.add(VariableConverter.getVariableValue(variableDeclaration)); - } - - TaskVariables taskVariables = new TaskVariables(); - taskVariables.setTask(variableDeclarations.getTaskReference().getRef().getName()); - taskVariables.setVariableValues(variableValues); - taskVariableList.add(taskVariables); - } - - List<EndCheck> endCheckList = new ArrayList<>(); - for (de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck endCheck : TestgeneratorDSLUtils.getEndChecks(testcase)) { - endCheckList.add(getEndCheck(endCheck)); - } - - List<String> mocks = new ArrayList<>(); - for(Mock mock : TestgeneratorDSLUtils.getMocks(testcase)) { - mocks.add(mock.getName()); - } - - BPMNTestcase bpmnTestcase = new BPMNTestcase(); - bpmnTestcase.setName(testcase.getName()); - bpmnTestcase.setFlow(testcase.getFlowReference().getRef().getName()); - bpmnTestcase.setTaskVariableList(taskVariableList); - bpmnTestcase.setEndChecks(endCheckList); - bpmnTestcase.setMocks(mocks); - - return bpmnTestcase; - } - - private static EndCheck getEndCheck(de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck endCheck) { - EndCheck endCheckResult = new EndCheck(); - - if (endCheck instanceof StringVariableEquals) { - String name = ((StringVariableEquals) endCheck).getKey().getName(); - String value = ((StringVariableEquals) endCheck).getValue(); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); - } - - if (endCheck instanceof IntVariableEquals) { - String name = ((IntVariableEquals) endCheck).getKey().getName(); - int value = ((IntVariableEquals) endCheck).getValue(); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); - } - - if (endCheck instanceof BooleanVariableEquals) { - String name = ((BooleanVariableEquals) endCheck).getKey().getName(); - de.fhmuenster.masterthesis.testgeneratorDSL.Boolean valueDSL = ((BooleanVariableEquals) endCheck) - .getValue(); - Boolean value = TestgeneratorDSLUtils.mapDSLBoolean(valueDSL); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); - } - - if (endCheck instanceof StringVariableNotEquals) { - String name = ((StringVariableNotEquals) endCheck).getKey().getName(); - String value = ((StringVariableNotEquals) endCheck).getValue(); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); - } - - if (endCheck instanceof IntVariableNotEquals) { - String name = ((IntVariableNotEquals) endCheck).getKey().getName(); - int value = ((IntVariableNotEquals) endCheck).getValue(); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); - } - - if (endCheck instanceof BooleanVariableNotEquals) { - String name = ((BooleanVariableNotEquals) endCheck).getKey().getName(); - de.fhmuenster.masterthesis.testgeneratorDSL.Boolean valueDSL = ((BooleanVariableNotEquals) endCheck) - .getValue(); - Boolean value = TestgeneratorDSLUtils.mapDSLBoolean(valueDSL); - endCheckResult.setVariable(name); - endCheckResult.setValue(value); - endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); - } - - return endCheckResult; - } -} +package de.fhmuenster.masterthesis.Testgenerator.rest.service.converters; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.EndCheck; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.EndCheckCompareOperator; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.TaskVariables; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.VariableValue; +import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLObjectCreator; +import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableNotEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.EndChecks; +import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; +import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; +import de.fhmuenster.masterthesis.testgeneratorDSL.IntVariableEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.IntVariableNotEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.Mock; +import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariableEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariableNotEquals; +import de.fhmuenster.masterthesis.testgeneratorDSL.Test; +import de.fhmuenster.masterthesis.testgeneratorDSL.Variable; +import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration; +import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclarations; +import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; + +public class TestConverter { + + public static Test getTest(BPMNTestcase testcase, Flow flow, List<FlowElement> flowElements, + List<Variable> variables, List<Mock> mocks) { + List<VariableDeclarations> variableDeclarationsList = new ArrayList<>(); + for (TaskVariables entry : testcase.getTaskVariableList()) { + String taskName = entry.getTask(); + FlowElement task = getFlowElement(flowElements, taskName); + List<VariableValue> variableValues = entry.getVariableValues(); + + List<VariableDeclaration> variableDeclaration = new ArrayList<>(); + for (VariableValue variableEntry : variableValues) { + String variableName = variableEntry.getVariable(); + Object variableValue = variableEntry.getValue(); + variableDeclaration.add(VariableConverter.getVariableDeclaration(variables, variableName, variableValue)); + } + + VariableDeclarations variableDeclarations = TestgeneratorDSLObjectCreator.createVariableDeclarations(task, + variableDeclaration); + variableDeclarationsList.add(variableDeclarations); + } + + List<de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck> endChecks = new ArrayList<>(); + for (EndCheck endCheck : testcase.getEndChecks()) { + if(EndCheckCompareOperator.EQUALS.equals(endCheck.getCompareOperator())) { + String variableName = endCheck.getVariable(); + Object variableValue = endCheck.getValue(); + endChecks.add(VariableConverter.getVariableEquals(variables, variableName, variableValue)); + } + + if(EndCheckCompareOperator.NOT_EQUALS.equals(endCheck.getCompareOperator())) { + String variableName = endCheck.getVariable(); + Object variableValue = endCheck.getValue(); + endChecks.add(VariableConverter.getVariableNotEquals(variables, variableName, variableValue)); + } + } + + EndChecks endCheckDeclaration = TestgeneratorDSLObjectCreator.createEndChecks(endChecks); + + // @Tim, @Henning Priorität hier hinzufügen + int prio = 100; + return TestgeneratorDSLObjectCreator.createTest(testcase.getName(), flow, variableDeclarationsList, endCheckDeclaration, mocks, prio); + } + + public static FlowElement getFlowElement(List<FlowElement> flowElements, String name) { + Optional<FlowElement> flowElementOpt = flowElements.stream() // + .filter(flowElement -> flowElement.getName().equals(name)) // + .findAny(); + + return flowElementOpt.isPresent() ? flowElementOpt.get() : null; + } + + public static BPMNTestcase getBPMNTestcase(Test testcase) { + List<TaskVariables> taskVariableList = new ArrayList<>(); + for (VariableDeclarations variableDeclarations : TestgeneratorDSLUtils.getVariableDeclarations(testcase)) { + List<VariableValue> variableValues = new ArrayList<>(); + for (VariableDeclaration variableDeclaration : TestgeneratorDSLUtils.getVariables(variableDeclarations)) { + variableValues.add(VariableConverter.getVariableValue(variableDeclaration)); + } + + TaskVariables taskVariables = new TaskVariables(); + taskVariables.setTask(variableDeclarations.getTaskReference().getRef().getName()); + taskVariables.setVariableValues(variableValues); + taskVariableList.add(taskVariables); + } + + List<EndCheck> endCheckList = new ArrayList<>(); + for (de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck endCheck : TestgeneratorDSLUtils.getEndChecks(testcase)) { + endCheckList.add(getEndCheck(endCheck)); + } + + List<String> mocks = new ArrayList<>(); + for(Mock mock : TestgeneratorDSLUtils.getMocks(testcase)) { + mocks.add(mock.getName()); + } + + BPMNTestcase bpmnTestcase = new BPMNTestcase(); + bpmnTestcase.setName(testcase.getName()); + bpmnTestcase.setFlow(testcase.getFlowReference().getRef().getName()); + bpmnTestcase.setTaskVariableList(taskVariableList); + bpmnTestcase.setEndChecks(endCheckList); + bpmnTestcase.setMocks(mocks); + bpmnTestcase.setPriority(testcase.getPriority()); + + return bpmnTestcase; + } + + private static EndCheck getEndCheck(de.fhmuenster.masterthesis.testgeneratorDSL.EndCheck endCheck) { + EndCheck endCheckResult = new EndCheck(); + + if (endCheck instanceof StringVariableEquals) { + String name = ((StringVariableEquals) endCheck).getKey().getName(); + String value = ((StringVariableEquals) endCheck).getValue(); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); + } + + if (endCheck instanceof IntVariableEquals) { + String name = ((IntVariableEquals) endCheck).getKey().getName(); + int value = ((IntVariableEquals) endCheck).getValue(); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); + } + + if (endCheck instanceof BooleanVariableEquals) { + String name = ((BooleanVariableEquals) endCheck).getKey().getName(); + de.fhmuenster.masterthesis.testgeneratorDSL.Boolean valueDSL = ((BooleanVariableEquals) endCheck) + .getValue(); + Boolean value = TestgeneratorDSLUtils.mapDSLBoolean(valueDSL); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.EQUALS); + } + + if (endCheck instanceof StringVariableNotEquals) { + String name = ((StringVariableNotEquals) endCheck).getKey().getName(); + String value = ((StringVariableNotEquals) endCheck).getValue(); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); + } + + if (endCheck instanceof IntVariableNotEquals) { + String name = ((IntVariableNotEquals) endCheck).getKey().getName(); + int value = ((IntVariableNotEquals) endCheck).getValue(); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); + } + + if (endCheck instanceof BooleanVariableNotEquals) { + String name = ((BooleanVariableNotEquals) endCheck).getKey().getName(); + de.fhmuenster.masterthesis.testgeneratorDSL.Boolean valueDSL = ((BooleanVariableNotEquals) endCheck) + .getValue(); + Boolean value = TestgeneratorDSLUtils.mapDSLBoolean(valueDSL); + endCheckResult.setVariable(name); + endCheckResult.setValue(value); + endCheckResult.setCompareOperator(EndCheckCompareOperator.NOT_EQUALS); + } + + return endCheckResult; + } +} diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestController.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestController.java index 5a16edc0e992a02ccf6509dc5a9e025621b692a4..a40128a5c33ca7a149e31a1f5c6139b190d11a72 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestController.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestController.java @@ -1,143 +1,146 @@ -package de.fhmuenster.masterthesis.Testgenerator.rest.service.test; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; - -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNServiceWithMocks; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.BPMNTestcaseDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.ExternalTopicWithMockDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.FlowElementEnhancedDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.FlowInfoDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.LoopDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.ServiceWithMockDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.dto.VariableProposalDTO; -import de.fhmuenster.masterthesis.Testgenerator.rest.mapper.ObjectMapper; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.flow.FlowService; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.mock.MockService; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.Project; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectService; -import de.fhmuenster.masterthesis.serialization.VariableProposal; -import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; -import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; -import de.fhmuenster.masterthesis.testgeneratorDSL.Loop; - -@RestController -@EnableWebMvc -public class TestController { - - @Autowired - private ProjectService projectService; - @Autowired - private FlowService flowService; - @Autowired - private TestService testService; - @Autowired - private MockService mockService; - - private static final ObjectMapper MAPPER = new ObjectMapper() // - .withVariableConverter() // - .withCompareOperatorConverter(); // - - public TestController() { - } - - @RequestMapping(path = "/project/{projectId}/initLoop", method = RequestMethod.POST) - public List<LoopDTO> initLoops(@PathVariable(required = true) Long projectId) { - Project projectForId = projectService.getProjectForId(projectId); - - List<Loop> loops = testService.initLoops(projectForId); - - return MAPPER.mapToList(loops, LoopDTO.class); - } - - @RequestMapping(path = "/project/{projectId}/initTest", method = RequestMethod.POST) - public void initTestcollection(@PathVariable(required = true) Long projectId) { - Project projectForId = projectService.getProjectForId(projectId); - - testService.initTestcollection(projectForId); - } - - @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.PUT) - public void updateTest(@PathVariable(required = true) Long projectId, @PathVariable(required = true) String testId, - @RequestBody(required = true) BPMNTestcaseDTO testcaseDTO) { - Project projectForId = projectService.getProjectForId(projectId); - - BPMNTestcase testcase = MAPPER.map(testcaseDTO, BPMNTestcase.class); - - testService.updateTest(testId, testcase, projectForId.getProjectDirectories()); - } - - @RequestMapping(path = "/project/{projectId}/test", method = RequestMethod.POST) - public void addTest(@PathVariable(required = true) Long projectId, - @RequestBody(required = true) BPMNTestcaseDTO testcaseDTO) { - Project projectForId = projectService.getProjectForId(projectId); - - BPMNTestcase testcase = MAPPER.map(testcaseDTO, BPMNTestcase.class); - - testService.addTest(testcase, projectForId.getProjectDirectories()); - } - - @RequestMapping(path = "/project/{projectId}/flow/{flowId}/test", method = RequestMethod.GET) - public List<BPMNTestcaseDTO> getTests(@PathVariable(required = true) Long projectId, - @PathVariable(required = true) String flowId) { - Project projectForId = projectService.getProjectForId(projectId); - - Flow flow = flowService.getFlow(projectForId.getProjectDirectories(), flowId); - List<BPMNTestcase> tests = testService.getTests(projectForId.getProjectDirectories(), flow); - - List<BPMNTestcaseDTO> dtos = MAPPER.mapToList(tests, BPMNTestcaseDTO.class); - return dtos; - } - - @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.GET) - public BPMNTestcaseDTO getTest(@PathVariable(required = true) Long projectId, - @PathVariable(required = true) String testId) { - Project projectForId = projectService.getProjectForId(projectId); - - BPMNTestcase test = testService.getTest(projectForId.getProjectDirectories(), testId); - return MAPPER.map(test, BPMNTestcaseDTO.class); - } - - @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.DELETE) - public void deleteTest(@PathVariable(required = true) Long projectId, - @PathVariable(required = true) String testId) { - Project projectForId = projectService.getProjectForId(projectId); - - testService.deleteTest(projectForId.getProjectDirectories(), testId); - } - - @SuppressWarnings("rawtypes") - @RequestMapping(path = "/project/{projectId}/flow/{flowId}/info", method = RequestMethod.GET) - public FlowInfoDTO getInfo(@PathVariable(required = true) Long projectId, - @PathVariable(required = true) String flowId) { - Project projectForId = projectService.getProjectForId(projectId); - - Flow flow = flowService.getFlow(projectForId.getProjectDirectories(), flowId); - List<FlowElement> userInputTasks = testService.getUserInputTasks(flow); - List<FlowElementEnhancedDTO> userInputDtos = MAPPER.mapToList(userInputTasks, FlowElementEnhancedDTO.class); - - List<VariableProposal<?>> variableProposals = testService - .getVariableProposals(projectForId.getProjectDirectories()); - List<VariableProposalDTO> variableDtos = MAPPER.mapToList(variableProposals, VariableProposalDTO.class); - - BPMNServiceWithMocks servicesWithMocks = mockService.getServicesWithMocks(projectForId.getProjectDirectories(), flow); - List<ServiceWithMockDTO> delegateServices = MAPPER.mapToList(servicesWithMocks.getDelegateServices(), ServiceWithMockDTO.class); - List<ExternalTopicWithMockDTO> externalTopics = MAPPER.mapToList(servicesWithMocks.getExternalTopics(), ExternalTopicWithMockDTO.class); - - FlowInfoDTO flowInfoDTO = new FlowInfoDTO(); - flowInfoDTO.setUserInputs(userInputDtos); - flowInfoDTO.setVariables(variableDtos); - flowInfoDTO.setDelegateServices(delegateServices); - flowInfoDTO.setExternalTopics(externalTopics); - - return flowInfoDTO; - } -} +package de.fhmuenster.masterthesis.Testgenerator.rest.service.test; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; + +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNServiceWithMocks; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.BPMNTestcaseDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.ExternalTopicWithMockDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.FlowElementEnhancedDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.FlowInfoDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.LoopDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.ServiceWithMockDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.dto.VariableProposalDTO; +import de.fhmuenster.masterthesis.Testgenerator.rest.mapper.ObjectMapper; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.flow.FlowService; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.mock.MockService; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.Project; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectService; +import de.fhmuenster.masterthesis.serialization.VariableProposal; +import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; +import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; +import de.fhmuenster.masterthesis.testgeneratorDSL.Loop; + +@RestController +@EnableWebMvc +public class TestController { + + @Autowired + private ProjectService projectService; + @Autowired + private FlowService flowService; + @Autowired + private TestService testService; + @Autowired + private MockService mockService; + + private static final ObjectMapper MAPPER = new ObjectMapper() // + .withVariableConverter() // + .withCompareOperatorConverter(); // + + public TestController() { + } + + @RequestMapping(path = "/project/{projectId}/initLoop", method = RequestMethod.POST) + public List<LoopDTO> initLoops(@PathVariable(required = true) Long projectId) { + Project projectForId = projectService.getProjectForId(projectId); + + List<Loop> loops = testService.initLoops(projectForId); + + return MAPPER.mapToList(loops, LoopDTO.class); + } + + @RequestMapping(path = "/project/{projectId}/initTest", method = RequestMethod.POST) + public void initTestcollection(@PathVariable(required = true) Long projectId) { + Project projectForId = projectService.getProjectForId(projectId); + + testService.initTestcollection(projectForId); + } + + @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.PUT) + public void updateTest(@PathVariable(required = true) Long projectId, @PathVariable(required = true) String testId, + @RequestBody(required = true) BPMNTestcaseDTO testcaseDTO) { + Project projectForId = projectService.getProjectForId(projectId); + + BPMNTestcase testcase = MAPPER.map(testcaseDTO, BPMNTestcase.class); + + testService.updateTest(testId, testcase, projectForId.getProjectDirectories()); + } + + @RequestMapping(path = "/project/{projectId}/test", method = RequestMethod.POST) + public void addTest(@PathVariable(required = true) Long projectId, + @RequestBody(required = true) BPMNTestcaseDTO testcaseDTO) { + Project projectForId = projectService.getProjectForId(projectId); + + BPMNTestcase testcase = MAPPER.map(testcaseDTO, BPMNTestcase.class); + + testService.addTest(testcase, projectForId.getProjectDirectories()); + } + + @RequestMapping(path = "/project/{projectId}/flow/{flowId}/test", method = RequestMethod.GET) + public List<BPMNTestcaseDTO> getTests(@PathVariable(required = true) Long projectId, + @PathVariable(required = true) String flowId) { + Project projectForId = projectService.getProjectForId(projectId); + + Flow flow = flowService.getFlow(projectForId.getProjectDirectories(), flowId); + List<BPMNTestcase> tests = testService.getTests(projectForId.getProjectDirectories(), flow); + + List<BPMNTestcaseDTO> dtos = MAPPER.mapToList(tests, BPMNTestcaseDTO.class); + return dtos; + } + + @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.GET) + public BPMNTestcaseDTO getTest(@PathVariable(required = true) Long projectId, + @PathVariable(required = true) String testId) { + Project projectForId = projectService.getProjectForId(projectId); + + BPMNTestcase test = testService.getTest(projectForId.getProjectDirectories(), testId); + + // @Tim, @Henning Debug + System.out.println("Priority: " + test.getPriority()); + return MAPPER.map(test, BPMNTestcaseDTO.class); + } + + @RequestMapping(path = "/project/{projectId}/test/{testId}", method = RequestMethod.DELETE) + public void deleteTest(@PathVariable(required = true) Long projectId, + @PathVariable(required = true) String testId) { + Project projectForId = projectService.getProjectForId(projectId); + + testService.deleteTest(projectForId.getProjectDirectories(), testId); + } + + @SuppressWarnings("rawtypes") + @RequestMapping(path = "/project/{projectId}/flow/{flowId}/info", method = RequestMethod.GET) + public FlowInfoDTO getInfo(@PathVariable(required = true) Long projectId, + @PathVariable(required = true) String flowId) { + Project projectForId = projectService.getProjectForId(projectId); + + Flow flow = flowService.getFlow(projectForId.getProjectDirectories(), flowId); + List<FlowElement> userInputTasks = testService.getUserInputTasks(flow); + List<FlowElementEnhancedDTO> userInputDtos = MAPPER.mapToList(userInputTasks, FlowElementEnhancedDTO.class); + + List<VariableProposal<?>> variableProposals = testService + .getVariableProposals(projectForId.getProjectDirectories()); + List<VariableProposalDTO> variableDtos = MAPPER.mapToList(variableProposals, VariableProposalDTO.class); + + BPMNServiceWithMocks servicesWithMocks = mockService.getServicesWithMocks(projectForId.getProjectDirectories(), flow); + List<ServiceWithMockDTO> delegateServices = MAPPER.mapToList(servicesWithMocks.getDelegateServices(), ServiceWithMockDTO.class); + List<ExternalTopicWithMockDTO> externalTopics = MAPPER.mapToList(servicesWithMocks.getExternalTopics(), ExternalTopicWithMockDTO.class); + + FlowInfoDTO flowInfoDTO = new FlowInfoDTO(); + flowInfoDTO.setUserInputs(userInputDtos); + flowInfoDTO.setVariables(variableDtos); + flowInfoDTO.setDelegateServices(delegateServices); + flowInfoDTO.setExternalTopics(externalTopics); + + return flowInfoDTO; + } +} diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestService.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestService.java index 9e4f962d2d8c37bd3088e3e0214435330fa136ce..c6d365bdbea3957573d47eb1e781228c94a31079 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestService.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/rest/service/test/TestService.java @@ -1,524 +1,524 @@ -package de.fhmuenster.masterthesis.Testgenerator.rest.service.test; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -import org.camunda.bpm.model.bpmn.instance.BusinessRuleTask; -import org.camunda.bpm.model.bpmn.instance.EndEvent; -import org.camunda.bpm.model.bpmn.instance.Gateway; -import org.camunda.bpm.model.bpmn.instance.ManualTask; -import org.camunda.bpm.model.bpmn.instance.ScriptTask; -import org.camunda.bpm.model.bpmn.instance.SequenceFlow; -import org.camunda.bpm.model.bpmn.instance.ServiceTask; -import org.camunda.bpm.model.bpmn.instance.StartEvent; -import org.camunda.bpm.model.bpmn.instance.UserTask; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNBundle; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNExpressions; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFlow; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFlowSet; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFormFields; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNIOParameters; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestdata; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNExpressionScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNFlowScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableBoundaryScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableFormFieldScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableIOScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.Loop; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.LoopFrequencyAssigner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.LoopScanner; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.sese.IsElement; -import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.sese.SESEBuilder; -import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNBundle; -import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNDecisionModel; -import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNVariables; -import de.fhmuenster.masterthesis.Testgenerator.embeddedform.data.EmbeddedFormDocument; -import de.fhmuenster.masterthesis.Testgenerator.logging.LoggerProvider; -import de.fhmuenster.masterthesis.Testgenerator.logging.TestgeneratorLogger; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.converters.TestConverter; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.flow.FlowService; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.mock.MockService; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.Project; -import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectDirectories; -import de.fhmuenster.masterthesis.Testgenerator.utils.BPMNParseUtils; -import de.fhmuenster.masterthesis.Testgenerator.utils.ProjectDirectoryUtils; -import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLObjectCreator; -import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer; -import de.fhmuenster.masterthesis.serialization.VariableProposal; -import de.fhmuenster.masterthesis.testgeneratorDSL.BPMNDiagram; -import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalTopic; -import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; -import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; -import de.fhmuenster.masterthesis.testgeneratorDSL.Mock; -import de.fhmuenster.masterthesis.testgeneratorDSL.Test; -import de.fhmuenster.masterthesis.testgeneratorDSL.Variable; -import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration; -import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; - -@Service -public class TestService { - - private static final TestgeneratorLogger LOGGER = LoggerProvider.getLogger(TestService.class); - private static final String NAMESPACE_URI_BPMN = "http://camunda.org/schema/1.0/bpmn"; - - private long millisDataStart; - private long millisDataEnd; - - @Autowired - private FlowService flowService; - @Autowired - private MockService mockService; - - public TestService() { - } - - public List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> initLoops(Project project) { - Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(project.getProjectDirectories()); - String testpackage = project.getProjectDirectories().getTestPackage(); - List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops = null; - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testFilePath.toString()); - - BPMNDiagram bpmnDiagram = serializer.getBPMNDiagram("process"); - if (bpmnDiagram == null) { - BPMNBundle bpmnBundle = BPMNParseUtils.readBPMNBundle(project); - List<DMNBundle> dmnBundles = BPMNParseUtils.readDMNBundles(project); - List<EmbeddedFormDocument> embeddedFormDocuments = BPMNParseUtils.readEmbeddedFormDocuments(project); - List<DMNDecisionModel> decisionModels = BPMNParseUtils.getDecisionModels(dmnBundles); - bpmnDiagram = BPMNParseUtils.getBPMNDiagram(bpmnBundle.getProcessModel(), testpackage, decisionModels, - embeddedFormDocuments); - - // Build Single-Entry-Single-Exit-Graph - SESEBuilder seseBuilder = new SESEBuilder(bpmnBundle.getModelInstance()); - seseBuilder.buildSingleEntrySingleExit(); - List<IsElement> seseTransform = seseBuilder.getSeseTransform(); - - // Scan for loops - LoopScanner loopScanner = new LoopScanner(seseTransform); - List<Loop> loops = loopScanner.scanLoops(); - - // Set frequency for loops - LoopFrequencyAssigner frequencyAssigner = new LoopFrequencyAssigner(loops); - frequencyAssigner.assign(); - - serializer.addBPMNDiagram(bpmnDiagram); - dslLoops = flowService.getDSLLoops(loops); - dslLoops.forEach(dslLoop -> serializer.addLoop(dslLoop)); - - serializer.serialize(); - } - - } catch (IOException e) { - e.printStackTrace(); - } - - if (dslLoops == null) { - return flowService.getLoops(project.getProjectDirectories()); - } - - return dslLoops; - } - - public void initTestcollection(Project project) { - Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(project.getProjectDirectories()); - String testpackage = project.getProjectDirectories().getTestPackage(); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testFilePath.toString()); - - BPMNDiagram bpmnDiagram = serializer.getBPMNDiagram("process"); - List<FlowElement> flowElementsCheck = serializer.getFlowElements(); - - if (bpmnDiagram != null && flowElementsCheck.isEmpty()) { - BPMNBundle bpmnBundle = BPMNParseUtils.readBPMNBundle(project); - List<DMNBundle> dmnBundles = BPMNParseUtils.readDMNBundles(project); - List<EmbeddedFormDocument> embeddedFormDocuments = BPMNParseUtils.readEmbeddedFormDocuments(project); - List<DMNDecisionModel> decisionModels = BPMNParseUtils.getDecisionModels(dmnBundles); - - List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops = serializer.getLoops(); - List<Loop> loops = getLoops(dslLoops); - - // Parse different flows of process model - BPMNFlowScanner scanner = new BPMNFlowScanner(bpmnBundle.getModelInstance(), loops); - BPMNFlowSet flowSet = scanner.scanFlows(); - - if (LOGGER.isInfo()) { - millisDataStart = System.currentTimeMillis(); - } - - // Read FormFields from Events and Tasks - BPMNVariableFormFieldScanner variableScanner = new BPMNVariableFormFieldScanner(flowSet); - EmbeddedFormDocument[] embeddedArray = new EmbeddedFormDocument[embeddedFormDocuments.size()]; - variableScanner.setEmbeddedFormDocuments(embeddedFormDocuments.toArray(embeddedArray)); - variableScanner.doScan(); - BPMNFormFields formFields = variableScanner.getFormFields(); - - // Read Input/Output-Parameters - BPMNVariableIOScanner variableIOScanner = new BPMNVariableIOScanner(flowSet); - variableIOScanner.doScan(); - BPMNIOParameters bpmnIOParameters = variableIOScanner.getBpmnIOParameters(); - - // Parse conditional expressions - BPMNExpressionScanner expressionScanner = new BPMNExpressionScanner(flowSet); - expressionScanner.doScan(); - BPMNExpressions expressions = expressionScanner.getExpressions(); - - List<DMNVariables> dmnVariableList = BPMNParseUtils.getDMNVariables(dmnBundles); - - BPMNVariableBoundaryScanner boundaryScanner = new BPMNVariableBoundaryScanner(expressions, formFields, - bpmnIOParameters, dmnVariableList); - boundaryScanner.doScan(); - HashMap<String, BPMNTestdata<?>> variableTestdata = boundaryScanner.getVariableTestdata(); - - List<Variable> variables = BPMNParseUtils.getVariables(formFields, variableTestdata, bpmnIOParameters); - - if (LOGGER.isInfo()) { - millisDataEnd = System.currentTimeMillis(); - LOGGER.info("Time needed for Data-Scan: " + (millisDataEnd - millisDataStart) + " ms"); - } - - List<ExternalTopic> externalTopics = getExternalTopics(flowSet); - List<FlowElement> flowElements = getFlowElements(flowSet, variables, formFields, expressions, - bpmnIOParameters, externalTopics); - List<Flow> flows = getFlows(bpmnDiagram, flowSet, flowElements); - - flowElements.forEach(flowElement -> serializer.addFlowElement(flowElement)); - variables.forEach(var -> serializer.addVariable(var)); - externalTopics.forEach(externalTopic -> serializer.addExternalTopic(externalTopic)); - flows.forEach(flow -> serializer.addFlow(flow)); - - serializer.serialize(); - } - - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void addTest(BPMNTestcase testcase, ProjectDirectories projectDirectories) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - checkTestIdAlreadyTaken(testcase.getName(), serializer); - - addTest(testcase, serializer, projectDirectories); - - serializer.serialize(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void updateTest(String testId, BPMNTestcase testcase, ProjectDirectories projectDirectories) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - if (!testId.equals(testcase.getName())) { - checkTestIdAlreadyTaken(testcase.getName(), serializer); - } - - Test testToDelete = getTest(testId, serializer); - serializer.deleteTest(testToDelete.getName()); - - addTest(testcase, serializer, projectDirectories); - - serializer.serialize(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private void addTest(BPMNTestcase testcase, TestgeneratorDSLSerializer serializer, - ProjectDirectories projectDirectories) { - Flow flow = serializer.getFlow(testcase.getFlow()); - List<FlowElement> flowElements = serializer.getFlowElements(); - List<Variable> variables = serializer.getVariables(); - List<Mock> mocks = mockService.getMocks(testcase.getMocks(), projectDirectories); - - Test newTest = TestConverter.getTest(testcase, flow, flowElements, variables, mocks); - serializer.addTest(newTest); - } - - public List<VariableProposal<?>> getVariableProposals(ProjectDirectories projectDirectories) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - List<VariableProposal<?>> variableProposals = new ArrayList<>(); - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - variableProposals = serializer.getVariableProposals(); - } catch (IOException e) { - e.printStackTrace(); - } - - return variableProposals; - } - - public List<BPMNTestcase> getTests(ProjectDirectories projectDirectories, Flow flow) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - List<Test> testsForFlow = serializer.getTestsForFlow(flow); - List<BPMNTestcase> bpmnTestcases = new ArrayList<>(); - for (Test test : testsForFlow) { - bpmnTestcases.add(TestConverter.getBPMNTestcase(test)); - } - - return bpmnTestcases; - } catch (IOException e) { - // - } - - return null; - } - - public BPMNTestcase getTest(ProjectDirectories projectDirectories, String testId) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - Test test = getTest(testId, serializer); - - BPMNTestcase bpmnTestcase = TestConverter.getBPMNTestcase(test); - return bpmnTestcase; - } catch (IOException e) { - // - } - - return null; - } - - public void deleteTest(ProjectDirectories projectDirectories, String testId) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - - serializer.deleteTest(testId); - - serializer.serialize(); - } catch (IOException e) { - // - } - } - - public List<FlowElement> getUserInputTasks(Flow flow) { - return TestgeneratorDSLUtils.getUserInputElements(flow); - } - - public Map<String, Long> getFlowTestcount(ProjectDirectories projectDirectories) { - Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); - - try { - TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); - Map<String, Long> flowTestCount = serializer.getFlowTestCount(); - - return flowTestCount; - } catch (IOException e) { - // - } - - return new HashMap<>(); - } - - private List<FlowElement> getFlowElements(BPMNFlowSet flowSet, List<Variable> variables, BPMNFormFields formFields, - BPMNExpressions expressions, BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) { - return flowSet.getFlowElements().stream() // - .map(flowElement -> getFlowElement(flowElement, variables, formFields, expressions, bpmnIOParameters, - externalTopics)) // - .collect(Collectors.toList()); // - } - - private FlowElement getFlowElement(org.camunda.bpm.model.bpmn.instance.FlowElement flowElement, - List<Variable> variables, BPMNFormFields formFields, BPMNExpressions expressions, - BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) { - - if (flowElement instanceof StartEvent) { - List<Variable> inputVariables = filterFlowElementVariables(variables, - formFields.getVariablesForTask(flowElement.getId())); - return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), inputVariables); - } else if (flowElement instanceof EndEvent) { - return TestgeneratorDSLObjectCreator.createEndFlowElement(flowElement.getId()); - } else if (flowElement instanceof Gateway) { - return TestgeneratorDSLObjectCreator.createGatewayFlowElement(flowElement.getId()); - } else if (flowElement instanceof UserTask) { - List<String> inputVariableNames = new ArrayList<>(); - inputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId())); - inputVariableNames.addAll(formFields.getVariablesForTask(flowElement.getId())); - - List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames); - - return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables); - } else if (flowElement instanceof ManualTask) { - return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId()); - } else if (flowElement instanceof ScriptTask) { - return TestgeneratorDSLObjectCreator.createScriptTaskFlowElement(flowElement.getId()); - } else if (flowElement instanceof BusinessRuleTask) { - return TestgeneratorDSLObjectCreator.createBusinessRuleTaskFlowElement(flowElement.getId()); - } else if (flowElement instanceof ServiceTask) { - String delegate = getDelegate((ServiceTask) flowElement); - String externalTopicTextual = getExternalTopic((ServiceTask) flowElement); - ExternalTopic externalTopic = getExternalTopic(externalTopics, externalTopicTextual); - - if (delegate != null) { - return TestgeneratorDSLObjectCreator.createDelegateServiceTaskFlowElement(flowElement.getId(), - delegate); - } else if (externalTopic != null) { - List<VariableDeclaration> hardcodedVariables = BPMNParseUtils.getHardcodedVariables(flowElement.getId(), variables, - bpmnIOParameters); - return TestgeneratorDSLObjectCreator.createExternalServiceTaskFlowElement(flowElement.getId(), - externalTopic, hardcodedVariables); - } else { - throw new IncompleteFlowElementException(flowElement.getId()); - } - } else if (flowElement instanceof SequenceFlow) { - String expression = expressions.getSequenceFlowExpressionMap().get(flowElement.getId()); - return TestgeneratorDSLObjectCreator.createSequenceFlowElement(flowElement.getId(), expression); - } - - throw new UnsupportedFlowElementException(flowElement.getId()); - } - - private List<Flow> getFlows(BPMNDiagram bpmn, BPMNFlowSet flowSet, List<FlowElement> flowElements) { - return flowSet.getFlows().stream() // - .map(flow -> createFlow(bpmn, flow, flowElements)) // - .collect(Collectors.toList()); // - } - - private Flow createFlow(BPMNDiagram bpmn, BPMNFlow flow, List<FlowElement> flowElements) { - List<String> flowNodes = flow.getFlowElementIds(); - - List<FlowElement> inclFlowElements = getInclFlowElements(flowElements, flowNodes); - List<FlowElement> exclFlowElements = getExclFlowElements(flowElements, flowNodes); - return TestgeneratorDSLObjectCreator.createFlow(flow.getName(), bpmn, inclFlowElements, exclFlowElements); - } - - private List<FlowElement> getInclFlowElements(List<FlowElement> flowElements, List<String> subset) { - return subset.stream() // - .map(flowElementName -> getFlowElementByName(flowElements, flowElementName)) // - .collect(Collectors.toList()); // - } - - private List<FlowElement> getExclFlowElements(List<FlowElement> flowElements, List<String> subset) { - return flowElements.stream() // - .filter(flowElement -> !subset.contains(flowElement.getName())) // - .collect(Collectors.toList()); // - } - - private List<Variable> filterFlowElementVariables(List<Variable> allVariables, - List<String> variablesForFlowElement) { - return allVariables.stream() // - .filter(variable -> variablesForFlowElement.contains(variable.getName())) // - .collect(Collectors.toList()); // - } - - @SuppressWarnings("unchecked") - private <T extends Object> List<T> getProposals(String variable, BPMNTestdata<? extends Object> variableTestdata, - Class<T> clazz) { - return variableTestdata.getValues().stream() // - .map(value -> ((T) value)) // - .collect(Collectors.toList()); // - } - - private List<Integer> getIntProposals(String variable, BPMNTestdata<? extends Object> variableTestdata) { - return variableTestdata.getValues().stream() // - .map(value -> ((Long) value).intValue()) // - .collect(Collectors.toList()); // - } - - private void checkTestIdAlreadyTaken(String testId, TestgeneratorDSLSerializer serializer) { - Test test = serializer.getTest(testId); - - if (test != null) { - throw new TestIdAlreadyTakenException(testId); - } - } - - private Test getTest(String testId, TestgeneratorDSLSerializer serializer) { - Test test = serializer.getTest(testId); - if (test == null) { - throw new TestNotFoundException(testId); - } - - return test; - } - - private FlowElement getFlowElementByName(List<FlowElement> flowElements, String name) { - return flowElements.stream() // - .filter(flowElement -> flowElement.getName().equals(name)) // - .findFirst() // - .get(); // always present - } - - private String getDelegate(ServiceTask serviceTask) { - String delegate = serviceTask.getAttributeValueNs(NAMESPACE_URI_BPMN, "delegateExpression"); - - if (delegate != null) { - delegate = delegate.substring(2, delegate.length() - 1); - } - - return delegate; - } - - private List<ExternalTopic> getExternalTopics(BPMNFlowSet flowSet) { - return flowSet.getFlowElements().stream() // - .filter(flowElement -> flowElement instanceof ServiceTask) // - .map(serviceTask -> ((ServiceTask) serviceTask)) // - .map(serviceTask -> getExternalTopic(serviceTask)) // - .filter(externalTopicName -> externalTopicName != null) // - .distinct() // - .map(externalTopicName -> TestgeneratorDSLObjectCreator.createExternalTopic(externalTopicName)) // - .collect(Collectors.toList()); // - } - - private String getExternalTopic(ServiceTask serviceTask) { - String externalTopic = serviceTask.getAttributeValueNs(NAMESPACE_URI_BPMN, "topic"); - return externalTopic; - } - - private ExternalTopic getExternalTopic(List<ExternalTopic> externalTopics, String externalTopicTextual) { - Optional<ExternalTopic> externalTopicOpt = externalTopics.stream() // - .filter(externalTopic -> externalTopic.getName().equals(externalTopicTextual)) // - .findFirst(); - - return externalTopicOpt.isPresent() ? externalTopicOpt.get() : null; - } - - - - private List<Loop> getLoops(List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops) { - return dslLoops.stream() // - .map(dslLoop -> getLoop(dslLoop)) // - .collect(Collectors.toList()); // - } - - private Loop getLoop(de.fhmuenster.masterthesis.testgeneratorDSL.Loop dslLoop) { - Loop loop = new Loop(); - loop.setId(dslLoop.getName()); - loop.setEndId(dslLoop.getEnd()); - loop.setStartId(dslLoop.getStart()); - loop.setStartFollowerId(dslLoop.getFollower()); - loop.setComplexity(dslLoop.getComplexity()); - loop.setFrequencies(TestgeneratorDSLUtils.getFrequencies(dslLoop)); - - return loop; - } -} +package de.fhmuenster.masterthesis.Testgenerator.rest.service.test; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.camunda.bpm.model.bpmn.instance.BusinessRuleTask; +import org.camunda.bpm.model.bpmn.instance.EndEvent; +import org.camunda.bpm.model.bpmn.instance.Gateway; +import org.camunda.bpm.model.bpmn.instance.ManualTask; +import org.camunda.bpm.model.bpmn.instance.ScriptTask; +import org.camunda.bpm.model.bpmn.instance.SequenceFlow; +import org.camunda.bpm.model.bpmn.instance.ServiceTask; +import org.camunda.bpm.model.bpmn.instance.StartEvent; +import org.camunda.bpm.model.bpmn.instance.UserTask; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNBundle; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNExpressions; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFlow; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFlowSet; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNFormFields; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNIOParameters; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestcase; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.data.BPMNTestdata; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNExpressionScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNFlowScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableBoundaryScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableFormFieldScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.BPMNVariableIOScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.Loop; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.LoopFrequencyAssigner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.loop.LoopScanner; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.sese.IsElement; +import de.fhmuenster.masterthesis.Testgenerator.bpmn.processfragmentation.sese.SESEBuilder; +import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNBundle; +import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNDecisionModel; +import de.fhmuenster.masterthesis.Testgenerator.dmn.data.DMNVariables; +import de.fhmuenster.masterthesis.Testgenerator.embeddedform.data.EmbeddedFormDocument; +import de.fhmuenster.masterthesis.Testgenerator.logging.LoggerProvider; +import de.fhmuenster.masterthesis.Testgenerator.logging.TestgeneratorLogger; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.converters.TestConverter; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.flow.FlowService; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.mock.MockService; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.Project; +import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectDirectories; +import de.fhmuenster.masterthesis.Testgenerator.utils.BPMNParseUtils; +import de.fhmuenster.masterthesis.Testgenerator.utils.ProjectDirectoryUtils; +import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLObjectCreator; +import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer; +import de.fhmuenster.masterthesis.serialization.VariableProposal; +import de.fhmuenster.masterthesis.testgeneratorDSL.BPMNDiagram; +import de.fhmuenster.masterthesis.testgeneratorDSL.ExternalTopic; +import de.fhmuenster.masterthesis.testgeneratorDSL.Flow; +import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElement; +import de.fhmuenster.masterthesis.testgeneratorDSL.Mock; +import de.fhmuenster.masterthesis.testgeneratorDSL.Test; +import de.fhmuenster.masterthesis.testgeneratorDSL.Variable; +import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration; +import de.fhmuenster.masterthesis.utils.TestgeneratorDSLUtils; + +@Service +public class TestService { + + private static final TestgeneratorLogger LOGGER = LoggerProvider.getLogger(TestService.class); + private static final String NAMESPACE_URI_BPMN = "http://camunda.org/schema/1.0/bpmn"; + + private long millisDataStart; + private long millisDataEnd; + + @Autowired + private FlowService flowService; + @Autowired + private MockService mockService; + + public TestService() { + } + + public List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> initLoops(Project project) { + Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(project.getProjectDirectories()); + String testpackage = project.getProjectDirectories().getTestPackage(); + List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops = null; + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testFilePath.toString()); + + BPMNDiagram bpmnDiagram = serializer.getBPMNDiagram("process"); + if (bpmnDiagram == null) { + BPMNBundle bpmnBundle = BPMNParseUtils.readBPMNBundle(project); + List<DMNBundle> dmnBundles = BPMNParseUtils.readDMNBundles(project); + List<EmbeddedFormDocument> embeddedFormDocuments = BPMNParseUtils.readEmbeddedFormDocuments(project); + List<DMNDecisionModel> decisionModels = BPMNParseUtils.getDecisionModels(dmnBundles); + bpmnDiagram = BPMNParseUtils.getBPMNDiagram(bpmnBundle.getProcessModel(), testpackage, decisionModels, + embeddedFormDocuments); + + // Build Single-Entry-Single-Exit-Graph + SESEBuilder seseBuilder = new SESEBuilder(bpmnBundle.getModelInstance()); + seseBuilder.buildSingleEntrySingleExit(); + List<IsElement> seseTransform = seseBuilder.getSeseTransform(); + + // Scan for loops + LoopScanner loopScanner = new LoopScanner(seseTransform); + List<Loop> loops = loopScanner.scanLoops(); + + // Set frequency for loops + LoopFrequencyAssigner frequencyAssigner = new LoopFrequencyAssigner(loops); + frequencyAssigner.assign(); + + serializer.addBPMNDiagram(bpmnDiagram); + dslLoops = flowService.getDSLLoops(loops); + dslLoops.forEach(dslLoop -> serializer.addLoop(dslLoop)); + + serializer.serialize(); + } + + } catch (IOException e) { + e.printStackTrace(); + } + + if (dslLoops == null) { + return flowService.getLoops(project.getProjectDirectories()); + } + + return dslLoops; + } + + public void initTestcollection(Project project) { + Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(project.getProjectDirectories()); + String testpackage = project.getProjectDirectories().getTestPackage(); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testFilePath.toString()); + + BPMNDiagram bpmnDiagram = serializer.getBPMNDiagram("process"); + List<FlowElement> flowElementsCheck = serializer.getFlowElements(); + + if (bpmnDiagram != null && flowElementsCheck.isEmpty()) { + BPMNBundle bpmnBundle = BPMNParseUtils.readBPMNBundle(project); + List<DMNBundle> dmnBundles = BPMNParseUtils.readDMNBundles(project); + List<EmbeddedFormDocument> embeddedFormDocuments = BPMNParseUtils.readEmbeddedFormDocuments(project); + List<DMNDecisionModel> decisionModels = BPMNParseUtils.getDecisionModels(dmnBundles); + + List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops = serializer.getLoops(); + List<Loop> loops = getLoops(dslLoops); + + // Parse different flows of process model + BPMNFlowScanner scanner = new BPMNFlowScanner(bpmnBundle.getModelInstance(), loops); + BPMNFlowSet flowSet = scanner.scanFlows(); + + if (LOGGER.isInfo()) { + millisDataStart = System.currentTimeMillis(); + } + + // Read FormFields from Events and Tasks + BPMNVariableFormFieldScanner variableScanner = new BPMNVariableFormFieldScanner(flowSet); + EmbeddedFormDocument[] embeddedArray = new EmbeddedFormDocument[embeddedFormDocuments.size()]; + variableScanner.setEmbeddedFormDocuments(embeddedFormDocuments.toArray(embeddedArray)); + variableScanner.doScan(); + BPMNFormFields formFields = variableScanner.getFormFields(); + + // Read Input/Output-Parameters + BPMNVariableIOScanner variableIOScanner = new BPMNVariableIOScanner(flowSet); + variableIOScanner.doScan(); + BPMNIOParameters bpmnIOParameters = variableIOScanner.getBpmnIOParameters(); + + // Parse conditional expressions + BPMNExpressionScanner expressionScanner = new BPMNExpressionScanner(flowSet); + expressionScanner.doScan(); + BPMNExpressions expressions = expressionScanner.getExpressions(); + + List<DMNVariables> dmnVariableList = BPMNParseUtils.getDMNVariables(dmnBundles); + + BPMNVariableBoundaryScanner boundaryScanner = new BPMNVariableBoundaryScanner(expressions, formFields, + bpmnIOParameters, dmnVariableList); + boundaryScanner.doScan(); + HashMap<String, BPMNTestdata<?>> variableTestdata = boundaryScanner.getVariableTestdata(); + + List<Variable> variables = BPMNParseUtils.getVariables(formFields, variableTestdata, bpmnIOParameters); + + if (LOGGER.isInfo()) { + millisDataEnd = System.currentTimeMillis(); + LOGGER.info("Time needed for Data-Scan: " + (millisDataEnd - millisDataStart) + " ms"); + } + + List<ExternalTopic> externalTopics = getExternalTopics(flowSet); + List<FlowElement> flowElements = getFlowElements(flowSet, variables, formFields, expressions, + bpmnIOParameters, externalTopics); + List<Flow> flows = getFlows(bpmnDiagram, flowSet, flowElements); + + flowElements.forEach(flowElement -> serializer.addFlowElement(flowElement)); + variables.forEach(var -> serializer.addVariable(var)); + externalTopics.forEach(externalTopic -> serializer.addExternalTopic(externalTopic)); + flows.forEach(flow -> serializer.addFlow(flow)); + + serializer.serialize(); + } + + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void addTest(BPMNTestcase testcase, ProjectDirectories projectDirectories) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + checkTestIdAlreadyTaken(testcase.getName(), serializer); + + addTest(testcase, serializer, projectDirectories); + + serializer.serialize(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void updateTest(String testId, BPMNTestcase testcase, ProjectDirectories projectDirectories) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + if (!testId.equals(testcase.getName())) { + checkTestIdAlreadyTaken(testcase.getName(), serializer); + } + + Test testToDelete = getTest(testId, serializer); + serializer.deleteTest(testToDelete.getName()); + + addTest(testcase, serializer, projectDirectories); + + serializer.serialize(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void addTest(BPMNTestcase testcase, TestgeneratorDSLSerializer serializer, + ProjectDirectories projectDirectories) { + Flow flow = serializer.getFlow(testcase.getFlow()); + List<FlowElement> flowElements = serializer.getFlowElements(); + List<Variable> variables = serializer.getVariables(); + List<Mock> mocks = mockService.getMocks(testcase.getMocks(), projectDirectories); + Test newTest = TestConverter.getTest(testcase, flow, flowElements, variables, mocks); + + serializer.addTest(newTest); + } + + public List<VariableProposal<?>> getVariableProposals(ProjectDirectories projectDirectories) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + List<VariableProposal<?>> variableProposals = new ArrayList<>(); + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + variableProposals = serializer.getVariableProposals(); + } catch (IOException e) { + e.printStackTrace(); + } + + return variableProposals; + } + + public List<BPMNTestcase> getTests(ProjectDirectories projectDirectories, Flow flow) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + List<Test> testsForFlow = serializer.getTestsForFlow(flow); + List<BPMNTestcase> bpmnTestcases = new ArrayList<>(); + for (Test test : testsForFlow) { + bpmnTestcases.add(TestConverter.getBPMNTestcase(test)); + } + + return bpmnTestcases; + } catch (IOException e) { + // + } + + return null; + } + + public BPMNTestcase getTest(ProjectDirectories projectDirectories, String testId) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + Test test = getTest(testId, serializer); + + BPMNTestcase bpmnTestcase = TestConverter.getBPMNTestcase(test); + return bpmnTestcase; + } catch (IOException e) { + // + } + + return null; + } + + public void deleteTest(ProjectDirectories projectDirectories, String testId) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + + serializer.deleteTest(testId); + + serializer.serialize(); + } catch (IOException e) { + // + } + } + + public List<FlowElement> getUserInputTasks(Flow flow) { + return TestgeneratorDSLUtils.getUserInputElements(flow); + } + + public Map<String, Long> getFlowTestcount(ProjectDirectories projectDirectories) { + Path testspecificationPath = ProjectDirectoryUtils.getTestspecificationPath(projectDirectories); + + try { + TestgeneratorDSLSerializer serializer = new TestgeneratorDSLSerializer(testspecificationPath.toString()); + Map<String, Long> flowTestCount = serializer.getFlowTestCount(); + + return flowTestCount; + } catch (IOException e) { + // + } + + return new HashMap<>(); + } + + private List<FlowElement> getFlowElements(BPMNFlowSet flowSet, List<Variable> variables, BPMNFormFields formFields, + BPMNExpressions expressions, BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) { + return flowSet.getFlowElements().stream() // + .map(flowElement -> getFlowElement(flowElement, variables, formFields, expressions, bpmnIOParameters, + externalTopics)) // + .collect(Collectors.toList()); // + } + + private FlowElement getFlowElement(org.camunda.bpm.model.bpmn.instance.FlowElement flowElement, + List<Variable> variables, BPMNFormFields formFields, BPMNExpressions expressions, + BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) { + + if (flowElement instanceof StartEvent) { + List<Variable> inputVariables = filterFlowElementVariables(variables, + formFields.getVariablesForTask(flowElement.getId())); + return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), inputVariables); + } else if (flowElement instanceof EndEvent) { + return TestgeneratorDSLObjectCreator.createEndFlowElement(flowElement.getId()); + } else if (flowElement instanceof Gateway) { + return TestgeneratorDSLObjectCreator.createGatewayFlowElement(flowElement.getId()); + } else if (flowElement instanceof UserTask) { + List<String> inputVariableNames = new ArrayList<>(); + inputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId())); + inputVariableNames.addAll(formFields.getVariablesForTask(flowElement.getId())); + + List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames); + + return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables); + } else if (flowElement instanceof ManualTask) { + return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId()); + } else if (flowElement instanceof ScriptTask) { + return TestgeneratorDSLObjectCreator.createScriptTaskFlowElement(flowElement.getId()); + } else if (flowElement instanceof BusinessRuleTask) { + return TestgeneratorDSLObjectCreator.createBusinessRuleTaskFlowElement(flowElement.getId()); + } else if (flowElement instanceof ServiceTask) { + String delegate = getDelegate((ServiceTask) flowElement); + String externalTopicTextual = getExternalTopic((ServiceTask) flowElement); + ExternalTopic externalTopic = getExternalTopic(externalTopics, externalTopicTextual); + + if (delegate != null) { + return TestgeneratorDSLObjectCreator.createDelegateServiceTaskFlowElement(flowElement.getId(), + delegate); + } else if (externalTopic != null) { + List<VariableDeclaration> hardcodedVariables = BPMNParseUtils.getHardcodedVariables(flowElement.getId(), variables, + bpmnIOParameters); + return TestgeneratorDSLObjectCreator.createExternalServiceTaskFlowElement(flowElement.getId(), + externalTopic, hardcodedVariables); + } else { + throw new IncompleteFlowElementException(flowElement.getId()); + } + } else if (flowElement instanceof SequenceFlow) { + String expression = expressions.getSequenceFlowExpressionMap().get(flowElement.getId()); + return TestgeneratorDSLObjectCreator.createSequenceFlowElement(flowElement.getId(), expression); + } + + throw new UnsupportedFlowElementException(flowElement.getId()); + } + + private List<Flow> getFlows(BPMNDiagram bpmn, BPMNFlowSet flowSet, List<FlowElement> flowElements) { + return flowSet.getFlows().stream() // + .map(flow -> createFlow(bpmn, flow, flowElements)) // + .collect(Collectors.toList()); // + } + + private Flow createFlow(BPMNDiagram bpmn, BPMNFlow flow, List<FlowElement> flowElements) { + List<String> flowNodes = flow.getFlowElementIds(); + + List<FlowElement> inclFlowElements = getInclFlowElements(flowElements, flowNodes); + List<FlowElement> exclFlowElements = getExclFlowElements(flowElements, flowNodes); + return TestgeneratorDSLObjectCreator.createFlow(flow.getName(), bpmn, inclFlowElements, exclFlowElements); + } + + private List<FlowElement> getInclFlowElements(List<FlowElement> flowElements, List<String> subset) { + return subset.stream() // + .map(flowElementName -> getFlowElementByName(flowElements, flowElementName)) // + .collect(Collectors.toList()); // + } + + private List<FlowElement> getExclFlowElements(List<FlowElement> flowElements, List<String> subset) { + return flowElements.stream() // + .filter(flowElement -> !subset.contains(flowElement.getName())) // + .collect(Collectors.toList()); // + } + + private List<Variable> filterFlowElementVariables(List<Variable> allVariables, + List<String> variablesForFlowElement) { + return allVariables.stream() // + .filter(variable -> variablesForFlowElement.contains(variable.getName())) // + .collect(Collectors.toList()); // + } + + @SuppressWarnings("unchecked") + private <T extends Object> List<T> getProposals(String variable, BPMNTestdata<? extends Object> variableTestdata, + Class<T> clazz) { + return variableTestdata.getValues().stream() // + .map(value -> ((T) value)) // + .collect(Collectors.toList()); // + } + + private List<Integer> getIntProposals(String variable, BPMNTestdata<? extends Object> variableTestdata) { + return variableTestdata.getValues().stream() // + .map(value -> ((Long) value).intValue()) // + .collect(Collectors.toList()); // + } + + private void checkTestIdAlreadyTaken(String testId, TestgeneratorDSLSerializer serializer) { + Test test = serializer.getTest(testId); + + if (test != null) { + throw new TestIdAlreadyTakenException(testId); + } + } + + private Test getTest(String testId, TestgeneratorDSLSerializer serializer) { + Test test = serializer.getTest(testId); + if (test == null) { + throw new TestNotFoundException(testId); + } + + return test; + } + + private FlowElement getFlowElementByName(List<FlowElement> flowElements, String name) { + return flowElements.stream() // + .filter(flowElement -> flowElement.getName().equals(name)) // + .findFirst() // + .get(); // always present + } + + private String getDelegate(ServiceTask serviceTask) { + String delegate = serviceTask.getAttributeValueNs(NAMESPACE_URI_BPMN, "delegateExpression"); + + if (delegate != null) { + delegate = delegate.substring(2, delegate.length() - 1); + } + + return delegate; + } + + private List<ExternalTopic> getExternalTopics(BPMNFlowSet flowSet) { + return flowSet.getFlowElements().stream() // + .filter(flowElement -> flowElement instanceof ServiceTask) // + .map(serviceTask -> ((ServiceTask) serviceTask)) // + .map(serviceTask -> getExternalTopic(serviceTask)) // + .filter(externalTopicName -> externalTopicName != null) // + .distinct() // + .map(externalTopicName -> TestgeneratorDSLObjectCreator.createExternalTopic(externalTopicName)) // + .collect(Collectors.toList()); // + } + + private String getExternalTopic(ServiceTask serviceTask) { + String externalTopic = serviceTask.getAttributeValueNs(NAMESPACE_URI_BPMN, "topic"); + return externalTopic; + } + + private ExternalTopic getExternalTopic(List<ExternalTopic> externalTopics, String externalTopicTextual) { + Optional<ExternalTopic> externalTopicOpt = externalTopics.stream() // + .filter(externalTopic -> externalTopic.getName().equals(externalTopicTextual)) // + .findFirst(); + + return externalTopicOpt.isPresent() ? externalTopicOpt.get() : null; + } + + + + private List<Loop> getLoops(List<de.fhmuenster.masterthesis.testgeneratorDSL.Loop> dslLoops) { + return dslLoops.stream() // + .map(dslLoop -> getLoop(dslLoop)) // + .collect(Collectors.toList()); // + } + + private Loop getLoop(de.fhmuenster.masterthesis.testgeneratorDSL.Loop dslLoop) { + Loop loop = new Loop(); + loop.setId(dslLoop.getName()); + loop.setEndId(dslLoop.getEnd()); + loop.setStartId(dslLoop.getStart()); + loop.setStartFollowerId(dslLoop.getFollower()); + loop.setComplexity(dslLoop.getComplexity()); + loop.setFrequencies(TestgeneratorDSLUtils.getFrequencies(dslLoop)); + + return loop; + } +} diff --git a/testgenerator-web/testgenerator-web/src/app/components/test/test.component.css b/testgenerator-web/testgenerator-web/src/app/components/test/test.component.css index f74d5f59860be6711f6c5d05a77e732b6dd79d2c..4c468e72e37bc11eabba9b899cbe357e5af6f137 100644 --- a/testgenerator-web/testgenerator-web/src/app/components/test/test.component.css +++ b/testgenerator-web/testgenerator-web/src/app/components/test/test.component.css @@ -1,35 +1,39 @@ -.testgen-taskvariable-container { - margin-top: 2rem; - margin-bottom: 2rem; -} - -.testgen-testtask { - border: 2px solid #4b515d; - margin-bottom: 1rem; - padding: 1rem; - border-radius: 25px; -} - -.testgen-form-radio { - margin-top: 1.5rem; - margin-bottom: 2rem -} - -.testgen-endcheck-container { - margin-top: 2rem; - margin-bottom: 2rem; -} - -.testgen-endcheck { - border: 2px solid #4b515d; - margin-bottom: 1rem; - padding: 1rem; - border-radius: 25px; -} - -.testgen-mock-container { - border: 2px solid #4b515d; - margin-bottom: 1rem; - padding: 1rem; - border-radius: 25px; +.testgen-taskvariable-container { + margin-top: 2rem; + margin-bottom: 2rem; +} + +.testgen-testtask { + border: 2px solid #4b515d; + margin-bottom: 1rem; + padding: 1rem; + border-radius: 25px; +} + +.testgen-form-radio { + margin-top: 1.5rem; + margin-bottom: 2rem +} + +.testgen-endcheck-container { + margin-top: 2rem; + margin-bottom: 2rem; +} + +.testgen-endcheck { + border: 2px solid #4b515d; + margin-bottom: 1rem; + padding: 1rem; + border-radius: 25px; +} + +.testgen-mock-container { + border: 2px solid #4b515d; + margin-bottom: 1rem; + padding: 1rem; + border-radius: 25px; +} + +.testPrioTitle { + line-height: 28px; } \ No newline at end of file diff --git a/testgenerator-web/testgenerator-web/src/app/components/test/test.component.html b/testgenerator-web/testgenerator-web/src/app/components/test/test.component.html index 062b56e4b08ce74152cc7c51f022a51cab94c2d7..09b217d2948bdb8ff7d5ab0a06394cc6459dbec9 100644 --- a/testgenerator-web/testgenerator-web/src/app/components/test/test.component.html +++ b/testgenerator-web/testgenerator-web/src/app/components/test/test.component.html @@ -1,152 +1,159 @@ -<div class="container"> - <div class="row row mt-5"> - - <div class="col" *ngIf="!isLoading && !isTestLoading && testcase"> - <h2 class="testgen-headline-message" *ngIf="isEdit" i18n="edit test">Edit test</h2> - <h2 class="testgen-headline-message" *ngIf="!isEdit" i18n="create test">Create test</h2> - - <form [formGroup]="formGroup"> - <div class="md-form form-group"> - <input mdbInput mdbValidate type="text" class="form-control" id="name" formControlName="name"> - <label for="name" i18n="testcase name" i18n="test name">Testcase name</label> - <p class="text-danger" *ngIf="formGroup.get('name').touched && formGroup.get('name').hasError('required')" i18n="test name required">Testcase name is required.</p> - <p class="text-danger" *ngIf="formGroup.get('name').hasError('testIdTaken')" i18n="test name taken">Testcase name is already taken.</p> - </div> - - <div [formGroupName]="'mocks'" class="testgen-mock-container"> - <h3 i18n="mock header">Mocks</h3> - <div *ngFor="let delegateService of flowInfo.delegateServices; let i=index"> - <div class="form-row"> - <div class="col-md-6"> - <label for="{{delegateService.serviceName}}" i18n="mock for service">Mock for {{delegateService.serviceName}}</label> - <select class="browser-default custom-select" formControlName="{{delegateService.serviceName}}"> - <option *ngFor="let mockName of mocks.get(delegateService.serviceName); let mockIndex=index" value="{{mockName}}">{{mockName}}</option> - </select> - </div> - </div> - </div> - - <div *ngFor="let externalTopic of flowInfo.externalTopics; let i=index"> - <div class="form-row"> - <div class="col-md-6"> - <label for="{{externalTopic.externalTopicName}}" i18n="mock for topic">Mock for {{externalTopic.externalTopicName}}</label> - <select class="browser-default custom-select" formControlName="{{externalTopic.externalTopicName}}"> - <option *ngFor="let mockName of mocks.get(externalTopic.externalTopicName); let mockIndex=index" value="{{mockName}}">{{mockName}}</option> - </select> - </div> - </div> - </div> - - <div *ngIf="flowInfo.delegateServices.length == 0 && flowInfo.externalTopics.length == 0"> - <p i18n="no mocks created">No service tasks were detected for which mocks were already created.</p> - </div> - </div> - - <div formArrayName="taskVariableList"> - <div class="testgen-taskvariable-container" *ngFor="let taskVariable of testcase.taskVariableList; let i=index"> - <hr *ngIf="i > 0"> - <div class="testgen-testtask" [formGroupName]="i"> - <h3>{{taskVariable.task}}</h3> - - <div *ngFor="let variableValue of taskVariable.variableValues; let v=index"> - <!--String and Integer Fields--> - <div class="md-form form-group" *ngIf="(dataTypes.get(variableValue.variable) == 'java.lang.Integer') || dataTypes.get(variableValue.variable) == 'java.lang.String'"> - <input mdbInput mdbValidate type="number" class="form-control" id="{{variableValue.variable}}-{{i}}-{{v}}" - formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Integer'"> - <input mdbInput mdbValidate type="text" class="form-control" id="{{variableValue.variable}}-{{i}}-{{v}}" - formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.String'"> - <label for="{{variableValue.variable}}-{{i}}-{{v}}">{{variableValue.variable}}</label> - <p *ngIf="getVariableProposals(variableValue.variable).proposals.length > 0" i18n="proposals">Proposals : [{{getVariableProposals(variableValue.variable) | variableProposals}}]</p> - <p *ngIf="getVariableProposals(variableValue.variable).proposals.length == 0" i18n="no proposals">No proposals</p> - </div> - - <!--Boolean Checkboxes--> - <div class="testgen-form-radio" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Boolean'"> - <label for="{{variableValue.variable}}-{{i}}-{{v}}">{{variableValue.variable}}</label> - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}Yes-{{i}}-{{v}}" - value="true" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}Yes-{{i}}-{{v}}">true</label> - </div> - - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}No-{{i}}-{{v}}" - value="false" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}No-{{i}}-{{v}}">false</label> - </div> - - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}Null-{{i}}-{{v}}" - value="null" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}Null-{{i}}-{{v}}">null</label> - </div> - </div> - </div> - </div> - </div> - </div> - - <hr> - - <div> - <div class="testgen-endcheck-container"> - <div class="testgen-endcheck"> - <h3 i18n="end check">Target-Actual-Comparison of the variables</h3> - - <div formGroupName="endChecks"> - <div *ngFor="let variableValue of testcase.endChecks; let i=index"> - - <!--String and Integer Fields--> - <div class="md-form form-group" *ngIf="(dataTypes.get(variableValue.variable) == 'java.lang.Integer') || dataTypes.get(variableValue.variable) == 'java.lang.String'"> - <input mdbInput mdbValidate type="number" class="form-control" id="{{variableValue.variable}}" - formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Integer'"> - <input mdbInput mdbValidate type="text" class="form-control" id="{{variableValue.variable}}" - formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.String'"> - <label for="{{variableValue.variable}}">{{variableValue.variable}}</label> - </div> - - <!--Boolean Checkboxes--> - <div class="testgen-form-radio" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Boolean'"> - <label for="{{variableValue.variable}}">{{variableValue.variable}}</label> - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}YesEndCheck" - value="true" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}YesEndCheck">true</label> - </div> - - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}NoEndCheck" - value="false" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}NoEndCheck">false</label> - </div> - - <div class="custom-control custom-radio"> - <input type="radio" class="custom-control-input" id="{{variableValue.variable}}NullEndCheck" - value="null" formControlName="{{variableValue.variable}}" mdbInput> - <label class="custom-control-label" for="{{variableValue.variable}}NullEndCheck">null</label> - </div> - </div> - - <select class="browser-default custom-select" formControlName="{{variableValue.variable}}Compare"> - <option value="==" [attr.selected]="variableValue.compareOperator == '==' ? 'selected' : null" i18n="equals">Equals</option> - <option value="!=" [attr.selected]="variableValue.compareOperator == '!=' ? 'selected' : null" i18n="not equals">Not equals</option> - </select> - - </div> - </div> - </div> - </div> - </div> - </form> - <div class="testgen-actionbar testgen-actionbar-right"> - <a class="btn btn-md waves-effect waves-light testgen-danger testgen-btn-rounded" [routerLink]="['../']" - *ngIf="!isEdit" i18n="cancel">Cancel</a> - <a class="btn btn-md waves-effect waves-light testgen-danger testgen-btn-rounded" [routerLink]="['../../']" - *ngIf="isEdit" i18n="cancel">Cancel</a> - <a class="btn btn-md waves-effect waves-light testgen-primary testgen-btn-rounded" (click)="save()" i18n="save testcase">Save testcase</a> - </div> - </div> - </div> -</div> - +<div class="container"> + <div class="row row mt-5"> + + <div class="col" *ngIf="!isLoading && !isTestLoading && testcase"> + <h2 class="testgen-headline-message" *ngIf="isEdit" i18n="edit test">Edit test</h2> + <h2 class="testgen-headline-message" *ngIf="!isEdit" i18n="create test">Create test</h2> + + <form [formGroup]="formGroup"> + <div class="md-form form-group"> + <div class="col"> + <input mdbInput mdbValidate type="text" class="form-control" id="name" formControlName="name"> + <label for="name" i18n="testcase name" i18n="test name">Testcase name</label> + <p class="text-danger" *ngIf="formGroup.get('name').touched && formGroup.get('name').hasError('required')" i18n="test name required">Testcase name is required.</p> + <p class="text-danger" *ngIf="formGroup.get('name').hasError('testIdTaken')" i18n="test name taken">Testcase name is already taken.</p> + </div> + <br> + <div class="col"> + <label for="priority" i18n="testcase priority">Test priority</label> + <input mdbInput type="number" class="form-control" id="priority" value="{{testcase.priority}}"> + </div> + </div> + + <div [formGroupName]="'mocks'" class="testgen-mock-container"> + <h3 i18n="mock header">Mocks</h3> + <div *ngFor="let delegateService of flowInfo.delegateServices; let i=index"> + <div class="form-row"> + <div class="col-md-6"> + <label for="{{delegateService.serviceName}}" i18n="mock for service">Mock for {{delegateService.serviceName}}</label> + <select class="browser-default custom-select" formControlName="{{delegateService.serviceName}}"> + <option *ngFor="let mockName of mocks.get(delegateService.serviceName); let mockIndex=index" value="{{mockName}}">{{mockName}}</option> + </select> + </div> + </div> + </div> + + <div *ngFor="let externalTopic of flowInfo.externalTopics; let i=index"> + <div class="form-row"> + <div class="col-md-6"> + <label for="{{externalTopic.externalTopicName}}" i18n="mock for topic">Mock for {{externalTopic.externalTopicName}}</label> + <select class="browser-default custom-select" formControlName="{{externalTopic.externalTopicName}}"> + <option *ngFor="let mockName of mocks.get(externalTopic.externalTopicName); let mockIndex=index" value="{{mockName}}">{{mockName}}</option> + </select> + </div> + </div> + </div> + + <div *ngIf="flowInfo.delegateServices.length == 0 && flowInfo.externalTopics.length == 0"> + <p i18n="no mocks created">No service tasks were detected for which mocks were already created.</p> + </div> + </div> + + <div formArrayName="taskVariableList"> + <div class="testgen-taskvariable-container" *ngFor="let taskVariable of testcase.taskVariableList; let i=index"> + <hr *ngIf="i > 0"> + <div class="testgen-testtask" [formGroupName]="i"> + <h3>{{taskVariable.task}}</h3> + + <div *ngFor="let variableValue of taskVariable.variableValues; let v=index"> + <!--String and Integer Fields--> + <div class="md-form form-group" *ngIf="(dataTypes.get(variableValue.variable) == 'java.lang.Integer') || dataTypes.get(variableValue.variable) == 'java.lang.String'"> + <input mdbInput mdbValidate type="number" class="form-control" id="{{variableValue.variable}}-{{i}}-{{v}}" + formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Integer'"> + <input mdbInput mdbValidate type="text" class="form-control" id="{{variableValue.variable}}-{{i}}-{{v}}" + formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.String'"> + <label for="{{variableValue.variable}}-{{i}}-{{v}}">{{variableValue.variable}}</label> + <p *ngIf="getVariableProposals(variableValue.variable).proposals.length > 0" i18n="proposals">Proposals : [{{getVariableProposals(variableValue.variable) | variableProposals}}]</p> + <p *ngIf="getVariableProposals(variableValue.variable).proposals.length == 0" i18n="no proposals">No proposals</p> + </div> + + <!--Boolean Checkboxes--> + <div class="testgen-form-radio" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Boolean'"> + <label for="{{variableValue.variable}}-{{i}}-{{v}}">{{variableValue.variable}}</label> + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}Yes-{{i}}-{{v}}" + value="true" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}Yes-{{i}}-{{v}}">true</label> + </div> + + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}No-{{i}}-{{v}}" + value="false" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}No-{{i}}-{{v}}">false</label> + </div> + + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}Null-{{i}}-{{v}}" + value="null" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}Null-{{i}}-{{v}}">null</label> + </div> + </div> + </div> + </div> + </div> + </div> + + <hr> + + <div> + <div class="testgen-endcheck-container"> + <div class="testgen-endcheck"> + <h3 i18n="end check">Target-Actual-Comparison of the variables</h3> + + <div formGroupName="endChecks"> + <div *ngFor="let variableValue of testcase.endChecks; let i=index"> + + <!--String and Integer Fields--> + <div class="md-form form-group" *ngIf="(dataTypes.get(variableValue.variable) == 'java.lang.Integer') || dataTypes.get(variableValue.variable) == 'java.lang.String'"> + <input mdbInput mdbValidate type="number" class="form-control" id="{{variableValue.variable}}" + formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Integer'"> + <input mdbInput mdbValidate type="text" class="form-control" id="{{variableValue.variable}}" + formControlName="{{variableValue.variable}}" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.String'"> + <label for="{{variableValue.variable}}">{{variableValue.variable}}</label> + </div> + + <!--Boolean Checkboxes--> + <div class="testgen-form-radio" *ngIf="dataTypes.get(variableValue.variable) == 'java.lang.Boolean'"> + <label for="{{variableValue.variable}}">{{variableValue.variable}}</label> + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}YesEndCheck" + value="true" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}YesEndCheck">true</label> + </div> + + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}NoEndCheck" + value="false" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}NoEndCheck">false</label> + </div> + + <div class="custom-control custom-radio"> + <input type="radio" class="custom-control-input" id="{{variableValue.variable}}NullEndCheck" + value="null" formControlName="{{variableValue.variable}}" mdbInput> + <label class="custom-control-label" for="{{variableValue.variable}}NullEndCheck">null</label> + </div> + </div> + + <select class="browser-default custom-select" formControlName="{{variableValue.variable}}Compare"> + <option value="==" [attr.selected]="variableValue.compareOperator == '==' ? 'selected' : null" i18n="equals">Equals</option> + <option value="!=" [attr.selected]="variableValue.compareOperator == '!=' ? 'selected' : null" i18n="not equals">Not equals</option> + </select> + + </div> + </div> + </div> + </div> + </div> + </form> + <div class="testgen-actionbar testgen-actionbar-right"> + <a class="btn btn-md waves-effect waves-light testgen-danger testgen-btn-rounded" [routerLink]="['../']" + *ngIf="!isEdit" i18n="cancel">Cancel</a> + <a class="btn btn-md waves-effect waves-light testgen-danger testgen-btn-rounded" [routerLink]="['../../']" + *ngIf="isEdit" i18n="cancel">Cancel</a> + <a class="btn btn-md waves-effect waves-light testgen-primary testgen-btn-rounded" (click)="save()" i18n="save testcase">Save testcase</a> + </div> + </div> + </div> +</div> + <app-loading *ngIf="isLoading"></app-loading> \ No newline at end of file