Skip to content

Commit

Permalink
fix(engine): in BpmnParser switch log level entry (#4016)
Browse files Browse the repository at this point in the history
switch the log level entry from Warning to Info for intermediate catch timer event with a time cycle

related to #3943
  • Loading branch information
Bragolgirith authored Jan 31, 2024
1 parent 8abe2de commit b8afe53
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3566,7 +3566,8 @@ protected void parseIntermediateTimerEventDefinition(Element timerEventDefinitio

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

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

public void intermediateCatchTimerEventWithTimeCycleNotRecommended(String definitionKey, String elementId) {
logInfo("005", "definitionKey: {}; It is not recommended to use an intermediate catch timer event with a time cycle, " +
"element with id '{}'.", definitionKey, 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,22 @@ public void testMultipleTimerStartEvents() {
}
}

@Test
@WatchLogger(loggerNames = {"org.camunda.bpm.engine.bpmn.parser"}, level = "INFO")
public void testIntermediateCatchTimerEventWithTimeCycleNotRecommendedInfoMessage() {
BpmnModelInstance process = Bpmn.createExecutableProcess("process")
.startEvent()
.intermediateCatchEvent("timerintermediatecatchevent1")
.timerWithCycle("0 0/5 * * * ?")
.endEvent()
.done();
testRule.deploy(process);

String logMessage = "definitionKey: process; It is not recommended to use an intermediate catch timer event with a time cycle, "
+ "element with id 'timerintermediatecatchevent1'.";
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 b8afe53

Please sign in to comment.