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

Added missing score calculations

parent 3766f5b5
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,7 @@ public class MigrationService {
}
private void setFlagsForStandardFlowChangeWrapper(List<FlowChangeWrapper> flowChangeWrapper, TestgeneratorDSLSerializer newDSL) {
private void setFlagsForStandardFlowChangeWrapper(List<FlowChangeWrapper> flowChangeWrapper, TestgeneratorDSLSerializer newDSL, TestgeneratorDSLSerializer oldDSL) {
for(FlowChangeWrapper fcw : flowChangeWrapper) {
if(!flowHasTests(fcw.getFlow(), newDSL)) continue;
......@@ -90,11 +90,26 @@ public class MigrationService {
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
List<FlowElementReference> fersOld = oldDSL.getFlow(fcw.getFlow().getName()).getInclElements();
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
Flow oldFlow = oldDSL.getFlow(fcw.getFlow().getName());
Boolean setScore = false;
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
setScore = true;
fer.setFlag(this.calcMaxFlag(fer.getFlag(), newFlag));
maxFlag = this.calcMaxFlag(maxFlag, newFlag);
}
}
for(FlowElementReference oldFer: fersOld) {
if(fcw.getActionType().name().contains("DELETE") && oldFer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
}
}
......@@ -104,11 +119,9 @@ public class MigrationService {
//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);
flow.setScore(score);
//Anhand der neuen Flows das Flag auch für die zugehörigen Tests setzen
//Test-Flags setzen
......@@ -191,7 +204,7 @@ public class MigrationService {
allStandardFlowChangeWrapper.addAll(sequenceFlowChangeExpressionActionResults);
this.setFlagsForStandardFlowChangeWrapper(allStandardFlowChangeWrapper, newDSL);
this.setFlagsForStandardFlowChangeWrapper(allStandardFlowChangeWrapper, newDSL, oldDSL);
for(FlowChangeWrapper fcw : processVariableChangeConstraintActionResults) {
......@@ -200,21 +213,22 @@ public class MigrationService {
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
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);
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();
......@@ -241,23 +255,21 @@ public class MigrationService {
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
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);
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();
......@@ -293,21 +305,20 @@ public class MigrationService {
try {
Flag maxFlag = Flag.NONE;
List<FlowElementReference> fers = newDSL.getFlow(fcw.getFlow().getName()).getInclElements();
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
for(FlowElementReference fer : fers) {
if(fer.getRef().getName().equals(fcw.getFlowElement().getName())) {
Flag newFlag = this.convertMigrationResultToFlag(fcw.getMigrationResult().getStatus());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
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);
flow.setScore(score);
//Die vorhandenen Tests müssen gelöscht werden, wenn ein XOR hinzugefügt wurde
if(yaml.getGateway().getDeleteTests()) {
if(!fcw.getAffectedTests().isEmpty()) {
......@@ -343,22 +354,23 @@ public class MigrationService {
System.out.println(fcw.getActionType() + " on Flow element " + fcw.getFlowElement().getName());
try {
Flag maxFlag = Flag.NONE;
Flow flow = newDSL.getFlow(fcw.getFlow().getName());
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());
int score = this.calcScore(newFlag, flow);
flow.setScore(score);
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);
flow.setScore(score);
//Die vorhandenen Tests müssen gelöscht werden, wenn ein XOR hinzugefügt wurde
if(yaml.getGateway().getDeleteTests()) {
if(!fcw.getAffectedTests().isEmpty()) {
......
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