Skip to content

Commit

Permalink
TE-582: improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ntnchuong committed May 23, 2024
1 parent 946e3e8 commit 4ba6ad8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</modules>

<scm>
<developerConnection>scm:git:https://github.com/axonivy-professional-services/market-${project.name}.git</developerConnection>
<developerConnection>scm:git:https://github.com/axonivy-market/${project.name}.git</developerConnection>
<tag>HEAD</tag>
</scm>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,6 @@ private List<Process> getAllProcesses() {
return processes;
}

private boolean isAcceptedProcess(List<String> folders, String fullQualifiedName) {
return folders.stream().anyMatch(folder -> fullQualifiedName.contains(folder));
}

private static List<BaseElement> getElementOfProcess(Process process) {
var processElements = process.getProcessElements();
var childElments = getElementOfProcesses(processElements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void shouldThrowExceptionWhenFindTasksOnPathAtStartWithFlowNameNull() {
processAnalyzer.findTasksOnPath(start, null, null);
});

String expectedMessage = "Not found path";
String expectedMessage = "Not found path after element 18DD16F8AA39F5DE-f7";
String actualMessage = exception.getMessage();

assertEquals(expectedMessage, actualMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.SetUtils;
import org.apache.commons.lang3.StringUtils;

import com.axonivy.utils.process.analyzer.internal.model.AnalysisPath;
import com.axonivy.utils.process.analyzer.internal.model.CommonElement;
import com.axonivy.utils.process.analyzer.internal.model.ProcessElement;
import com.axonivy.utils.process.analyzer.internal.model.TaskParallelGroup;

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.process.model.BaseElement;
import ch.ivyteam.ivy.process.model.NodeElement;
import ch.ivyteam.ivy.process.model.connector.SequenceFlow;
Expand Down Expand Up @@ -368,8 +370,7 @@ private List<AnalysisPath> findAnalysisPaths(ProcessElement from, String flowNam

List<SequenceFlow> outs = getSequenceFlows((NodeElement) from.getElement(), flowName, findType);
if (from.getElement() instanceof Alternative && outs.isEmpty()) {
Ivy.log().error("Can not found the out going from a alternative {0}", from.getPid().getRawPid());
throw new Exception("Not found path");
throw new Exception("Not found path after element " + getAlternativeNameId(from.getElement()));
}

Map<SequenceFlow, List<AnalysisPath>> pathOptions = new LinkedHashMap<>();
Expand All @@ -387,6 +388,11 @@ private List<AnalysisPath> findAnalysisPaths(ProcessElement from, String flowNam
return path;
}

private String getAlternativeNameId(BaseElement alternative) {
return Stream.of(alternative.getName(), alternative.getPid().getRawPid()).filter(StringUtils::isNotEmpty)
.collect(Collectors.joining("-"));
}

private List<AnalysisPath> removeLastTaskSwitchGateway(List<AnalysisPath> paths) {
List<AnalysisPath> result = new ArrayList<>();
for (AnalysisPath path : paths) {
Expand Down

0 comments on commit 4ba6ad8

Please sign in to comment.