Suppress the step's priority in the returned workflow JSON/YAML

Closes #45075

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
Stefan Guilhen 2025-12-23 15:18:04 -03:00 committed by Pedro Igor
parent 985ec6d306
commit 66f3868ccf
3 changed files with 9 additions and 3 deletions

View File

@ -72,6 +72,7 @@ public class WorkflowStepRepresentation extends AbstractWorkflowComponentReprese
setConfig(CONFIG_AFTER, after);
}
@JsonIgnore
public String getPriority() {
return getConfigValue(CONFIG_PRIORITY, String.class);
}

View File

@ -89,6 +89,7 @@ public class DefaultWorkflowProvider implements WorkflowProvider {
}
// set the id of the step to match the existing one, so we can update the config
newStep.setId(currentStep.getId());
newStep.setPriority(Long.parseLong(currentStep.getPriority()));
}
// finally, update the workflow's config along with the steps' configs

View File

@ -90,7 +90,9 @@ public class DisableActiveWorkflowTest extends AbstractWorkflowTest {
// disable the workflow - scheduled steps should be paused and workflow should not activate for new users
workflow.setEnabled(false);
managedRealm.admin().workflows().workflow(workflowId).update(workflow).close();
try (Response response = managedRealm.admin().workflows().workflow(workflowId).update(workflow)) {
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
}
// create another user - should NOT bind the user to the workflow as it is disabled
managedRealm.admin().users().create(UserConfigBuilder.create().username("anotheruser").build()).close();
@ -119,8 +121,10 @@ public class DisableActiveWorkflowTest extends AbstractWorkflowTest {
});
// re-enable the workflow - scheduled steps should resume and new users should be bound to the workflow
workflow.getConfig().putSingle("enabled", "true");
managedRealm.admin().workflows().workflow(workflowId).update(workflow).close();
workflow.setEnabled(true);
try (Response response = managedRealm.admin().workflows().workflow(workflowId).update(workflow)) {
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
}
// create a third user - should bind the user to the workflow as it is enabled again
managedRealm.admin().users().create(UserConfigBuilder.create().username("thirduser").email("thirduser@example.com").build()).close();