Skip to content

Commit

Permalink
JBPM-10191 - Enhance update process timer SLAComplianceTest (kiegroup…
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianMacik authored and fjtirado committed Nov 6, 2023
1 parent f656cc7 commit 31f8eb0
Showing 1 changed file with 13 additions and 3 deletions.
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

0 comments on commit 31f8eb0

Please sign in to comment.