Skip to content

Commit

Permalink
Merge pull request #657 from NitorCreations/651-bug-when-requesting-w…
Browse files Browse the repository at this point in the history
…orkflow-instance-from-archive-with-includes-contains-actions

651 bug when requesting workflow instance from archive with includes contains actions
  • Loading branch information
eputtone authored Oct 4, 2024
2 parents 9044c16 + 72d2ad2 commit e3e86be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
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
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<argLine>@{jacocoArgLine}</argLine>
<includes>
<include>**/*Test.java</include>
</includes>
Expand All @@ -222,7 +221,7 @@
<threadCount>1</threadCount>
<forkCount>${surefire.forkcount}</forkCount>
<!-- workaround for buggy cxf implementation on top of the "new" java async http client -->
<argLine>-Dorg.apache.cxf.transport.http.forceURLConnection=true</argLine>
<argLine>@{jacocoArgLine} -Dorg.apache.cxf.transport.http.forceURLConnection=true</argLine>
</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit e3e86be

Please sign in to comment.