Skip to content

Commit

Permalink
fix(webapps): add skipIsolationLevelCheck to configuration on webapp …
Browse files Browse the repository at this point in the history
…init

Related to #4867
  • Loading branch information
joaquinfelici committed Jan 3, 2025
1 parent 7e310e0 commit 04cca3f
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void initFromProcessEngineConfiguration(ProcessEngineConfigurationImpl pr
setDatabaseType(processEngineConfiguration.getDatabaseType());
setDataSource(processEngineConfiguration.getDataSource());
setDatabaseTablePrefix(processEngineConfiguration.getDatabaseTablePrefix());
setSkipIsolationLevelCheck(processEngineConfiguration.getSkipIsolationLevelCheck());

setHistoryLevel(processEngineConfiguration.getHistoryLevel());
setHistory(processEngineConfiguration.getHistory());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.webapp.impl.db;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Collections;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

public class QuerySessionFactoryTest {

@Rule
public ProcessEngineRule processEngineRule = new ProcessEngineRule("camunda-skip-check.cfg.xml");

private ProcessEngineConfigurationImpl processEngineConfiguration;

@Before
public void setUp() throws Exception {
processEngineConfiguration = processEngineRule.getProcessEngineConfiguration();
}

@Test
public void testQuerySessionFactoryInitializationFromEngineConfig() {
// given
QuerySessionFactory querySessionFactory = new QuerySessionFactory();
processEngineConfiguration = processEngineRule.getProcessEngineConfiguration();

// when
querySessionFactory.initFromProcessEngineConfiguration(processEngineConfiguration, Collections.emptyList());

// then
assertThat(querySessionFactory.getWrappedConfiguration()).isEqualTo(processEngineConfiguration);
assertThat(querySessionFactory.getDatabaseType()).isEqualTo(processEngineConfiguration.getDatabaseType());
assertThat(querySessionFactory.getDataSource()).isEqualTo(processEngineConfiguration.getDataSource());
assertThat(querySessionFactory.getDatabaseTablePrefix()).isEqualTo(processEngineConfiguration.getDatabaseTablePrefix());
assertThat(querySessionFactory.getSkipIsolationLevelCheck()).isTrue();
assertThat(querySessionFactory.getHistoryLevel()).isEqualTo(processEngineConfiguration.getHistoryLevel());
assertThat(querySessionFactory.getHistory()).isEqualTo(processEngineConfiguration.getHistory());

}
}
41 changes: 41 additions & 0 deletions webapps/assembly/src/test/resources/camunda-skip-check.cfg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">


<bean id="idGenerator" class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />

<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">

<property name="jdbcUrl" value="${database.url}" />
<property name="jdbcDriver" value="${database.driver}" />
<property name="jdbcUsername" value="${database.username}" />
<property name="jdbcPassword" value="${database.password}" />

<!-- Database configurations -->
<property name="databaseSchemaUpdate" value="true" />
<property name="skipIsolationLevelCheck" value="true" />

<property name="idGenerator" ref="idGenerator" />

<!-- job executor configurations -->
<property name="jobExecutorActivate" value="false" />

<!-- turn on metrics reporter -->
<property name="metricsEnabled" value="true" />
<property name="dbMetricsReporterActivate" value="true" />
<property name="taskMetricsEnabled" value="true" />

<!-- mail server configurations -->
<property name="mailServerPort" value="5025" />
<property name="history" value="${history.level}" />

<property name="authorizationCheckRevokes" value="${authorizationCheckRevokes}"/>

<property name="jdbcBatchProcessing" value="${jdbcBatchProcessing}"/>
<property name="enforceHistoryTimeToLive" value="false" />

</bean>
</beans>

0 comments on commit 04cca3f

Please sign in to comment.