Skip to content

Commit

Permalink
More test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarrez committed Jul 3, 2024
1 parent c5bf75a commit 7d272cc
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,10 @@ public class EngineConfiguration {
@Bean
public DataSource dataSource() {
SimpleDriverDataSource ds = new SimpleDriverDataSource();
ds.setUrl(jdbcUrl);
ds.setDriverClass(jdbcDriver);

// Connection settings
ds.setUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000");
ds.setUsername(jdbcUsername);
ds.setPassword(jdbcPassword);

return ds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
*/
public class AbstractFlowableDmnEngineConfiguratorTest {

public static final String H2_TEST_JDBC_URL = "jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000";

@Rule
public FlowableRule flowableRule = new FlowableRule();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
*/
public class AbstractFlowableDmnTest {

public static final String H2_TEST_JDBC_URL = "jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000";

@Rule
public FlowableDmnRule flowableDmnRule = new FlowableDmnRule();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ public class EngineConfiguration {
@Bean
public DataSource dataSource() {
SimpleDriverDataSource ds = new SimpleDriverDataSource();
ds.setUrl(jdbcUrl);
ds.setDriverClass(jdbcDriver);

// Connection settings
ds.setUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000");
ds.setUsername(jdbcUsername);
ds.setPassword(jdbcPassword);

return ds;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
*/
package org.flowable.rest.conf.jpa;

import javax.sql.DataSource;
import java.sql.Driver;

import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
Expand All @@ -27,11 +28,25 @@
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import jakarta.persistence.EntityManagerFactory;

@Configuration(proxyBeanMethods = false)
@EnableJpaRepositories({ "org.flowable.rest.api.jpa.repository" })
@EnableTransactionManagement
public class DatabaseConfiguration {

@Value("${jdbc.url:jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000}")
protected String jdbcUrl;

@Value("${jdbc.driver:org.h2.Driver}")
protected Class<? extends Driver> jdbcDriver;

@Value("${jdbc.username:sa}")
protected String jdbcUsername;

@Value("${jdbc.password:}")
protected String jdbcPassword;

@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
Expand All @@ -50,12 +65,10 @@ public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
@Bean
public DataSource dataSource() {
SimpleDriverDataSource ds = new SimpleDriverDataSource();
ds.setDriverClass(org.h2.Driver.class);

// Connection settings
ds.setUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=1000");
ds.setUsername("sa");

ds.setUrl(jdbcUrl);
ds.setDriverClass(jdbcDriver);
ds.setUsername(jdbcUsername);
ds.setPassword(jdbcPassword);
return ds;
}

Expand Down

0 comments on commit 7d272cc

Please sign in to comment.