Skip to content
Snippets Groups Projects
Commit e6db9c8b authored by Florian Lambers's avatar Florian Lambers
Browse files
parents 0e24475c 53765a78
No related branches found
No related tags found
No related merge requests found
Showing
with 499 additions and 378 deletions
......@@ -3,6 +3,8 @@ package de.fhmuenster.masterthesis.Testgenerator.bpmn.data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -20,6 +22,9 @@ public class BPMNIOParameters {
private HashMap<String, List<String>> innerOutputVariables = new HashMap<String, List<String>>();
private HashMap<String, List<String>> removeVariables = new HashMap<String, List<String>>();
private HashMap<String, HashMap<String, Boolean>> inputVariablesBoolean = new HashMap<String, HashMap<String, Boolean>>();
private HashMap<String, HashMap<String, String>> inputVariablesString = new HashMap<String, HashMap<String, String>>();
private HashMap<String, HashMap<String, Integer>> inputVariablesLong = new HashMap<String, HashMap<String, Integer>>();
private HashMap<String, HashMap<String, String>> hardcodedInputParametersString = new HashMap<String, HashMap<String, String>>();
private HashMap<String, HashMap<String, Long>> hardcodedInputParametersLong = new HashMap<String, HashMap<String, Long>>();
......@@ -89,24 +94,23 @@ public class BPMNIOParameters {
// Check Variable Type and create Variable if needed
if(setVarValue instanceof Integer)
{
HashMap<String, Long> existingVariables = this.hardcodedInputParametersLong.get(flowElementId);
HashMap<String, Long> variables = existingVariables != null ? existingVariables : new HashMap<>();
HashMap<String, Integer> existingVariables = this.inputVariablesLong.get(flowElementId);
HashMap<String, Integer> variables = existingVariables != null ? existingVariables : new HashMap<>();
if(!variables.containsKey(setVarName))
{
List<Integer> iValueList = new ArrayList<>();
iValueList.add((Integer) setVarValue);
TestgeneratorDSLObjectCreator.createIntVariable(setVarName, iValueList);
Long lvar = (Long) setVarValue;
variables.put(flowElementId, lvar);
variables.put(setVarName, (Integer) setVarValue);
}
this.hardcodedInputParametersLong.put(flowElementId, variables);
this.inputVariablesLong.put(flowElementId, variables);
}
else if(setVarValue instanceof Boolean)
{
HashMap<String, Boolean> existingVariables = this.hardcodedInputParametersBoolean.get(flowElementId);
HashMap<String, Boolean> existingVariables = this.inputVariablesBoolean.get(flowElementId);
HashMap<String, Boolean> variables = existingVariables != null ? existingVariables : new HashMap<>();
if(!variables.containsKey(setVarName))
......@@ -117,22 +121,22 @@ public class BPMNIOParameters {
variables.put(setVarName, (Boolean) setVarValue);
}
this.hardcodedInputParametersBoolean.put(flowElementId, variables);
this.inputVariablesBoolean.put(flowElementId, variables);
}
else if(setVarValue instanceof String)
{
List<String> existingVariables = this.outputVariables.get(flowElementId);
List<String> variables = existingVariables != null ? existingVariables : new ArrayList<>();
HashMap<String, String> existingVariables = this.inputVariablesString.get(flowElementId);
HashMap<String, String> variables = existingVariables != null ? existingVariables : new HashMap<>();
if(!variables.contains(setVarName))
if(!variables.containsKey(setVarName))
{
List<String> sList = new ArrayList<>();
sList.add((String) setVarValue);
TestgeneratorDSLObjectCreator.createStringVariable(setVarName, sList);
variables.add(setVarName);
variables.put(setVarName, (String) setVarValue);
}
this.outputVariables.put(flowElementId, variables);
this.inputVariablesString.put(flowElementId, variables);
}
}
......@@ -208,6 +212,14 @@ public class BPMNIOParameters {
this.hardcodedInputParametersString.put(flowElementId, variables);
}
public void addinputVariablesString(String flowElementId, String inputVariable, String value) {
HashMap<String, String> existingVariables = this.inputVariablesString.get(flowElementId);
HashMap<String, String> variables = existingVariables != null ? existingVariables : new HashMap<>();
variables.put(inputVariable, value);
this.inputVariablesString.put(flowElementId, variables);
}
public void addHardcodedInputParameterLong(String flowElementId, String inputVariable, Long value) {
HashMap<String, Long> existingVariables = this.hardcodedInputParametersLong.get(flowElementId);
HashMap<String, Long> variables = existingVariables != null ? existingVariables : new HashMap<>();
......@@ -216,6 +228,15 @@ public class BPMNIOParameters {
this.hardcodedInputParametersLong.put(flowElementId, variables);
}
public void addinputVariablesLong(String flowElementId, String inputVariable, Integer value) {
System.out.println("INSIDE LONG WITH: " + inputVariable + " " + value);
HashMap<String, Integer> existingVariables = this.inputVariablesLong.get(flowElementId);
HashMap<String, Integer> variables = existingVariables != null ? existingVariables : new HashMap<>();
variables.put(inputVariable, value);
this.inputVariablesLong.put(flowElementId, variables);
}
public void addHardcodedInputParameterBoolean(String flowElementId, String inputVariable, Boolean value) {
HashMap<String, Boolean> existingVariables = this.hardcodedInputParametersBoolean.get(flowElementId);
HashMap<String, Boolean> variables = existingVariables != null ? existingVariables : new HashMap<>();
......@@ -224,6 +245,14 @@ public class BPMNIOParameters {
this.hardcodedInputParametersBoolean.put(flowElementId, variables);
}
public void addinputVariablesBoolean(String flowElementId, String inputVariable, Boolean value) {
HashMap<String, Boolean> existingVariables = this.inputVariablesBoolean.get(flowElementId);
HashMap<String, Boolean> variables = existingVariables != null ? existingVariables : new HashMap<>();
variables.put(inputVariable, value);
this.inputVariablesBoolean.put(flowElementId, variables);
}
public List<String> getVariables() {
return Stream.concat(Stream.concat(inputVariables.values().stream(), outputVariables.values().stream()), innerOutputVariables.values().stream()) //
.flatMap(variableList -> variableList.stream()) //
......@@ -235,14 +264,57 @@ public class BPMNIOParameters {
return hardcodedInputParametersString.get(flowElementId);
}
public HashMap<String, String> getInputVariablesString(String flowElementId) {
return inputVariablesString.get(flowElementId);
}
public HashMap<String, Long> getHardcodedInputParametersLong(String flowElementId) {
return hardcodedInputParametersLong.get(flowElementId);
}
public HashMap<String, Integer> getInputVariablesLong(String flowElementId) {
return inputVariablesLong.get(flowElementId);
}
public HashMap<String, Boolean> getHardcodedInputParametersBoolean(String flowElementId) {
return hardcodedInputParametersBoolean.get(flowElementId);
}
public HashMap<String, Boolean> getInputVariablesBoolean(String flowElementId) {
return inputVariablesBoolean.get(flowElementId);
}
public List<String> getExpressionInputVariables(String flowElementId) {
List<String> inputVariables = new ArrayList<String>();
for (Entry<String, HashMap<String, Boolean>> entry : inputVariablesBoolean.entrySet()) {
if(flowElementId.equals(entry.getKey())) {
HashMap<String, Boolean> value = entry.getValue();
for (Entry<String, Boolean> boolEntry : value.entrySet()) {
inputVariables.add(boolEntry.getKey());
}
}
}
for (Entry<String, HashMap<String, Integer>> entry : inputVariablesLong.entrySet()) {
if(flowElementId.equals(entry.getKey())) {
HashMap<String, Integer> value = entry.getValue();
for (Entry<String, Integer> intEntry : value.entrySet()) {
inputVariables.add(intEntry.getKey());
}
}
}
for (Entry<String, HashMap<String, String>> entry : inputVariablesString.entrySet()) {
if(flowElementId.equals(entry.getKey())) {
HashMap<String, String> value = entry.getValue();
for (Entry<String, String> stringEntry : value.entrySet()) {
inputVariables.add(stringEntry.getKey());
}
}
}
return inputVariables;
}
public List<String> getHardcodedInputParametersString() {
return hardcodedInputParametersString.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
......@@ -250,6 +322,13 @@ public class BPMNIOParameters {
.collect(Collectors.toList()); //
}
public List<String> getInputVariablesString() {
return inputVariablesString.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
.distinct() //
.collect(Collectors.toList()); //
}
public List<String> getHardcodedInputParametersLong() {
return hardcodedInputParametersLong.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
......@@ -257,6 +336,13 @@ public class BPMNIOParameters {
.collect(Collectors.toList()); //
}
public List<String> getInputVariablesLong() {
return inputVariablesLong.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
.distinct() //
.collect(Collectors.toList()); //
}
public List<String> getHardcodedInputParametersBoolean() {
return hardcodedInputParametersBoolean.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
......@@ -264,6 +350,13 @@ public class BPMNIOParameters {
.collect(Collectors.toList()); //
}
public List<String> getInputVariablesBoolean() {
return inputVariablesBoolean.values().stream() //
.flatMap(parameterValueMap -> parameterValueMap.keySet().stream()) //
.distinct() //
.collect(Collectors.toList()); //
}
public List<String> getHardcodedInputParameters() {
List<String> hardcodedInputParameters = new ArrayList<>();
hardcodedInputParameters.addAll(getHardcodedInputParametersString());
......
......@@ -71,6 +71,7 @@ public class BPMNVariableBoundaryScanner {
private List<String> getStringVariables() {
List<String> stringVariables = new ArrayList<>();
stringVariables.addAll(formFields.getStringVariables());
stringVariables.addAll(bpmnIOParameters.getInputVariablesString());
stringVariables.addAll(bpmnIOParameters.getVariables());
stringVariables.addAll(bpmnIOParameters.getHardcodedInputParametersString());
......@@ -80,6 +81,7 @@ public class BPMNVariableBoundaryScanner {
private List<String> getBooleanVariables() {
List<String> booleanVariables = new ArrayList<>();
booleanVariables.addAll(formFields.getBooleanVariables());
booleanVariables.addAll(bpmnIOParameters.getInputVariablesBoolean());
booleanVariables.addAll(bpmnIOParameters.getHardcodedInputParametersBoolean());
return booleanVariables;
......@@ -88,6 +90,7 @@ public class BPMNVariableBoundaryScanner {
private List<String> getLongVariables() {
List<String> longVariables = new ArrayList<>();
longVariables.addAll(formFields.getLongVariables());
longVariables.addAll(bpmnIOParameters.getInputVariablesLong());
longVariables.addAll(bpmnIOParameters.getHardcodedInputParametersLong());
return longVariables;
......
......@@ -107,7 +107,6 @@ public class BPMNVariableFormFieldScanner {
Integer max = null;
for(Attribute a : input.attributes()) {
System.out.println(a.getKey());
if(a.getKey().equals("required")) {
variableRequired = true;
}
......@@ -136,9 +135,7 @@ public class BPMNVariableFormFieldScanner {
}
}
}
System.out.println("Scan Formfield " + variableName + " with type " + variableType + " und required: " + variableRequired + " und readonly: " + variableReadonly);
EmbeddedVariable embeddedVariable = new EmbeddedVariable();
embeddedVariable.setName(variableName.isEmpty() ? null : variableName);
embeddedVariable.setDatatype(Datatypes.of(variableType));
......
......@@ -103,7 +103,7 @@ public class MigrationService {
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
int score = this.calcScore(flow.getFlag(), flow);
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
......@@ -184,171 +184,6 @@ public class MigrationService {
this.setFlagsForStandardFlowChangeWrapper(allStandardFlowChangeWrapper, newDSL);
/*
for(FlowChangeWrapper fcw : addActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
/*
for(FlowChangeWrapper fcw : activityDeleteActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Gelöschte Tasks stehen nicht mehr in der Liste, das muss noch abgefangen werden
if(maxFlag.equals(Flag.NONE)) {
maxFlag = this.calcMaxFlag(maxFlag, this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus()));
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
/*
for(FlowChangeWrapper fcw : activityAddProcessVariableActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
/*
for(FlowChangeWrapper fcw : activityDeleteProcessVariableActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
for(FlowChangeWrapper fcw : processVariableChangeConstraintActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
......@@ -368,7 +203,7 @@ public class MigrationService {
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
int score = this.calcScore(flow.getFlag(), flow);
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
......@@ -411,7 +246,7 @@ public class MigrationService {
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
int score = this.calcScore(flow.getFlag(), flow);
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
......@@ -442,88 +277,6 @@ public class MigrationService {
}
}
/*
for(FlowChangeWrapper fcw : eventAddProcessVariableActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
/*
for(FlowChangeWrapper fcw : eventDeleteProcessVariableActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
for(FlowChangeWrapper fcw : addGatewayActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
System.out.println(fcw.getActionType() + " on Flow element " + fcw.getFlowElement().getName());
......@@ -542,7 +295,7 @@ public class MigrationService {
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
int score = this.calcScore(flow.getFlag(), flow);
flow.setScore(score);
//Die vorhandenen Tests müssen gelöscht werden, wenn ein XOR hinzugefügt wurde
......@@ -592,7 +345,7 @@ public class MigrationService {
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
int score = this.calcScore(flow.getFlag(), flow);
flow.setScore(score);
//Die vorhandenen Tests müssen gelöscht werden, wenn ein XOR hinzugefügt wurde
......@@ -624,47 +377,6 @@ public class MigrationService {
}
}
/*
for(FlowChangeWrapper fcw : activityChangeTypeActionResults) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
//Alte Flow-Flag überprüfen (könnte z.B. sein, dass activityAdd YELLOW ist und bei activityDelete kommt GREEN dazu)
//würde sonst einfach überschreiben
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flag flowFlag = this.calcMaxFlag(flow.getFlag(), maxFlag);
flow.setFlag(flowFlag);
int score = this.calcScore(flow.getFlag());
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
List<Flow> newFlows = newDSL.getFlows();
for(Flow f : newFlows) {
for(Test t : newDSL.getTestsForFlow(f)) {
t.setFlag(this.calcMaxFlag(t.getFlag(), f.getFlag()));
}
}
newDSL.serialize();
} catch (IOException e) {
//
}
}
*/
return migrationResultWrapper;
}
......@@ -1843,8 +1555,8 @@ public class MigrationService {
}
private int calcScore(Flag flag) {
int score = 0;
private int calcScore(Flag flag, Flow flow) {
int score = flow.getScore();
YamlReader yamlReader = new YamlReader();
MigrationYaml yaml = yamlReader.loadMigrationYaml();
......
......@@ -21,6 +21,7 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.FlowElementReference;
import de.fhmuenster.masterthesis.testgeneratorDSL.ManualTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.ScriptTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.SequenceFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.Test;
import de.fhmuenster.masterthesis.testgeneratorDSL.UserTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableReference;
......@@ -39,7 +40,7 @@ public class PrioritizationService {
this.newDSL = newDSL;
}
public void prioritize() {
public void prioritize() throws IOException {
Map<String, List<VariableReference>> readVariablesOldDSL, writeVariablesOldDSL, readVariablesNewDSL, writeVariablesNewDSL, removeVariablesOldDSL, removeVariablesNewDSL;
readVariablesOldDSL = this.getReadVariables(this.oldDSL);
......@@ -66,21 +67,52 @@ public class PrioritizationService {
HashMap<String, List<String>> differentRemoveVariables = this.checkDifferences(changesRemoveVariablesOLD, changesRemoveVariables);
HashMap<String, Integer> dependenciesRead = this.checkFlowsWhereVariableExists(differentReadVariables);
HashMap<String, Integer> dependenciesWrite = this.checkFlowsWhereVariableExists(differentWriteVariables);
HashMap<String, Integer> dependenciesRemove = this.checkFlowsWhereVariableExists(differentRemoveVariables);
this.sumDependencies(dependenciesRead, dependenciesWrite, dependenciesRemove);
this.dumpDependencyList(this.newDSL.getFlows());
try {
this.newDSL.serialize();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.newDSL.serialize();
HashMap<String, Integer> testPriorities = this.sumTestPriorities();
this.setTestPriorities(testPriorities);
}
private void setTestPriorities(HashMap<String, Integer> testPriorities) throws IOException
{
testPriorities.forEach((k, v) -> {
Test test = this.newDSL.getTest(k);
test.setPriority(v);
System.out.println("[PRIORITY] Set priority " + v + " for Test " + k);
});
this.newDSL.serialize();
}
private HashMap<String, Integer> sumTestPriorities() {
List<Test> tests = this.newDSL.getTests();
List<Flow> flows = this.newDSL.getFlows();
HashMap<String, Integer> testPriorities = new HashMap<>();
for(Test test : tests)
{
for(Flow flow: flows)
{
if(test.getFlowReference().getRef().getName().equals(flow.getName()))
{
int size = flow.getFlowSize();
int score = flow.getScore();
int dependency = flow.getDependency();
int finalScore = size + score + dependency;
testPriorities.put(test.getName(), finalScore);
}
}
}
return testPriorities;
}
/**
* Here, the changes of the variables are compared to the flowelements
......
package de.fhmuenster.masterthesis.Testgenerator.rest.service.change;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -86,7 +87,24 @@ public class ChangeController {
Path target = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
projectForId.getProjectDirectories().getModelPath(), this.projectService.getBackupFolderName(),
"Testcollection.bpmn-testgen");
Path checkTestcollectionOld = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
projectForId.getProjectDirectories().getModelPath(), this.projectService.getBackupFolderName(),
"Testcollection-old.bpmn-testgen");
File checkTestcollection = new File(checkTestcollectionOld.toUri());
// try {
// if(!checkTestcollection.exists()) {
// Files.move(target, target.resolveSibling("Testcollection-old.bpmn-testgen"));
// }
// else {
// Files.move(target, checkTestcollectionOld,StandardCopyOption.REPLACE_EXISTING);
// }
// }
// catch (IOException e2) {
// e2.printStackTrace();
// }
try {
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
}
......@@ -226,7 +244,7 @@ public class ChangeController {
}
}
// for (int i=0; i<newFlows.size();i++) {
// for (int i=0; i<newFlows.size();i++) {
// System.out.println(matchingFlows[i][0].getName()+" "+matchingFlows[i][1].getName());
// }
// for (int i=0; i<newFlows.size();i++) {
......
......@@ -237,12 +237,13 @@ public Flow[][] compareFlows(List<Flow> newFlows, List<Flow> oldFlows) {
}
currentNewFlow++;
}
//gehe alle neuen Flows durch
for(int checkNewFlow = 0; checkNewFlow<newFlows.size();checkNewFlow++) {
boolean decreaseNewFlowCounter =false;
int mostSimilarities = 0;
int leastDifferences = 10000;
//überprüfe, alle alten Flows, und speichere immer den am besten passenden
for(int checkOldFlow = 0; checkOldFlow<oldFlows.size();checkOldFlow++) {
//wenn alte Flow noch nicht überprüft wurde
......@@ -259,6 +260,8 @@ public Flow[][] compareFlows(List<Flow> newFlows, List<Flow> oldFlows) {
checkedFlowsOld.add(checkOldFlow);
//gehe alle weiteren neuen Flows durch, ob der am besten passende alte Flow zu dem aktuellen neuen Flow, nicht doch auch besser zu anderen neuen Flows passt
for (int i = checkNewFlow; i<newFlows.size();i++) {
// falls aktuell überprüfte Flow alt und neu Kombination die meisten Gemeinsamkeiten haben oder noch nichts in matchingFlows gespeichert wurde
......@@ -272,19 +275,19 @@ public Flow[][] compareFlows(List<Flow> newFlows, List<Flow> oldFlows) {
checkedFlowsNew.add(i);
setOtherNewFlow=true;
//da der neue Flow nochmal kontrolliert werden soll, weil
checkNewFlow--;
decreaseNewFlowCounter=true;
}
}
if(!setOtherNewFlow) matchingFlows[checkNewFlow][1] = allFlowsSimilarities[checkNewFlow][checkOldFlow].getFlow();
}
}
}
//da der aktuelle neue Flow nochmal kontrolliert werden soll, weil ein anderer neuer Flow für das beste Matching genutzt wurde
if(decreaseNewFlowCounter) checkNewFlow--;
}
// for (int i=0; i<newFlows.size();i++) {
// System.out.print(matchingFlows[i][0].getName()+" ---");
......
package de.fhmuenster.masterthesis.Testgenerator.rest.service.file;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -15,6 +24,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.Project;
import de.fhmuenster.masterthesis.Testgenerator.rest.service.project.ProjectService;
import de.fhmuenster.masterthesis.Testgenerator.utils.ProjectDirectoryUtils;
@RestController
@EnableWebMvc
......@@ -64,6 +74,180 @@ public class FileController {
return bpmnContent;
}
@RequestMapping(path = "/project/{projectId}/backup/restore", method = RequestMethod.GET)
public boolean restoreDSL(@PathVariable(required = true) Long projectId) {
Project projectForId = projectService.getProjectForId(projectId);
Path p = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
projectForId.getProjectDirectories().getModelPath(), "backup");
File directory = new File(p.toUri());
String zipToFile = directory.list()[0];
/*
* älteste ZIP Datei finden
*/
for(String file : directory.list()) {
if(file.endsWith(".zip")) {
zipToFile= file;
}
}
Path dslFilePath = ProjectDirectoryUtils.getTestspecificationPath(projectForId.getProjectDirectories());
Path source = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
projectForId.getProjectDirectories().getModelPath(), this.projectService.getBackupFolderName(),
"Testcollection.bpmn-testgen");
Path target = Paths.get(dslFilePath.toString());
// Path checkTestcollectionOld = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
// projectForId.getProjectDirectories().getModelPath(), this.projectService.getBackupFolderName(),
// "Testcollection-old.bpmn-testgen");
//
// File checkTestcollection = new File(checkTestcollectionOld.toUri());
System.out.println(source);
System.out.println(target);
try {
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
}
catch(Exception e) {
}
// try {
// if(checkTestcollection.exists()) {
// Files.move(checkTestcollectionOld, checkTestcollectionOld.resolveSibling("Testcollection.bpmn-testgen"));
// }
//
// }
// catch (IOException e2) {
// e2.printStackTrace();
// }
boolean backupSuccess = false;
return backupSuccess;
}
@RequestMapping(path = "/project/{projectId}/backup/restoreBPMN", method = RequestMethod.GET)
public boolean restoreOldBPMN(@PathVariable(required = true) Long projectId) {
Project projectForId = projectService.getProjectForId(projectId);
Path testFilePath = ProjectDirectoryUtils.getTestspecificationPath(projectForId.getProjectDirectories());
Path p = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),
projectForId.getProjectDirectories().getModelPath(), "backup");
String outputDirDSL = Paths.get(testFilePath.toString()).toString();
String outputDirBPMNBackup = p.toString();
String outputDirBPMN = Paths.get(projectForId.getProjectDirectories().getProjectRootPath().toString(),projectForId.getProjectDirectories().getModelPath().toString()).toString();
try {
/*
* löschen der alten BPMN Dateien in Ressources
*/
File directoryBPMN = new File(outputDirBPMN);
for(String file : directoryBPMN.list()) {
if(file.endsWith(".bpmn")) {
File deleteFile = new File(outputDirBPMN,file);
deleteFile.delete();
}
}
/*
* löschen der alten BPMN Dateien im Backup
*/
File directoryBPMNBackup = new File(outputDirBPMNBackup);
for(String file : directoryBPMNBackup.list()) {
if(file.endsWith(".bpmn")) {
File deleteFile = new File(outputDirBPMNBackup,file);
deleteFile.delete();
}
}
/*
* löschen der alten DSL Datei im Test Pfad
*/
File deleteDSLFile = new File(outputDirDSL);
deleteDSLFile.delete();
/*
* älteste ZIP Datei finden, damit diese entzippt werden kann,
* und die Dateien in die passenden Ordner gepackt werden können
*/
File directoryBackup = new File(p.toUri());
String latestZipFile = directoryBackup.list()[0];
for(String file : directoryBackup.list()) {
if(file.endsWith(".zip")) {
latestZipFile= file;
}
}
/*
* Entzippen der BPMN-Dateien und bpmn-testgen Dateien + verschieben in die passenden Ordner
*/
ZipFile zipFile = new ZipFile(Paths.get(p.toString(), latestZipFile).toString());
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
String entryName = entry.getName();
/*
* verschieben der entzippten BPMN Datei in den Model Path Ordner (Ressources)
*/
if(entryName.endsWith(".bpmn")) {
File entryDestinationBPMN = new File(outputDirBPMN, entry.getName());
File entryDestinationBPMNBackup = new File(outputDirBPMNBackup, entry.getName());
try (InputStream in = zipFile.getInputStream(entry);
OutputStream outBPMN = new FileOutputStream(entryDestinationBPMN);
// OutputStream outBPMNBackup = new FileOutputStream(entryDestinationBPMNBackup)
) {
IOUtils.copy(in, outBPMN);
// IOUtils.copy(in, outBPMNBackup);
}
try (InputStream in = zipFile.getInputStream(entry);
OutputStream outBPMNBackup = new FileOutputStream(entryDestinationBPMNBackup)) {
IOUtils.copy(in, outBPMNBackup);
}
/*
* verschieben der entzippten bpmn-testgen Datei in den test Path Ordner
*/
}else if(entryName.endsWith(".bpmn-testgen")) {
File entryDestinationDSL = new File(outputDirDSL);
try (InputStream in = zipFile.getInputStream(entry);
OutputStream outDSL = new FileOutputStream(entryDestinationDSL)) {
IOUtils.copy(in, outDSL);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
private String readFile(File bpmnFile) {
try {
......
......@@ -348,7 +348,7 @@ public class ProjectService {
FileOutputStream fos = new FileOutputStream(Paths.get(directory.toString(), System.currentTimeMillis() + ".zip").toString());
ZipOutputStream zipOutput = new ZipOutputStream(fos);
for(String file : directory.list()) {
if(!file.endsWith(".zip")) {
if(!file.endsWith(".zip")) {
File fileToZip = new File(Paths.get(p.toString(), file).toString());
FileInputStream fis = new FileInputStream(fileToZip);
......
......@@ -196,7 +196,7 @@ public class TestService {
BPMNVariableIOScanner variableIOScanner = new BPMNVariableIOScanner(flowSet);
variableIOScanner.doScan();
BPMNIOParameters bpmnIOParameters = variableIOScanner.getBpmnIOParameters();
// Parse conditional expressions
BPMNExpressionScanner expressionScanner = new BPMNExpressionScanner(flowSet);
expressionScanner.doScan();
......@@ -220,12 +220,12 @@ public class TestService {
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));
flows.forEach(flow -> this.calculateFlowSize(flow));
flows.forEach(flow -> this.calculateFlowSize(flow));
serializer.serialize();
}
......@@ -664,6 +664,7 @@ public class TestService {
List<Variable> readVariables = getReadVariables(flowElement.getId(), bpmnIOParameters, variables, formFields);
List<Variable> writeVariables = getWriteVariables(flowElement.getId(), bpmnIOParameters, variables);
List<Variable> removeVariables = getRemoveVariables(flowElement.getId(), bpmnIOParameters, variables);
int dependencies = inputVariables.size() + writeVariables.size();
HashMap<String, List<BPMNFieldConstraint>> allConstraintsForTask = formFields.getAllTaskSpecificConstraintsForTask(flowElement.getId());
......@@ -752,6 +753,8 @@ public class TestService {
List<Variable> readVariables = getReadVariables(flowElement.getId(), bpmnIOParameters, variables, formFields);
List<Variable> writeVariables = getWriteVariables(flowElement.getId(), bpmnIOParameters, variables);
List<Variable> removeVariables = getRemoveVariables(flowElement.getId(), bpmnIOParameters, variables);
// writeVariables.addAll(getSetVariables(flowElement.getId(), bpmnIOParameters, variables));
// System.out.println("Write Vars: " + writeVariables);
int dependencies = readVariables.size() + writeVariables.size();
return TestgeneratorDSLObjectCreator.createDelegateServiceTaskFlowElement(flowElement.getId(),
delegate, readVariables, writeVariables, flowElement.getName(), removeVariables);
......@@ -761,6 +764,8 @@ public class TestService {
List<Variable> inputVariables = getReadVariables(flowElement.getId(), bpmnIOParameters, variables, formFields);
List<Variable> outputVariables = getWriteVariables(flowElement.getId(), bpmnIOParameters, variables);
List<Variable> removeVariables = getRemoveVariables(flowElement.getId(), bpmnIOParameters, variables);
// outputVariables.addAll(getSetVariables(flowElement.getId(), bpmnIOParameters, variables));
// System.out.println("Write Vars: " + outputVariables);
int dependencies = inputVariables.size() + outputVariables.size();
return TestgeneratorDSLObjectCreator.createExternalServiceTaskFlowElement(flowElement.getId(),
externalTopic, hardcodedVariables, flowElement.getName(), inputVariables, outputVariables, removeVariables);
......@@ -829,12 +834,22 @@ public class TestService {
return inputVariables;
}
private List<Variable> getWriteVariables(String flowElementId, BPMNIOParameters bpmnIOParameters, List<Variable> variables) {
private List<Variable> getSetVariables(String flowElementId, BPMNIOParameters bpmnIOParameters, List<Variable> variables) {
List<String> outputVariableNames = new ArrayList<>();
outputVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElementId));
List<Variable> outputVariables = filterFlowElementVariables(variables, outputVariableNames);
System.out.println("Set vars: " + outputVariables);
return outputVariables;
}
private List<Variable> getWriteVariables(String flowElementId, BPMNIOParameters bpmnIOParameters, List<Variable> variables) {
List<String> writeVariableNames = new ArrayList<>();
writeVariableNames.addAll(bpmnIOParameters.getOutputVariables(flowElementId));
writeVariableNames.addAll(bpmnIOParameters.getExpressionInputVariables(flowElementId));
List<Variable> writeVariables = filterFlowElementVariables(variables, writeVariableNames);
return writeVariables;
}
private List<Flow> getFlows(BPMNDiagram bpmn, BPMNFlowSet flowSet, List<FlowElement> flowElements) {
return flowSet.getFlows().stream() //
......@@ -986,4 +1001,6 @@ public class TestService {
return removeVariables;
}
}
......@@ -157,37 +157,37 @@ public class BPMNParseUtils {
HashMap<String, List<String>> inputList = bpmnIOParameters.getInputParameters();
HashMap<String, List<String>> outputList = bpmnIOParameters.getOutputParameters();
List<String> hardcodedList = bpmnIOParameters.getHardcodedInputParameters();
List<Variable> variables = new ArrayList<>();
List<StringVariable> stringVariables = Stream.concat(Stream.concat(//
List<StringVariable> stringVariables = Stream.concat(Stream.concat(Stream.concat(//
formFields.getStringVariables().stream(), //
bpmnIOParameters.getVariables().stream()), //
bpmnIOParameters.getInputVariablesString().stream()), //
bpmnIOParameters.getHardcodedInputParametersString().stream()) //
.distinct() //
.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( //
List<IntVariable> longVariables = Stream.concat(Stream.concat( //
formFields.getLongVariables().stream(), //
bpmnIOParameters.getInputVariablesLong().stream()),
bpmnIOParameters.getHardcodedInputParametersLong().stream() //
) //
.map(i -> TestgeneratorDSLObjectCreator.createIntVariable(i,
getIntProposals(i, variableTestdata.get(i)))) //
.collect(Collectors.toList());
List<BooleanVariable> booleanVariables = Stream.concat(//
List<BooleanVariable> booleanVariables = Stream.concat(Stream.concat(//
formFields.getBooleanVariables().stream(), //
bpmnIOParameters.getHardcodedInputParametersBoolean().stream() //
bpmnIOParameters.getHardcodedInputParametersBoolean().stream()),
bpmnIOParameters.getInputVariablesBoolean().stream()//
) //
.map(b -> TestgeneratorDSLObjectCreator.createBooleanVariable(b,
getProposals(b, variableTestdata.get(b), Boolean.class))) //
.collect(Collectors.toList());
//Constraints hinzufügen
List<Constraint> constraintsToAdd = new BasicEList<>();
for(StringVariable sv : stringVariables) {
......
......@@ -36,7 +36,6 @@
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss",
"node_modules/@fortawesome/fontawesome-free/scss/solid.scss",
"node_modules/@fortawesome/fontawesome-free/scss/regular.scss",
......@@ -117,7 +116,6 @@
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css",
"src/styles.css"
],
"scripts": [],
......
......@@ -37,8 +37,8 @@ const routes: Routes = [
{ path: 'project/:projectId/mocks/external/:mockId', component: NewExternalMockComponent },
{ path: 'project/:projectId/mocks/manual', component: NewManualMockComponent },
{ path: 'project/:projectId/mocks/manual/:mockId', component: NewManualMockComponent },
{ path: 'project/:projectId/update/matchingFlows/migration', component: MigrationOverviewComponent },
{ path: 'project/:projectId/update/matchingFlows', component: MatchingFlowsComponent },
{ path: 'project/:projectId/update/migration', component: MigrationOverviewComponent },
{ path: 'project/:projectId/update/prio', component: PrioritizationOverviewComponent },
{ path: 'project/:projectId/update', component: UpdateProjectComponent }, // new Update Component
{ path: 'impressum', component: ImprintComponent },
......
......@@ -94,4 +94,3 @@
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
\ No newline at end of file
......@@ -4,9 +4,16 @@
<a [routerLink]="['../']" i18n="projects header"><i class="fas fa-angle-left"></i> Back to overview</a>
</h6>
<div class="row">
<div class="col">
<div class="col-md-6">
<p class="title" *ngIf="!isProjectLoading && actualProjectConfig" i18n="project header">Project "{{actualProjectConfig.projectName}}"</p>
</div>
<div class="col-md-6">
<div class="row ms-auto float-end">
<div class="resetBPMN">
<button type="button" class="btn btn-outline-danger" (click)="restoreDSL()" [routerLink]="['../']">switch to old DSL</button>
</div>
</div>
</div>
</div>
......@@ -23,11 +30,11 @@
<mat-accordion multi>
<mat-expansion-panel *ngFor="let flow of flowSetNew.flows" >
<mat-expansion-panel-header>
<mat-panel-titel>
</mat-panel-titel>
<mat-panel-description>
{{flow.name}}
</mat-panel-description>
</mat-expansion-panel-header>
<app-bpmn-diagram *ngIf="diagramsLoaded" [diagram]="diagram" [flow]="flow"></app-bpmn-diagram>
......@@ -42,11 +49,13 @@
<mat-accordion multi cdkDropList [cdkDropListData]="flowSetOld" *ngIf="flowSetOld" (cdkDropListDropped)="drop($event)">
<mat-expansion-panel cdkDrag *ngFor="let flow of flowSetOld" class="drag-box">
<mat-expansion-panel-header>
<mat-panel-titel>
</mat-panel-titel>
<mat-panel-description *ngIf="flow?.name; else flowEmptyTitel">
{{flow.name}}
<!-- <button type="button" class="btn-close" color="danger" aria-label="Close"></button> -->
</mat-panel-description>
<ng-template #flowEmptyTitel>
no matching flow old
......@@ -56,11 +65,17 @@
<div *ngIf="flow?.name; else flowEmptyBody">
<div class="example-custom-placeholder" *cdkDragPlaceholder></div>
<div class="row ms-auto float-end ">
<button type="button" class="btn-close" aria-label="Close" (click)="setNoMatching(flow)"></button>
</div>
<div class="row">
<app-bpmn-diagram *ngIf="diagramsLoaded" [diagram]="diagramOld" [flow]="flow"></app-bpmn-diagram>
</div>
</div>
<ng-template #flowEmptyBody>
<div>
<div class="example-custom-placeholder" *cdkDragPlaceholder></div>
<app-bpmn-diagram *ngIf="diagramsLoaded" [diagram]="diagramOld"></app-bpmn-diagram>
</div>
</ng-template>
</mat-expansion-panel>
......
......@@ -20,7 +20,7 @@ export class MatchingFlowsComponent implements OnInit {
actualProject: number;
actualProjectConfig: SingleProjectConfig;
matchingFlowSet: BPMNFlowSet;
result: MigrationResultWrapper;
migrationResult: MigrationResultWrapper;
flowSetNew: BPMNFlowSet;
flowSetOld: Array<BPMNFlow>;
flowSetOldCopy: Array<BPMNFlow>;
......@@ -44,7 +44,7 @@ export class MatchingFlowsComponent implements OnInit {
await this.getMatchingFlows();
await this.loadBPMNDiagramOld();
await this.loadBPMNDiagram();
console.log(this.flowSetOld)
}
async getMatchingFlows() {
this.isMatchingLoading = true;
......@@ -79,9 +79,14 @@ export class MatchingFlowsComponent implements OnInit {
async startMigration() {
this.matchingFlowSet.flows = this.flowSetOld;
let result = await this.migrationService.migrateMatchingFlows(this.actualProject, this.matchingFlowSet);
console.log(result)
try{
await this.migrationService.migrateMatchingFlows(this.actualProject, this.matchingFlowSet);
}
finally {
this.router.navigate([this.router.url,'migration']);
}
}
async loadBPMNDiagramOld() {
try {
......@@ -103,5 +108,16 @@ export class MatchingFlowsComponent implements OnInit {
}
}
restoreDSL(){
this.revertOldDSL();
}
async revertOldDSL(){
let result = await this.fileService.restoreOldDSL(this.actualProject);
console.log(result)
}
async setNoMatching(flow: BPMNFlow){
this.flowSetOld[this.flowSetOld.indexOf(flow)]=null;
}
}
.margin-button {
margin-top: 13px;
}
<div class="container bg-body rounded shadow-sm">
<h6 class="border-bottom pb-3 mb-0 headerTitle">
<div class="row border-bottom pb-3 mb-0">
<div class="col ">
<h6 class="headerTitle">
<a [routerLink]="['../']" i18n="projects header"><i class="fas fa-angle-left"></i> Back to overview</a>
</h6>
</div>
<div class="col margin-button">
<div class="row ms-auto float-end">
<div class="resetBPMN">
<button class="btn btn-outline-secondary" type="button" (click)="callPrio()" i18n="prio bpmn">Test Prioritization</button>
</div>
</div>
<div class="row ms-auto float-end">
<div class="resetBPMN">
<button class="btn btn-outline-info" type="button" (click)="navigateToFlowOverview()">Go to Test Overview</button>
</div>
</div>
</div>
</div>
<div class="accordion accordion-flush" id="accordionFlushExample">
<div class="accordion-item">
......@@ -14,10 +31,10 @@
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
<div class="accordion-body">
<span *ngFor="let greenResult of result.greenResults">
ActionType: {{greenResult.actionType}} {{greenResult.flowElement.id}} in <b>{{greenResult.flow.name}}</b>
<span *ngFor="let greenResult of migrationResult.greenResults">
<b>{{greenResult.flow.name}}</b>
</span>
<div *ngIf="result.greenResults.length == 0">No data</div>
<div *ngIf="migrationResult.greenResults.length == 0">No data</div>
</div>
</div>
</div>
......@@ -33,10 +50,10 @@
</h2>
<div id="flush-collapseTwo" class="accordion-collapse collapse" aria-labelledby="flush-headingTwo" data-bs-parent="#accordionFlushExample">
<div class="accordion-body">
<span *ngFor="let redResult of result.redResults">
ActionType: {{yellowResult.actionType}} {{yellowResult.flowElement.id}} in <b>{{yellowResult.flow.name}}</b>
<span *ngFor="let yellowResult of migrationResult.yellowResults">
<b>{{yellowResult.flow.name}}</b>
</span>
<div *ngIf="result.yellowResults.length == 0">No data</div>
<div *ngIf="migrationResult.yellowResults.length == 0">No data</div>
</div>
</div>
</div>
......@@ -52,10 +69,10 @@
</h2>
<div id="flush-collapseThree" class="accordion-collapse collapse" aria-labelledby="flush-headingThree" data-bs-parent="#accordionFlushExample">
<div class="accordion-body">
<span *ngFor="let redResult of result.redResults">
ActionType: {{redResult.actionType}} {{redResult.flowElement.id}} in <b>{{redResult.flow.name}}</b>
<span *ngFor="let redResult of migrationResult.redResults">
<b>{{redResult.flow.name}}</b>
</span>
<div *ngIf="result.redResults.length == 0">No data</div>
<div *ngIf="migrationResult.redResults.length == 0">No data</div>
</div>
</div>
</div>
......
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { MigrationResultWrapper } from '../../models/migration-result-wrapper';
import { MigrationService } from '../../services/migration-service';
import { environment } from 'src/environments/environment';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-migration-overview',
......@@ -11,26 +13,38 @@ import { MigrationService } from '../../services/migration-service';
export class MigrationOverviewComponent implements OnInit {
projectId: number;
result: MigrationResultWrapper;
migrationResult: MigrationResultWrapper;
isLoading: boolean;
constructor(private migrationService: MigrationService, private route: ActivatedRoute) {
constructor(private migrationService: MigrationService, private route: ActivatedRoute, public http: HttpClient, private router: Router) {
this.route.params.subscribe(params =>
this.projectId = params['projectId']
)
}
ngOnInit(): void {
ngOnInit() {
this.startMigration();
}
async startMigration() {
startMigration() {
this.isLoading = true;
this.result = await this.migrationService.getMigrationResultWrapper(this.projectId);
this.migrationResult=this.migrationService.migrationResult;
console.log(this.migrationResult);
this.isLoading = false;
console.log(this.result);
}
// Testbutton Priorisierung
async callPrio() {
let message = await this.prio(this.projectId)
}
prio(projectId: number): Promise<string> {
const url = `${environment.apiBaseUrl}project/${projectId}/prioritization`;
return this.http.get(url, {responseType: 'text'}).toPromise();
}
navigateToFlowOverview(){
this.router.navigate(['project',this.projectId,'flow']);
}
}
......@@ -32,9 +32,9 @@
<div class="row">
<div class="col-md-12">
<div class="d-grid gap-2 buttons">
<button class="btn btn-dark" type="button" [routerLink]="['matchingFlows']" i18n="compare bpmn">Compare BPMN-Diagrams</button>
<button class="btn btn-dark" type="button" (click)="callPrio()" i18n="prio bpmn">Test Prioritization</button>
<button class="btn btn-primary" type="button" [routerLink]="['migration']"i18n="migrate bpmn" >Start Migration</button>
<button class="btn btn-dark" type="button" [disabled]="compareDiagramsDisabled" [routerLink]="['matchingFlows']" i18n="compare bpmn">Compare BPMN-Diagrams</button>
<!-- <button class="btn btn-dark" type="button" (click)="callPrio()" i18n="prio bpmn">Test Prioritization</button> -->
<!-- <button class="btn btn-primary" type="button" [routerLink]="['migration']"i18n="migrate bpmn" >Start Migration</button> -->
</div>
</div>
</div>
......
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