Skip to content

Commit

Permalink
bug(engine): Remove parser warning for intermediate catch timer event…
Browse files Browse the repository at this point in the history
… with a time cycle

- changes the lint warning for intermediate catch timer event with a time cycle to an INFO level log

related to camunda#3943
  • Loading branch information
Bragolgirith committed Jan 27, 2024
1 parent c7ffb32 commit ad1bb56
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3566,7 +3566,7 @@ protected void parseIntermediateTimerEventDefinition(Element timerEventDefinitio

Element timeCycleElement = timerEventDefinition.element("timeCycle");
if (timeCycleElement != null) {
addTimeCycleWarning(timeCycleElement, "intermediate catch", timerActivity.getId());
LOG.intermediateCatchTimerEventWithTimeCycleNotRecommended(timerActivity.getId());
}

addTimerDeclaration(timerActivity.getEventScope(), timerDeclaration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void parsingFailure(Throwable cause) {
logError("004", "Unexpected Exception with message: {} ", cause.getMessage());
}

public void intermediateCatchTimerEventWithTimeCycleNotRecommended(String elementId) {
logInfo("005", "Element with id '{}' is an intermediate catch timer event with a time cycle which is not recommended.", elementId);
}

// EXCEPTIONS

public ProcessEngineException parsingProcessException(Exception cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
import org.camunda.bpm.engine.test.util.SystemPropertiesRule;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.camunda.commons.testing.ProcessEngineLoggingRule;
import org.camunda.commons.testing.WatchLogger;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
Expand All @@ -89,6 +91,9 @@ public class BpmnParseTest {
@Rule
public SystemPropertiesRule systemProperties = SystemPropertiesRule.resetPropsAfterTest();

@Rule
public ProcessEngineLoggingRule loggingRule = new ProcessEngineLoggingRule();

public RepositoryService repositoryService;
public RuntimeService runtimeService;
public ProcessEngineConfigurationImpl processEngineConfiguration;
Expand Down Expand Up @@ -1364,6 +1369,31 @@ public void testMultipleTimerStartEvents() {
}
}

@Test
@WatchLogger(loggerNames = {"org.camunda.bpm.engine.bpmn.parser"}, level = "INFO")
public void testIntermediateCatchTimerEventWithTimeCycleNotRecommendedInfoMessage() {
String timerCycle = "<?xml version='1.0' encoding='UTF-8'?>" +
"<definitions xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
" xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL'" +
" xmlns:camunda='http://camunda.org/schema/1.0/bpmn'" +
" targetNamespace='Examples'>" +
" <process id='process' isExecutable='true'>" +
" <startEvent id='theStart' name='Start'></startEvent>" +
" <endEvent id='theEnd' name='End'></endEvent>" +
" <intermediateCatchEvent id='timerintermediatecatchevent1' name='TimerCatchEvent'>" +
" <timerEventDefinition>" +
" <timeCycle>0 0/5 * * * ?</timeCycle>" +
" </timerEventDefinition>" +
" </intermediateCatchEvent>" +
" <sequenceFlow id='flow1' name='' sourceRef='theStart' targetRef='timerintermediatecatchevent1'></sequenceFlow>" +
" <sequenceFlow id='flow2' name='' sourceRef='timerintermediatecatchevent1' targetRef='theEnd'></sequenceFlow>" +
" </process>" +
"</definitions>";
repositoryService.createDeployment().addString("process.bpmn20.xml", timerCycle).deploy();
String logMessage = "Element with id 'timerintermediatecatchevent1' is an intermediate catch timer event with a time cycle which is not recommended.";
assertThat(loggingRule.getFilteredLog(logMessage)).hasSize(1);
}

@Test
public void testParseEmptyExtensionProperty() {
// given process definition with empty property (key and value = null) is deployed
Expand Down

0 comments on commit ad1bb56

Please sign in to comment.