From 288b6fa5d7bd55b3aa66ff0f5cbddc915c0420f2 Mon Sep 17 00:00:00 2001 From: Milan Mladoniczky <6153201+tuplle@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:01:50 +0200 Subject: [PATCH 1/3] [NAE-1989] RunnerController refactor - fix removing replaced runner in sorted list of runners --- .../startup/ApplicationRunnerExecutor.java | 2 +- .../startup/ApplicationRunnerOrderResolver.java | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerExecutor.java b/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerExecutor.java index 00b80dd20b..bbc943771b 100644 --- a/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerExecutor.java +++ b/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerExecutor.java @@ -73,7 +73,7 @@ protected void callRunner(T runner, ApplicationRunnerOrderResolver.SortedRunners protected ApplicationRunnerOrderResolver.SortedRunners resolveRunners() { Map customRunners = (Map) ApplicationContextProvider.getAppContext().getBeansOfType(GenericTypeResolver.resolveTypeArgument(getClass(), ApplicationRunnerExecutor.class)); ApplicationRunnerOrderResolver.SortedRunners runners = orderResolver.sortByRunnerOrderAnnotation(customRunners.values()); - runners.sortUnresolvedRunners(); + runners.resolveAllRunners(); return runners; } diff --git a/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerOrderResolver.java b/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerOrderResolver.java index e7a376d194..404cef9c19 100644 --- a/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerOrderResolver.java +++ b/src/main/java/com/netgrif/application/engine/startup/ApplicationRunnerOrderResolver.java @@ -27,7 +27,7 @@ public class ApplicationRunnerOrderResolver { * @param the type of the runners * @param runners the collection of runners to be sorted * @return a {@link SortedRunners} object containing two lists: one with the sorted runners and one with the unresolved runners. - * To resolve order of the unresolved list call {@link SortedRunners#sortUnresolvedRunners()} method. + * To resolve order of the unresolved list call {@link SortedRunners#resolveAllRunners()} method. */ public SortedRunners sortByRunnerOrderAnnotation(Collection runners) { if (runners == null) return null; @@ -90,7 +90,20 @@ public SortedRunners(List sorted, List unresolved) { * @return {@code true} if all unresolved runners have been successfully sorted and the unresolved list is empty; * {@code false} otherwise. */ - public boolean sortUnresolvedRunners() { + public boolean resolveAllRunners() { + sortUnresolvedRunners(); + replaced.values().forEach(this::removeRunner); + return unresolved.isEmpty(); + } + + protected void removeRunner(Class runnerClass) { + int classIndex = indexOfClass(sorted, runnerClass); + if (classIndex == -1) return; + T runner = sorted.remove(classIndex); + if (runner != null) removeRunner(runnerClass); + } + + protected boolean sortUnresolvedRunners() { boolean changed = false; changed = changed || resolveSortingAnnotation(BeforeRunner.class, this::insertBeforeRunner); changed = changed || resolveSortingAnnotation(AfterRunner.class, this::insertAfterRunner); From e45131951dc6fb2637edf4943ba795aff04794f6 Mon Sep 17 00:00:00 2001 From: Jozef Machac <84977782+machacjozef@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:49:02 +0100 Subject: [PATCH 2/3] Update FileFieldTest.groovy --- .../engine/petrinet/domain/dataset/FileFieldTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FileFieldTest.groovy b/src/test/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FileFieldTest.groovy index 353f375f26..16075c06a0 100644 --- a/src/test/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FileFieldTest.groovy +++ b/src/test/groovy/com/netgrif/application/engine/petrinet/domain/dataset/FileFieldTest.groovy @@ -82,7 +82,7 @@ class FileFieldTest { private IPetriNetService petriNetService @Autowired - private SuperCreator superCreator + private SuperCreatorRunner superCreator private MockMvc mockMvc From 53429e1546d2c99d89cbadba9e29cf14e645d5df Mon Sep 17 00:00:00 2001 From: Machac Date: Fri, 8 Nov 2024 13:56:20 +0100 Subject: [PATCH 3/3] [NAE-1989] RunnerController refactor - edit version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5bb49cca65..c22c15e881 100644 --- a/pom.xml +++ b/pom.xml @@ -771,7 +771,7 @@ org.jacoco jacoco-maven-plugin - 0.8.5 + 0.8.10 default-prepare-agent