@@ -0,0 +1,2029 @@
+package org.camunda.bpm.engine.test.api.cfg;%0A%0Aimport org.camunda.bpm.engine.ProcessEngineConfiguration;%0Aimport org.camunda.bpm.engine.ProcessEngineException;%0Aimport org.camunda.bpm.engine.RuntimeService;%0Aimport org.camunda.bpm.engine.impl.db.sql.DbSqlSessionFactory;%0Aimport org.camunda.bpm.engine.test.ProcessEngineRule;%0Aimport org.camunda.bpm.engine.test.RequiredHistoryLevel;%0Aimport org.camunda.bpm.engine.test.util.ProcessEngineTestRule;%0Aimport org.camunda.bpm.model.bpmn.Bpmn;%0Aimport org.camunda.bpm.model.bpmn.BpmnModelInstance;%0Aimport org.junit.Assume;%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.RuleChain;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.junit.Assert.fail;%0A%0A/**%0A * @author Svetlana Dorokhova.%0A */%0A@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)%0Apublic class PersistenceExceptionTest %7B%0A%0A  public ProcessEngineRule engineRule = new ProcessEngineRule(true);%0A  public ProcessEngineTestRule testRule = new ProcessEngineTestRule(engineRule);%0A%0A  private RuntimeService runtimeService;%0A%0A  @Rule%0A  public RuleChain ruleChain = RuleChain.outerRule(engineRule).around(testRule);%0A%0A  @Before%0A  public void init() %7B%0A    runtimeService = engineRule.getRuntimeService();%0A  %7D%0A%0A  @Test%0A  public void testPersistenceExceptionContainsRealCause() %7B%0A    Assume.assumeTrue(engineRule.getProcessEngineConfiguration().getDatabaseType().equals(DbSqlSessionFactory.MARIADB));%0A    StringBuffer longString = new StringBuffer();%0A    for (int i = 0; i %3C 100; i++) %7B%0A      longString.append(%22tensymbols%22);%0A    %7D%0A    final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(%22process1%22).startEvent().userTask(longString.toString()).endEvent().done();%0A    testRule.deploy(modelInstance);%0A    try %7B%0A      runtimeService.startProcessInstanceByKey(%22process1%22).getId();%0A      fail(%22persistence exception is expected%22);%0A    %7D catch (ProcessEngineException ex) %7B%0A      assertTrue(ex.getMessage().contains(%22insertHistoricTaskInstanceEvent%22));%0A    %7D%0A  %7D%0A%0A%7D%0A

test persistence exception reason appropriately logged