Skip to content
Snippets Groups Projects
Commit 79532522 authored by tfli's avatar tfli
Browse files

Revert "Added input and outputvariables for multiple elements"

This reverts commit ea08d765.
parent 8ad00559
No related branches found
No related tags found
No related merge requests found
Showing
with 2101 additions and 125 deletions
......@@ -2,5 +2,6 @@ package de.sample.onlineschuhdemo;
public class BusinessRuleTasks {
public static final String VERNICHTUNG_ERMITTELN = "Vernichtung_ermitteln";
}
......@@ -2,5 +2,7 @@ package de.sample.onlineschuhdemo;
public class Events {
public static final String RETOURE_START = "Retoure_Start";
public static final String RETOURE_ENDE = "Retoure_Ende";
}
......@@ -5,5 +5,47 @@ import java.util.Map;
public class ExternalServiceMockProvider {
private static final String VAR_KUNDENNUMMER = "kundennummer";
private static final String VAR_FIRSTNAME = "firstname";
private static final String VAR_LASTNAME = "lastname";
private static final String VAR_SERVICEIDENTIFIER = "serviceIdentifier";
private static final String VAR_IBAN = "iban";
private static final String VAR_IBANREFUND = "ibanRefund";
private static final String VAR_CONFIRMATIONEMAILSENT = "confirmationEmailSent";
public static final Map<String, Object> customerProvider(Map<String, Object> input) {
Map<String, Object> output = new HashMap<String, Object>();
String kundennummer = (String) input.get(VAR_KUNDENNUMMER);
if("C-123A456".equals(kundennummer)) {
output.put(VAR_FIRSTNAME, "Max");
output.put(VAR_LASTNAME, "Mustermann");
} else if("C-987A654".equals(kundennummer)) {
output.put(VAR_FIRSTNAME, "Erika");
output.put(VAR_LASTNAME, "Mustermann");
}
return output;
}
public static final Map<String, Object> financialMock(Map<String, Object> input) {
Map<String, Object> output = new HashMap<String, Object>();
String serviceIdentifier = (String) input.get(VAR_SERVICEIDENTIFIER);
String kundennummer = (String) input.get(VAR_KUNDENNUMMER);
String iban = (String) input.get(VAR_IBAN);
if("getData".equals(serviceIdentifier) && "C-123A456".equals(kundennummer)) {
output.put(VAR_IBANREFUND, "DE12345678900000123456");
} else if("getData".equals(serviceIdentifier) && "C-987A654".equals(kundennummer)) {
output.put(VAR_IBANREFUND, "DE12345678900000987654");
} else if("refund".equals(serviceIdentifier) && "DE12345678900000123456".equals(iban)) {
output.put(VAR_CONFIRMATIONEMAILSENT, "Nein");
} else if("refund".equals(serviceIdentifier)) {
output.put(VAR_CONFIRMATIONEMAILSENT, "Ja");
}
return output;
}
}
......@@ -2,5 +2,17 @@ package de.sample.onlineschuhdemo;
public class Gateways {
public static final String GATEWAY_PARALLEL_LAGER_NEUSENDUNG = "Gateway_Parallel_Lager_Neusendung";
public static final String GATEWAY_BESCHAEDIGT = "Gateway_Beschaedigt";
public static final String GATEWAY_BESCHAEDIGT_CLOSE = "Gateway_Beschaedigt_Close";
public static final String GATEWAY_NEUSENDUNG = "Gateway_Neusendung";
public static final String GATEWAY_NEUSENDUNG_CLOSED = "Gateway_Neusendung_Closed";
public static final String GATEWAY_PARALLEL_LAGER_NEUSENDUNG_CLOSED = "Gateway_Parallel_Lager_Neusendung_Closed";
public static final String GATEWAY_EINPACKUNG_FEHLERHAFT_CLOSED = "Gateway_Einpackung_Fehlerhaft_Closed";
public static final String GATEWAY_EINPACKUNG_FEHLERHAFT = "Gateway_Einpackung_Fehlerhaft";
public static final String GATEWAY_AUSPACKEN = "Gateway_Auspacken";
public static final String GATEWAY_14EVKAP = "Gateway_14evkap";
public static final String GATEWAY_VERNICHTUNG = "Gateway_Vernichtung";
public static final String GATEWAY_VERNICHTUNG_CLOSE = "Gateway_Vernichtung_Close";
}
......@@ -2,5 +2,8 @@ package de.sample.onlineschuhdemo;
public class ManualTasks {
public static final String WARE_EINSORTIEREN = "Ware_einsortieren";
public static final String WARE_AUSPACKEN_NORMAL = "Ware_auspacken_normal";
public static final String WARE_AUSPACKEN_LUXUS = "Ware_auspacken_luxus";
}
......@@ -2,5 +2,9 @@ package de.sample.onlineschuhdemo;
public class ServiceTasks {
public static final String WARENNUMMER_ERMITTELN = "Warennummer_ermitteln";
public static final String KUNDENDATEN_ERMITTELN = "Kundendaten_ermitteln";
public static final String FINANZDATEN_ERMITTELN = "Finanzdaten_ermitteln";
public static final String ERSTATTUNG = "Erstattung";
}
This diff is collapsed.
package de.sample.onlineschuhdemo;
import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.*;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.complete;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.runtimeService;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.task;
import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.withVariables;
import static org.assertj.core.api.Assertions.entry;
import static de.sample.onlineschuhdemo.TestUtils.*;
import org.apache.ibatis.logging.LogFactory;
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.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRuleBuilder;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class Testcollection {
@ClassRule
@Rule
public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();
static {
LogFactory.useSlf4jLogging();
}
@Before
public void setup() {
init(rule.getProcessEngine());
}
}
......@@ -2,5 +2,12 @@ package de.sample.onlineschuhdemo;
public class UserTasks {
public static final String MANUELLE_PRUEFUNG = "Manuelle_Pruefung";
public static final String PAKET_PACKEN = "Paket_packen";
public static final String PAKET_PRUEFEN = "Paket_pruefen";
public static final String PAKET_SENDEN = "Paket_senden";
public static final String WARENDATEN_ERFASSEN = "Warendaten_erfassen";
public static final String WARE_VERNICHTEN = "Ware_vernichten";
public static final String WARE_SPENDEN = "Ware_spenden";
}
......@@ -51,7 +51,6 @@ public class BPMNFormFields {
variableFieldMap.put(formField.getCamundaLabel(), variableFields);
}
//FYI: Hier vllt. für Contstraints in Zukunft interessant
public HashMap<String, List<BPMNFieldConstraint>> getVariableConstraints() {
return variableConstraints;
}
......
......@@ -67,16 +67,14 @@ public class MigrationService {
try {
newDSL.getFlow(fcw.getFlow().getName()).setFlag(Flag.YELLOW);
// List<FlowElement> flowElement = newDSL.getFlowElements();
// for(FlowElement fe : flowElement ) {
// fe.setFlag(Flag.GREEN);
// }
// List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
//
// for(FlowElementReference fer : fers) {
// fer.setFlag(Flag.GREEN);
// System.out.println(fer.getRef().getName());
// }
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
fer.setFlag(Flag.GREEN);
System.out.println(fer.getRef().getName());
}
//newDSL.getFlow(fcw.getFlow().getName()).getInclElements().clear();
//newDSL.getFlow(fcw.getFlow().getName()).getInclElements().replaceAll(fers);
......
......@@ -6,7 +6,6 @@ public class FlowElementEnhancedDTO {
private String name;
private List<String> inputVariables;
private List<String> outputVariables;
public FlowElementEnhancedDTO() {
}
......@@ -26,12 +25,4 @@ public class FlowElementEnhancedDTO {
public void setInputVariables(List<String> inputVariables) {
this.inputVariables = inputVariables;
}
public List<String> getOutputVariables() {
return outputVariables;
}
public void setOutputVariables(List<String> outputVariables) {
this.outputVariables = outputVariables;
}
}
......@@ -352,40 +352,23 @@ public class TestService {
BPMNIOParameters bpmnIOParameters, List<ExternalTopic> externalTopics) {
if (flowElement instanceof StartEvent) {
List<Variable> startVariables = filterFlowElementVariables(variables,
List<Variable> inputVariables = filterFlowElementVariables(variables,
formFields.getVariablesForTask(flowElement.getId()));
return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), startVariables);
// List<String> inputVariableNames = new ArrayList<>();
// inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
// List<String> outputVariableNames = new ArrayList<>();
// outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
// System.out.println("Output " + outputVariableNames.size() + " Input " + inputVariableNames.size());
// List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
// List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
// return TestgeneratorDSLObjectCreator.createStartFlowElement(flowElement.getId(), inputVariables, outputVariables);
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.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
System.out.println("Output " + outputVariableNames.size() + " Input " + inputVariableNames.size());
inputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
inputVariableNames.addAll(formFields.getVariablesForTask(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables, outputVariables, flowElement.getName());
return TestgeneratorDSLObjectCreator.createUserTaskFlowElement(flowElement.getId(), inputVariables, flowElement.getName());
} else if (flowElement instanceof ManualTask) {
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
System.out.println("Output " + outputVariableNames.size() + " Input " + inputVariableNames.size());
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId(), inputVariables, outputVariables, flowElement.getName());
return TestgeneratorDSLObjectCreator.createManualTaskFlowElement(flowElement.getId(), flowElement.getName());
} else if (flowElement instanceof ScriptTask) {
return TestgeneratorDSLObjectCreator.createScriptTaskFlowElement(flowElement.getId(), flowElement.getName());
} else if (flowElement instanceof BusinessRuleTask) {
......@@ -403,14 +386,8 @@ public class TestService {
} else if (externalTopic != null) {
List<VariableDeclaration> hardcodedVariables = BPMNParseUtils.getHardcodedVariables(flowElement.getId(), variables,
bpmnIOParameters);
List<String> inputVariableNames = new ArrayList<>();
inputVariableNames.addAll(bpmnIOParameters.getInputVariables(flowElement.getId()));
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElement.getId()));
List<Variable> inputVariables = filterFlowElementVariables(variables, inputVariableNames);
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
return TestgeneratorDSLObjectCreator.createExternalServiceTaskFlowElement(flowElement.getId(),
externalTopic, hardcodedVariables, flowElement.getName(), inputVariables, outputVariables);
externalTopic, hardcodedVariables, flowElement.getName());
} else {
throw new IncompleteFlowElementException(flowElement.getId());
}
......
......@@ -6,7 +6,6 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -142,32 +141,8 @@ public class BPMNParseUtils {
public static List<Variable> getVariables(BPMNFormFields formFields,
HashMap<String, BPMNTestdata<? extends Object>> variableTestdata, BPMNIOParameters bpmnIOParameters) {
System.out.println("============================================");
System.out.println("INSIDE VARIABLES");
HashMap<String, List<String>> inputList = bpmnIOParameters.getInputParameters();
HashMap<String, List<String>> outputList = bpmnIOParameters.getOutputParameters();
List<String> hardcodedList = bpmnIOParameters.getHardcodedInputParameters();
List<String> test = new ArrayList<String>();
System.out.println("Input Keys: ");
for(Map.Entry<String, List<String>> entry : inputList.entrySet()) {
test.addAll(entry.getValue());
System.out.println(entry.getKey() + " " + entry.getKey().getClass());
}
System.out.println("Input values: ");
for(String test2 : test) {
System.out.println(test2 + " " + test2.getClass());
}
System.out.println("Output Keys: ");
for(Map.Entry<String, List<String>> entry : outputList.entrySet()) {
test.addAll(entry.getValue());
System.out.println(entry.getKey() + " " + entry.getKey().getClass());
}
System.out.println("Output values: ");
for(String test2 : test) {
System.out.println(test2 + " " + test2.getClass());
}
List<Variable> variables = new ArrayList<>();
List<StringVariable> stringVariables = Stream.concat(Stream.concat(//
formFields.getStringVariables().stream(), //
bpmnIOParameters.getVariables().stream()), //
......@@ -176,12 +151,12 @@ public class BPMNParseUtils {
.map(s -> TestgeneratorDSLObjectCreator.createStringVariable(s,
getProposals(s, variableTestdata.get(s), String.class))) //
.collect(Collectors.toList()); //
// List<StringVariable> stringVariables = formFields.getStringVariables().stream() //
// .map(s -> TestgeneratorDSLObjectCreator.createStringVariable(s,
// getProposals(s, variableTestdata.get(s), String.class))) //
// .collect(Collectors.toList());
List<IntVariable> longVariables = Stream.concat( //
formFields.getLongVariables().stream(), //
bpmnIOParameters.getHardcodedInputParametersLong().stream() //
......@@ -189,6 +164,7 @@ public class BPMNParseUtils {
.map(i -> TestgeneratorDSLObjectCreator.createIntVariable(i,
getIntProposals(i, variableTestdata.get(i)))) //
.collect(Collectors.toList());
List<BooleanVariable> booleanVariables = Stream.concat(//
formFields.getBooleanVariables().stream(), //
bpmnIOParameters.getHardcodedInputParametersBoolean().stream() //
......@@ -196,13 +172,11 @@ public class BPMNParseUtils {
.map(b -> TestgeneratorDSLObjectCreator.createBooleanVariable(b,
getProposals(b, variableTestdata.get(b), Boolean.class))) //
.collect(Collectors.toList());
variables.addAll(stringVariables);
variables.addAll(longVariables);
variables.addAll(booleanVariables);
for(Variable var: variables) {
System.out.println(var.getName());
}
System.out.println("============================================");
return variables;
}
......@@ -283,10 +257,7 @@ public class BPMNParseUtils {
.map(entry -> VariableConverter.getVariableDeclaration(variables, entry.getKey(), entry.getValue())) //
.forEach(variableDeclaration -> hardcodedVariables.add(variableDeclaration)); //
}
System.out.println("================");
for(VariableDeclaration var: hardcodedVariables) {
System.out.println(var.getClass());
}
return hardcodedVariables;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment