This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 4_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 5487a82be27f54a07533a5afe1a379a6b6f1926f Author: Francesco Chicchiriccò <[email protected]> AuthorDate: Thu Jun 19 10:13:26 2025 +0200 Cleanup --- .../client/console/implementations/MyReportJobDelegate.groovy | 3 +-- .../test/java/org/apache/syncope/core/logic/ReportLogicTest.java | 5 ++--- .../core/provisioning/api/job/report/ReportJobDelegate.java | 2 -- .../provisioning/java/job/report/AbstractReportJobDelegate.java | 8 ++------ .../syncope/core/provisioning/java/job/report/ReportJob.java | 5 +---- .../syncope/fit/core/reference/SampleReportJobDelegate.java | 6 ++---- 6 files changed, 8 insertions(+), 21 deletions(-) diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/implementations/MyReportJobDelegate.groovy b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/implementations/MyReportJobDelegate.groovy index 1d9a9b7f29..368166288a 100644 --- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/implementations/MyReportJobDelegate.groovy +++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/implementations/MyReportJobDelegate.groovy @@ -30,8 +30,7 @@ class MyReportJobDelegate implements ReportJobDelegate { } @Override - void execute(String reportKey, boolean dryRun, JobExecutionContext context) - throws JobExecutionException { + void execute(String reportKey, JobExecutionContext context) throws JobExecutionException { } } diff --git a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java index 30d6926367..ff9234a5f6 100644 --- a/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java +++ b/core/idrepo/logic/src/test/java/org/apache/syncope/core/logic/ReportLogicTest.java @@ -55,9 +55,7 @@ public class ReportLogicTest extends AbstractTest { @Override protected String doExecute( - final boolean dryRun, final OutputStream os, - final String executor, final JobExecutionContext context) throws JobExecutionException { try { @@ -114,10 +112,11 @@ public class ReportLogicTest extends AbstractTest { JobExecutionContext ctx = mock(JobExecutionContext.class); when(ctx.getExecutor()).thenReturn("test"); + when(ctx.isDryRun()).thenReturn(false); ReportJobDelegate delegate = ApplicationContextProvider.getBeanFactory().createBean(TestReportJobDelegate.class); - delegate.execute(report.getKey(), false, ctx); + delegate.execute(report.getKey(), ctx); report = logic.read(report.getKey()); assertFalse(report.getExecutions().isEmpty()); diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/report/ReportJobDelegate.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/report/ReportJobDelegate.java index 11acf7a507..a8e686f586 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/report/ReportJobDelegate.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/job/report/ReportJobDelegate.java @@ -37,12 +37,10 @@ public interface ReportJobDelegate { * Executes a Job to run the given Report. * * @param reportKey Report key to run - * @param dryRun indicates if execution shall be simulated with no actual changes * @param context execution context, can be used to pass parameters to the job * @throws JobExecutionException if anything goes wrong */ void execute( String reportKey, - boolean dryRun, JobExecutionContext context) throws JobExecutionException; } diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AbstractReportJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AbstractReportJobDelegate.java index dc7525c02b..3ae8f49882 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AbstractReportJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/AbstractReportJobDelegate.java @@ -100,7 +100,6 @@ public abstract class AbstractReportJobDelegate implements ReportJobDelegate { @Override public void execute( final String reportKey, - final boolean dryRun, final JobExecutionContext context) throws JobExecutionException { report = reportDAO.findById(reportKey). @@ -133,7 +132,7 @@ public abstract class AbstractReportJobDelegate implements ReportJobDelegate { setStatus("Starting"); try { - execution.setMessage(doExecute(dryRun, zos, executor, context)); + execution.setMessage(doExecute(zos, context)); execution.setStatus(ReportJob.Status.SUCCESS.name()); result = OpEvent.Outcome.SUCCESS; @@ -184,14 +183,11 @@ public abstract class AbstractReportJobDelegate implements ReportJobDelegate { /** * The actual execution, delegated to child classes. * - * @param dryRun whether to actually touch the data * @param os where to stream report execution's data - * @param executor the user executing this report * @param context job execution context, can be used to pass parameters to the job * @return the report execution status to be set * @throws JobExecutionException if anything goes wrong */ - protected abstract String doExecute( - boolean dryRun, OutputStream os, String executor, JobExecutionContext context) + protected abstract String doExecute(OutputStream os, JobExecutionContext context) throws JobExecutionException; } diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/ReportJob.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/ReportJob.java index d3d827fb19..92bf027012 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/ReportJob.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/report/ReportJob.java @@ -81,10 +81,7 @@ public class ReportJob extends Job { instance -> perContextReportJobDelegates.put(impl.getKey(), instance)). orElseThrow(() -> new IllegalArgumentException( "Could not instantiate " + impl.getBody())); - delegate.execute( - reportKey, - context.isDryRun(), - context); + delegate.execute(reportKey, context); } } catch (Exception e) { LOG.error("While executing report {}", reportKey, e); diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/SampleReportJobDelegate.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/SampleReportJobDelegate.java index 91795218d0..84c1093310 100644 --- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/SampleReportJobDelegate.java +++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/SampleReportJobDelegate.java @@ -112,12 +112,10 @@ public class SampleReportJobDelegate extends AbstractReportJobDelegate { @Override protected String doExecute( - final boolean dryRun, final OutputStream os, - final String executor, final JobExecutionContext context) throws JobExecutionException { - if (!dryRun) { + if (!context.isDryRun()) { try { switch (report.getMimeType()) { case MediaType.APPLICATION_PDF_VALUE: @@ -135,7 +133,7 @@ public class SampleReportJobDelegate extends AbstractReportJobDelegate { } } - return (dryRun + return (context.isDryRun() ? "DRY " : "") + "RUNNING"; }
