Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
<tx:annotation-driven/>
<int:annotation-config/>

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/int30"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
<property name="maxActive" value="10"/>
<property name="defaultAutoCommit" value="false"/>
</bean>
<bean id="dataSource" class="org.springframework.integration.jdbc.mysql.MySqlContainerTest"
factory-method="dataSource"/>

<jdbc:initialize-database>
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-drop-mysql.sql" />
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-mysql.sql" />
</jdbc:initialize-database>

<int-jdbc:message-store id="messageStore" data-source="dataSource" region="MessageStoreMultipleChannelTests"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.commons.logging.LogFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -55,8 +54,7 @@
*/
@SpringJUnitConfig
@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
@Disabled
public class MySqlJdbcMessageStoreMultipleChannelTests {
public class MySqlJdbcMessageStoreMultipleChannelTests implements MySqlContainerTest {

private static final Log LOG = LogFactory.getLog(MySqlJdbcMessageStoreMultipleChannelTests.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -545,8 +545,7 @@ PlatformTransactionManager transactionManager() {
DataSourceInitializer dataSourceInitializer() {
DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
dataSourceInitializer.setDataSource(dataSource());
dataSourceInitializer.setDatabasePopulator(new ResourceDatabasePopulator(this.createSchemaScript));
dataSourceInitializer.setDatabaseCleaner(new ResourceDatabasePopulator(this.dropSchemaScript));
dataSourceInitializer.setDatabasePopulator(new ResourceDatabasePopulator(this.dropSchemaScript, this.createSchemaScript));
return dataSourceInitializer;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 the original author or authors.
* Copyright 2024-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,6 +75,9 @@ static class TestConfiguration {
@Value("org/springframework/integration/jdbc/schema-mysql.sql")
Resource createSchemaScript;

@Value("org/springframework/integration/jdbc/schema-drop-mysql.sql")
Resource dropSchemaScript;

@Bean
DataSource dataSource() {
return MySqlContainerTest.dataSource();
Expand All @@ -84,7 +87,7 @@ DataSource dataSource() {
DataSourceInitializer dataSourceInitializer(DataSource dataSource) {
DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
dataSourceInitializer.setDataSource(dataSource);
dataSourceInitializer.setDatabasePopulator(new ResourceDatabasePopulator(this.createSchemaScript));
dataSourceInitializer.setDatabasePopulator(new ResourceDatabasePopulator(this.dropSchemaScript, this.createSchemaScript));
return dataSourceInitializer;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2024 the original author or authors.
* Copyright 2022-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,9 @@

package org.springframework.integration.jdbc.postgres;

import javax.sql.DataSource;

import org.apache.commons.dbcp2.BasicDataSource;
import org.junit.jupiter.api.BeforeAll;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
Expand Down Expand Up @@ -60,4 +63,13 @@ static String getPassword() {
return POSTGRES_CONTAINER.getPassword();
}

static DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(POSTGRES_CONTAINER.getDriverClassName());
dataSource.setUrl(POSTGRES_CONTAINER.getJdbcUrl());
dataSource.setUsername(POSTGRES_CONTAINER.getUsername());
dataSource.setPassword(POSTGRES_CONTAINER.getPassword());
return dataSource;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
@DirtiesContext // close at the end after class
public abstract class AbstractTxTimeoutMessageStoreTests {

private static final Log log = LogFactory.getLog(AbstractTxTimeoutMessageStoreTests.class);
protected final Log log = LogFactory.getLog(this.getClass());

@Autowired
protected DataSource dataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">

<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-common-context.xml" />

<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
<property name="connectionCachingEnabled" value="true" />
<property name="URL" value="jdbc:oracle:thin:@//[HOST]:1521/XE" />
<property name="user" value="[USER]" />
<property name="password" value="[PASSWORD]" />
<property name="connectionCacheProperties">
<props merge="default">
<prop key="MinLimit">3</prop>
<prop key="MaxLimit">20</prop>
</props>
</property>
</bean>
<bean id="dataSource" class="org.springframework.integration.jdbc.oracle.OracleContainerTest"
factory-method="dataSource"/>

<bean id="queryProvider" class="org.springframework.integration.jdbc.store.channel.OracleChannelMessageStoreQueryProvider"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd">

<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-common-context.xml" />

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="initialSize" value="10"/>
<property name="url"
value="jdbc:postgresql:integration" />
<property name="username" value="postgres" />
<property name="password" value="postgres" />
</bean>
<bean id="dataSource" class="org.springframework.integration.jdbc.postgres.PostgresContainerTest"
factory-method="dataSource" />

<jdbc:initialize-database>
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-drop-postgresql.sql" />
<jdbc:script location="classpath:org/springframework/integration/jdbc/schema-postgresql.sql" />
</jdbc:initialize-database>

<bean id="queryProvider" class="org.springframework.integration.jdbc.store.channel.PostgresChannelMessageStoreQueryProvider"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<?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 https://www.springframework.org/schema/beans/spring-beans.xsd">
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">

<util:properties id="props">
<prop key="concurrentPoll.fixedRate">2000</prop>
<prop key="concurrentPoll.fixedDelay">1000</prop>
</util:properties>

<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-hsql-context.xml"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,9 +16,7 @@

package org.springframework.integration.jdbc.store.channel;

import org.junit.Rule;

import org.springframework.integration.test.support.LongRunningIntegrationTest;
import org.springframework.integration.test.condition.LongRunningTest;
import org.springframework.test.context.ContextConfiguration;

/**
Expand All @@ -27,10 +25,8 @@
* @author Artem Bilan
*
*/
@LongRunningTest
@ContextConfiguration
public class HsqlTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests {

@Rule
public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest();

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<?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 https://www.springframework.org/schema/beans/spring-beans.xsd">
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">

<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-mysql-context.xml"/>

<import resource="classpath:org/springframework/integration/jdbc/store/channel/TxTimeoutMessageStoreTests-context.xml"/>

<util:properties id="props">
<prop key="concurrentPoll.fixedRate">2000</prop>
<prop key="concurrentPoll.fixedDelay">1000</prop>
</util:properties>

</beans>

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.springframework.integration.jdbc.store.channel;

import org.junit.jupiter.api.Disabled;

import org.springframework.integration.jdbc.mysql.MySqlContainerTest;
import org.springframework.test.context.ContextConfiguration;

/**
Expand All @@ -26,8 +25,7 @@
* @author Artem Bilan
*
*/
@Disabled
@ContextConfiguration
public class MySqlTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests {
public class MySqlTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests implements MySqlContainerTest {

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<?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 https://www.springframework.org/schema/beans/spring-beans.xsd">
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">

<import resource="classpath:org/springframework/integration/jdbc/store/channel/DataSource-oracle-context.xml"/>

<import resource="classpath:org/springframework/integration/jdbc/store/channel/TxTimeoutMessageStoreTests-context.xml"/>

<util:properties id="props">
<prop key="concurrentPoll.fixedRate">2000</prop>
<prop key="concurrentPoll.fixedDelay">1000</prop>
</util:properties>

</beans>

Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,31 @@

package org.springframework.integration.jdbc.store.channel;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.AfterEach;

import org.springframework.integration.jdbc.oracle.OracleContainerTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.support.TransactionTemplate;

/**
*
* @author Gunnar Hillert
* @author Artem Bilan
*
*/
@Disabled
@ContextConfiguration
public class OracleTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests {
public class OracleTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests implements OracleContainerTest {

@AfterEach
public void cleanTable() {
final JdbcTemplate jdbcTemplate = new JdbcTemplate(this.dataSource);
new TransactionTemplate(this.transactionManager).execute(status -> {
final int deletedChannelMessageRows = jdbcTemplate.update("delete from INT_CHANNEL_MESSAGE");
log.info(String.format("Cleaning Database - Deleted Channel Messages: %s ",
deletedChannelMessageRows));
return null;
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package org.springframework.integration.jdbc.store.channel;

import org.junit.jupiter.api.Disabled;

import org.springframework.integration.jdbc.postgres.PostgresContainerTest;
import org.springframework.test.context.ContextConfiguration;

/**
Expand All @@ -26,8 +25,7 @@
* @author Artem Bilan
*
*/
@Disabled
@ContextConfiguration
public class PostgresTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests {
public class PostgresTxTimeoutMessageStoreTests extends AbstractTxTimeoutMessageStoreTests implements PostgresContainerTest {

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/task https://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">

<util:properties id="props">
<prop key="concurrentPoll.fixedRate">200</prop>
<prop key="concurrentPoll.fixedDelay">100</prop>
</util:properties>

<int:transaction-synchronization-factory id="syncFactory">
<int:before-commit expression="@store.removeFromIdCache(headers.id.toString())"/>
Expand Down Expand Up @@ -69,7 +76,7 @@
</int:channel>

<int:bridge input-channel="first" output-channel="second">
<int:poller fixed-rate="200" task-executor="threadPoolTaskExecutor" max-messages-per-poll="3">
<int:poller fixed-rate="#{props['concurrentPoll.fixedRate']}" task-executor="threadPoolTaskExecutor" max-messages-per-poll="3">
<int:transactional transaction-manager="transactionManager"/>
</int:poller>
</int:bridge>
Expand All @@ -79,7 +86,7 @@
</bean>

<int:outbound-channel-adapter channel="second" expression="@successfulLatch.countDown()">
<int:poller fixed-delay="100">
<int:poller fixed-delay="#{props['concurrentPoll.fixedDelay']}">
<int:transactional transaction-manager="transactionManager"/>
</int:poller>
</int:outbound-channel-adapter>
Expand Down