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

JBPM-10191 - Enhance update process timer SLAComplianceTest #2320

Merged
merged 1 commit into from
Aug 25, 2023
Merged
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
16 changes: 13 additions & 3 deletions jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/SLAComplianceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,16 @@ public void afterSLAViolated(SLAViolatedEvent event) {
@Test
public void testSLAonProcessUpdated() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
final ProcessEventListener listener = new DefaultProcessEventListener(){
@Override
public void afterSLAViolated(SLAViolatedEvent event) {
latch.countDown();
}
};
KieBase kbase = createKnowledgeBase("BPMN2-UserTaskWithSLA.bpmn2");
KieSession ksession = createKnowledgeSession(kbase);

ksession.addEventListener(listener);

ProcessInstance processInstance = ksession.startProcess("UserTask");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);

Expand All @@ -160,8 +167,11 @@ public void testSLAonProcessUpdated() throws Exception {
assertEquals(ProcessInstance.SLA_PENDING, slaCompliance);

slaViolated = latch.await(5, TimeUnit.SECONDS);
assertFalse("Process SLA was not violated while it is expected after 10s", slaViolated);

assertTrue("Process SLA was not violated while it is expected after 10s", slaViolated);

processInstance = ksession.getProcessInstance(processInstance.getId());
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);

slaCompliance = getSLAComplianceForProcessInstance(processInstance);
assertEquals(ProcessInstance.SLA_VIOLATED, slaCompliance);

Expand Down
Loading