Skip to content

Commit

Permalink
Merge pull request #30 from axonivy-market/TE-615-handle-waiting-for-…
Browse files Browse the repository at this point in the history
…intermediate-event

TE-615: Handle waiting for intermediate event in icase
  • Loading branch information
trungmaihova authored Jun 21, 2024
2 parents 24c8ff0 + 15f154e commit 3ac1ae8
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@
title="#{task.pid}" />
</p:column>

<p:column headerText="Task Name" sortBy="#{task.taskName}" filterBy="#{task.taskName}" styleClass="text-overflow">
<p:column headerText="Task Name" sortBy="#{task.taskName}"
filterBy="#{task.taskName}" filterMatchMode="contains"
styleClass="text-overflow">
<h:outputText value="#{task.taskName}" title="#{task.taskName}" />
</p:column>

<p:column headerText="Element Name" sortBy="#{task.elementName}" filterBy="#{task.elementName}" styleClass="text-overflow">
<h:outputText value="#{task.elementName}" title="#{task.elementName}" />
<p:column headerText="Element Name" sortBy="#{task.elementName}"
filterBy="#{task.elementName}" filterMatchMode="contains"
styleClass="text-overflow">
<h:outputText value="#{task.elementName}"
title="#{task.elementName}" />
</p:column>

<p:column headerText="Estimated Duration">
Expand Down
19 changes: 16 additions & 3 deletions process-analyzer-test/processes/FlowSubprocess.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"id" : "S10-g1",
"type" : "EmbeddedEnd",
"visual" : {
"at" : { "x" : 576, "y" : 256 }
"at" : { "x" : 448, "y" : 256 }
},
"parentConnector" : "f3"
}, {
Expand Down Expand Up @@ -90,10 +90,23 @@
]
} ],
"visual" : {
"at" : { "x" : 312, "y" : 256 }
"at" : { "x" : 208, "y" : 256 }
},
"connect" : [
{ "id" : "S10-f1", "to" : "S10-f2" }
]
}, {
"id" : "S10-f2",
"type" : "WaitEvent",
"config" : {
"javaClass" : "com.axonivy.utils.process.analyzer.test.WaitTaskBean",
"eventId" : "com.axonivy.utils.process.analyzer.test.WaitTaskBean.createEventIdentifierForTask()"
},
"visual" : {
"at" : { "x" : 352, "y" : 256 }
},
"connect" : [
{ "id" : "S10-f1", "to" : "S10-g1" }
{ "id" : "S10-f3", "to" : "S10-g1" }
]
} ],
"visual" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.axonivy.utils.process.analyzer.test;

import java.util.UUID;

import org.eclipse.core.runtime.IProgressMonitor;

import ch.ivyteam.ivy.process.intermediateevent.IProcessIntermediateEventBean;
import ch.ivyteam.ivy.service.ServiceException;

public class WaitTaskBean implements IProcessIntermediateEventBean {
private boolean isRunning = false;

public static String createEventIdentifierForTask() {
return UUID.randomUUID().toString();
}

@Override
public String getName() {
return null;
}

@Override
public String getDescription() {
return null;
}

@Override
public void start(IProgressMonitor monitor) throws ServiceException {
isRunning = true;
}

@Override
public void stop(IProgressMonitor monitor) throws ServiceException {
isRunning = false;
}

@Override
public boolean isRunning() {
return isRunning;
}

@Override
public void poll() {
}

@Override
public boolean isMoreThanOneInstanceSupported() {
return false;
}

@Override
public Class<?> getResultObjectClass() {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ void shouldFindAllTasksAtStart(BpmClient bpmClient) throws Exception {
assertArrayEquals(expected, taskNames);
}

@Test
void shouldFindAllTasksAtWaitTask(BpmClient bpmClient) throws Exception {
ExecutionResult result = bpmClient.start().process(FLOW_SUB_PROCESS.elementName("start")).execute();
ICase icase = result.workflow().activeCase();

List<ITask> activeTasks = result.workflow().activeTasks();
ITask taskA = findTaskByElementName(activeTasks, "Task A");

bpmClient.mock().uiOf(FLOW_SUB_PROCESS.elementName("Task A")).withNoAction();
result = bpmClient.start().task(taskA).as().everybody().execute();

var detectedTasks = processAnalyzer.findAllTasks(icase, null);

var expected = Arrays.array("Task B");
var taskNames = getTaskNames(detectedTasks);
assertArrayEquals(expected, taskNames);
}

@Test
void shouldCalculateWorstCaseDuration(BpmClient bpmClient) throws Exception {
ExecutionResult result = bpmClient.start().process(FLOW_SUB_PROCESS.elementName("start")).execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

public class ProcessAnalyzer implements AdvancedProcessAnalyzer {
private static final List<TaskState> OPEN_TASK_STATES = List.of(TaskState.SUSPENDED, TaskState.PARKED,
TaskState.RESUMED);
TaskState.RESUMED, TaskState.WAITING_FOR_INTERMEDIATE_EVENT);

private boolean isEnableDescribeAlternative;
private Map<ElementTask, Duration> durationOverrides = emptyMap();
Expand Down

0 comments on commit 3ac1ae8

Please sign in to comment.