Skip to content

Commit

Permalink
Fix action filling in query workflows from archive
Browse files Browse the repository at this point in the history
  • Loading branch information
eputtone committed Oct 3, 2024
1 parent 3c76293 commit 72d2ad2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ private void fillActions(WorkflowInstance instance, boolean includeStateVariable
long maxActions = getMaxActions(requestedMaxActions);
String tableName = ACTION.tableFor(instance);
String sql = sqlVariants
.limit("select nflow_workflow_action.* from " + tableName + " where workflow_id = ? order by id desc", maxActions);
.limit("select * from " + tableName + " where workflow_id = ? order by id desc", maxActions);
List<WorkflowInstanceAction.Builder> actionBuilders = jdbc.query(sql, workflowInstanceActionRowMapper,
instance.id);
if (includeStateVariables) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import io.nflow.engine.model.ModelObject;
import io.nflow.engine.service.WorkflowInstanceInclude;
import io.nflow.engine.workflow.instance.QueryWorkflowInstances;
import io.nflow.engine.workflow.instance.WorkflowInstance;
import io.nflow.engine.workflow.instance.WorkflowInstanceAction;

Expand Down Expand Up @@ -177,6 +178,9 @@ public void archiveWorkflowsWithActionsWorks() {

assertEquals(actionIds.size(), getArchiveActionCount());
assertEquals(actionCountAfter, actionCountBefore - actionIds.size());

assertWorkflowActionsThroughQuery(archivable1, 1);
assertWorkflowActionsThroughQuery(archivable2, 3);
}

@Test
Expand Down Expand Up @@ -476,6 +480,15 @@ private void assertArchivedWorkflowsDoNotExist(List<Long> workflowIds) {
}
}

private void assertWorkflowActionsThroughQuery(Long workflowId, int expectedActions) {
List<WorkflowInstance> archivedWorkflow = workflowInstanceDao.queryWorkflowInstances(new QueryWorkflowInstances.Builder()
.setQueryArchive(true)
.setIncludeActions(true)
.addIds(workflowId)
.build());
assertEquals(archivedWorkflow.get(0).actions.size(), expectedActions);
}

private void assertActiveActionsRemoved(List<Long> actionIds) {
for (long actionId : actionIds) {
int found = rowCount("select 1 from nflow_workflow_action where id = ?", actionId);
Expand Down

0 comments on commit 72d2ad2

Please sign in to comment.