Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TE-615: Handle waiting for intermediate event in icase #30

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading