Some JDBC tests clean up; use H2 mostly
This commit is contained in:
@@ -106,7 +106,7 @@ ext {
|
||||
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.3.0-SNAPSHOT'
|
||||
springWsVersion = '3.0.9.RELEASE'
|
||||
tomcatVersion = "9.0.37"
|
||||
xstreamVersion = '1.4.12'
|
||||
xstreamVersion = '1.4.13'
|
||||
|
||||
javaProjects = subprojects - project(':spring-integration-bom')
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
@@ -12,16 +11,13 @@
|
||||
http://www.springframework.org/schema/jdbc
|
||||
https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc
|
||||
https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd">
|
||||
|
||||
<context:property-placeholder location="int-derby.properties"/>
|
||||
<jdbc:embedded-database id="dataSource" type="H2"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
<jdbc:initialize-database ignore-failures="DROPS">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-drop-h2.sql"/>
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-h2.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore" data-source="dataSource"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -19,15 +19,14 @@ package org.springframework.integration.jdbc;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.expression.Expression;
|
||||
@@ -39,6 +38,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
@@ -51,24 +52,26 @@ public class StoredProcMessageHandlerDerbyIntegrationTests {
|
||||
|
||||
private static JdbcTemplate jdbcTemplate;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUp() throws SQLException {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
|
||||
builder.setType(EmbeddedDatabaseType.DERBY);
|
||||
builder.addScript("classpath:derby-stored-procedures.sql");
|
||||
embeddedDatabase = builder.build();
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
embeddedDatabase =
|
||||
new EmbeddedDatabaseBuilder()
|
||||
.setType(EmbeddedDatabaseType.DERBY)
|
||||
.addScript("classpath:derby-stored-procedures.sql")
|
||||
.build();
|
||||
jdbcTemplate = new JdbcTemplate(embeddedDatabase);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
@AfterAll
|
||||
public static void tearDown() {
|
||||
embeddedDatabase.shutdown();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void cleanup() {
|
||||
jdbcTemplate.execute("DELETE FROM USERS");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDerbyStoredProcedureInsertWithDefaultSqlSource() {
|
||||
StoredProcExecutor storedProcExecutor = new StoredProcExecutor(embeddedDatabase);
|
||||
@@ -152,7 +155,7 @@ public class StoredProcMessageHandlerDerbyIntegrationTests {
|
||||
|
||||
storedProcExecutor.setStoredProcedureName("CREATE_USER");
|
||||
|
||||
final List<ProcedureParameter> procedureParameters = new ArrayList<ProcedureParameter>();
|
||||
final List<ProcedureParameter> procedureParameters = new ArrayList<>();
|
||||
procedureParameters.add(new ProcedureParameter("username", null, "payload.username.toUpperCase()"));
|
||||
procedureParameters.add(new ProcedureParameter("password", null, "payload.password.toUpperCase()"));
|
||||
procedureParameters.add(new ProcedureParameter("email", null, "payload.email.toUpperCase()"));
|
||||
@@ -164,8 +167,8 @@ public class StoredProcMessageHandlerDerbyIntegrationTests {
|
||||
messageHandler.setBeanFactory(mock(BeanFactory.class));
|
||||
messageHandler.afterPropertiesSet();
|
||||
|
||||
MessageBuilder<User> message = MessageBuilder.withPayload(new User("Eric.Cartman", "c4rtm4n", "eric@cartman.com"));
|
||||
messageHandler.handleMessage(message.build());
|
||||
Message<User> message = new GenericMessage<>(new User("Eric.Cartman", "c4rtm4n", "eric@cartman.com"));
|
||||
messageHandler.handleMessage(message);
|
||||
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap("SELECT * FROM USERS WHERE USERNAME=?", "ERIC.CARTMAN");
|
||||
|
||||
@@ -181,8 +184,9 @@ public class StoredProcMessageHandlerDerbyIntegrationTests {
|
||||
|
||||
storedProcExecutor.setStoredProcedureName("CREATE_USER");
|
||||
|
||||
final List<ProcedureParameter> procedureParameters = new ArrayList<ProcedureParameter>();
|
||||
procedureParameters.add(new ProcedureParameter("USERNAME", null, "headers[business_id] + '_' + payload.username"));
|
||||
final List<ProcedureParameter> procedureParameters = new ArrayList<>();
|
||||
procedureParameters.add(new ProcedureParameter("USERNAME", null,
|
||||
"headers[business_id] + '_' + payload.username"));
|
||||
procedureParameters.add(new ProcedureParameter("password", "static_password", null));
|
||||
procedureParameters.add(new ProcedureParameter("email", "static_email", null));
|
||||
|
||||
@@ -193,9 +197,11 @@ public class StoredProcMessageHandlerDerbyIntegrationTests {
|
||||
messageHandler.setBeanFactory(mock(BeanFactory.class));
|
||||
messageHandler.afterPropertiesSet();
|
||||
|
||||
MessageBuilder<User> message = MessageBuilder.withPayload(new User("Eric.Cartman", "c4rtm4n", "eric@cartman.com"));
|
||||
message.setHeader("business_id", "1234");
|
||||
messageHandler.handleMessage(message.build());
|
||||
Message<User> message =
|
||||
MessageBuilder.withPayload(new User("Eric.Cartman", "c4rtm4n", "eric@cartman.com"))
|
||||
.setHeader("business_id", "1234")
|
||||
.build();
|
||||
messageHandler.handleMessage(message);
|
||||
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap("SELECT * FROM USERS WHERE USERNAME=?", "1234_Eric.Cartman");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.integration.jdbc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.util.Collection;
|
||||
@@ -26,8 +26,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -50,17 +49,15 @@ import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext // close at the end after class
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
@@ -90,9 +87,7 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
SqlReturnType clobSqlReturnType;
|
||||
|
||||
@Test
|
||||
@DirtiesContext
|
||||
public void executeStoredProcedureWithMessageHeader() throws Exception {
|
||||
|
||||
public void executeStoredProcedureWithMessageHeader() {
|
||||
User user1 = new User("First User", "my first password", "email1");
|
||||
User user2 = new User("Second User", "my second password", "email2");
|
||||
|
||||
@@ -122,9 +117,7 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DirtiesContext
|
||||
public void testWithMissingMessageHeader() throws Exception {
|
||||
|
||||
public void testWithMissingMessageHeader() {
|
||||
User user1 = new User("First User", "my first password", "email1");
|
||||
|
||||
Message<User> user1Message = MessageBuilder.withPayload(user1).build();
|
||||
@@ -153,7 +146,7 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
|
||||
this.jdbcTemplate.update("INSERT INTO json_message VALUES (?,?)", messageId, jsonMessage);
|
||||
|
||||
this.getMessageChannel.send(new GenericMessage<String>(messageId));
|
||||
this.getMessageChannel.send(new GenericMessage<>(messageId));
|
||||
Message<?> resultMessage = this.output2Channel.receive(10000);
|
||||
assertThat(resultMessage).isNotNull();
|
||||
Object resultPayload = resultMessage.getPayload();
|
||||
@@ -163,31 +156,27 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
assertThat(message.getPayload()).isEqualTo(testMessage.getPayload());
|
||||
assertThat(message.getHeaders().get("FOO")).isEqualTo(testMessage.getHeaders().get("FOO"));
|
||||
Mockito.verify(clobSqlReturnType).getTypeValue(Mockito.any(CallableStatement.class),
|
||||
Mockito.eq(2), Mockito.eq(JdbcTypesEnum.CLOB.getCode()), Mockito.eq((String) null));
|
||||
Mockito.eq(2), Mockito.eq(JdbcTypesEnum.CLOB.getCode()), Mockito.eq(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoIllegalArgumentButRequiresReplyException() {
|
||||
try {
|
||||
this.getMessageChannel.send(new GenericMessage<String>("foo"));
|
||||
fail("ReplyRequiredException expected");
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertThat(e).isInstanceOf(ReplyRequiredException.class);
|
||||
}
|
||||
assertThatExceptionOfType(ReplyRequiredException.class)
|
||||
.isThrownBy(() -> this.getMessageChannel.send(new GenericMessage<>("foo")));
|
||||
}
|
||||
|
||||
static class Counter {
|
||||
|
||||
private final AtomicInteger count = new AtomicInteger();
|
||||
|
||||
public Integer next() throws InterruptedException {
|
||||
public Integer next() {
|
||||
if (count.get() > 2) {
|
||||
//prevent message overload
|
||||
return null;
|
||||
}
|
||||
return count.incrementAndGet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +186,7 @@ public class StoredProcOutboundGatewayWithSpelIntegrationTests {
|
||||
*/
|
||||
static class Consumer {
|
||||
|
||||
private volatile BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<Message<Collection<User>>>();
|
||||
private volatile BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<Collection<User>> message) {
|
||||
|
||||
@@ -1,44 +1,37 @@
|
||||
<?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:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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/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
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<import resource="classpath:derby-stored-procedures-setup-context.xml"/>
|
||||
|
||||
<int:poller id="defaultPoller" default="true" fixed-rate="5000"/>
|
||||
|
||||
<int:gateway id="startGateway" default-request-channel="startChannel"
|
||||
service-interface="org.springframework.integration.jdbc.storedproc.CreateUser" />
|
||||
service-interface="org.springframework.integration.jdbc.storedproc.CreateUser"/>
|
||||
|
||||
<int:channel id="startChannel"/>
|
||||
|
||||
<bean id="storedProcExecutor" class="org.springframework.integration.jdbc.StoredProcExecutor">
|
||||
<constructor-arg name="dataSource" ref="dataSource"/>
|
||||
<property name="storedProcedureName" value="CREATE_USER_RETURN_ALL"/>
|
||||
<property name="isFunction" value="false"/>
|
||||
<property name="isFunction" value="false"/>
|
||||
<property name="procedureParameters">
|
||||
<util:list>
|
||||
<bean class="org.springframework.integration.jdbc.storedproc.ProcedureParameter">
|
||||
<property name="name" value="username"/>
|
||||
<property name="name" value="username"/>
|
||||
<property name="expression" value="payload.username"/>
|
||||
</bean>
|
||||
<bean class="org.springframework.integration.jdbc.storedproc.ProcedureParameter">
|
||||
<property name="name" value="password"/>
|
||||
<property name="name" value="password"/>
|
||||
<property name="expression" value="payload.password"/>
|
||||
</bean>
|
||||
<bean class="org.springframework.integration.jdbc.storedproc.ProcedureParameter">
|
||||
<property name="name" value="email"/>
|
||||
<property name="name" value="email"/>
|
||||
<property name="expression" value="payload.email"/>
|
||||
</bean>
|
||||
</util:list>
|
||||
@@ -50,24 +43,25 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="gateway" class="org.springframework.integration.jdbc.StoredProcOutboundGateway">
|
||||
<constructor-arg name="storedProcExecutor" ref="storedProcExecutor" />
|
||||
<property name="expectSingleResult" value="true"/>
|
||||
<property name="outputChannel" ref="outputChannel"/>
|
||||
<bean id="gateway" class="org.springframework.integration.jdbc.StoredProcOutboundGateway">
|
||||
<constructor-arg name="storedProcExecutor" ref="storedProcExecutor"/>
|
||||
<property name="expectSingleResult" value="true"/>
|
||||
<property name="outputChannel" ref="outputChannel"/>
|
||||
</bean>
|
||||
|
||||
<bean id="storedProcedureEndpoint"
|
||||
class="org.springframework.integration.endpoint.EventDrivenConsumer">
|
||||
class="org.springframework.integration.endpoint.EventDrivenConsumer">
|
||||
<constructor-arg name="inputChannel" ref="startChannel"/>
|
||||
<constructor-arg name="handler" ref="gateway"/>
|
||||
<constructor-arg name="handler" ref="gateway"/>
|
||||
</bean>
|
||||
|
||||
<bean id="rowMapper" class="org.springframework.integration.jdbc.storedproc.UserMapper"/>
|
||||
|
||||
<int:channel id="outputChannel"/>
|
||||
|
||||
<int:service-activator id="consumerEndpoint" input-channel="outputChannel" ref="consumer" />
|
||||
<bean id="consumer" class="org.springframework.integration.jdbc.StoredProcOutboundGatewayWithSpringContextIntegrationTests$Consumer"/>
|
||||
<int:service-activator id="consumerEndpoint" input-channel="outputChannel" ref="consumer"/>
|
||||
<bean id="consumer"
|
||||
class="org.springframework.integration.jdbc.StoredProcOutboundGatewayWithSpringContextIntegrationTests$Consumer"/>
|
||||
|
||||
<int:logging-channel-adapter channel="errorChannel" log-full-message="true"/>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -26,8 +26,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
@@ -36,14 +35,13 @@ import org.springframework.integration.jdbc.storedproc.CreateUser;
|
||||
import org.springframework.integration.jdbc.storedproc.User;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
/**
|
||||
* @author Gunnar Hillert
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext // close at the end after class
|
||||
public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
|
||||
@@ -58,10 +56,9 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
createUser.createUser(new User("myUsername", "myPassword", "myEmail"));
|
||||
|
||||
List<Message<Collection<User>>> received = new ArrayList<Message<Collection<User>>>();
|
||||
List<Message<Collection<User>>> received = new ArrayList<>();
|
||||
|
||||
received.add(consumer.poll(2000));
|
||||
|
||||
@@ -81,19 +78,20 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
|
||||
private final AtomicInteger count = new AtomicInteger();
|
||||
|
||||
public Integer next() throws InterruptedException {
|
||||
public Integer next() {
|
||||
if (count.get() > 2) {
|
||||
//prevent message overload
|
||||
return null;
|
||||
}
|
||||
return Integer.valueOf(count.incrementAndGet());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<Message<Collection<User>>>();
|
||||
private final BlockingQueue<Message<Collection<User>>> messages = new LinkedBlockingQueue<>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<Collection<User>> message) {
|
||||
@@ -103,5 +101,7 @@ public class StoredProcOutboundGatewayWithSpringContextIntegrationTests {
|
||||
Message<Collection<User>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.springframework.util.StopWatch;
|
||||
@DirtiesContext
|
||||
public class JdbcLockRegistryDifferentClientTests {
|
||||
|
||||
private static Log logger = LogFactory.getLog(JdbcLockRegistryDifferentClientTests.class);
|
||||
private static final Log LOGGER = LogFactory.getLog(JdbcLockRegistryDifferentClientTests.class);
|
||||
|
||||
@Autowired
|
||||
private JdbcLockRegistry registry;
|
||||
@@ -218,7 +218,7 @@ public class JdbcLockRegistryDifferentClientTests {
|
||||
};
|
||||
tasks.add(task);
|
||||
}
|
||||
logger.info("Starting: " + i);
|
||||
LOGGER.info("Starting: " + i);
|
||||
pool.invokeAll(tasks);
|
||||
|
||||
assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
|
||||
|
||||
@@ -2,24 +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"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
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
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
<jdbc:embedded-database id="dataSource" type="H2"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
<jdbc:initialize-database ignore-failures="DROPS">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-drop-h2.sql"/>
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-h2.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
@@ -2,22 +2,16 @@
|
||||
<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"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
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
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
<jdbc:initialize-database ignore-failures="DROPS">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-drop-derby.sql"/>
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-derby.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
</bean>
|
||||
|
||||
@@ -6,18 +6,17 @@
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${int.schema.script}"/>
|
||||
<jdbc:initialize-database ignore-failures="DROPS">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-drop-derby.sql"/>
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-derby.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore" data-source="dataSource"/>
|
||||
@@ -56,11 +55,6 @@
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource"/>
|
||||
|
||||
@@ -5,18 +5,17 @@
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc.xsd
|
||||
http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jdbc https://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
|
||||
http://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="DERBY" />
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="${int.schema.script}" />
|
||||
<jdbc:initialize-database ignore-failures="DROPS">
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-drop-derby.sql"/>
|
||||
<jdbc:script location="org/springframework/integration/jdbc/schema-derby.sql" />
|
||||
</jdbc:initialize-database>
|
||||
|
||||
<int-jdbc:message-store id="messageStore"
|
||||
@@ -49,11 +48,6 @@
|
||||
</tx:attributes>
|
||||
</tx:advice>
|
||||
|
||||
<context:property-placeholder location="int-${ENVIRONMENT:derby}.properties"
|
||||
system-properties-mode="OVERRIDE"
|
||||
ignore-unresolvable="true"
|
||||
order="1"/>
|
||||
|
||||
<bean id="transactionManager"
|
||||
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
|
||||
Reference in New Issue
Block a user