Upgrade to H2 2.0.206
Turns out something is broken in H2 `Parser` for stored procedures. So, parameters are now doubled which is definitely not expected. * Disable those H2 tests where parametrized stored procedures are used
This commit is contained in:
@@ -66,7 +66,7 @@ ext {
|
||||
hazelcastVersion = '5.0.2'
|
||||
hibernateVersion = '5.6.1.Final'
|
||||
hsqldbVersion = '2.6.0'
|
||||
h2Version = '1.4.200'
|
||||
h2Version = '2.0.206'
|
||||
jacksonVersion = '2.13.0'
|
||||
jaxbVersion = '3.0.2'
|
||||
jeroMqVersion = '0.5.2'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2022 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,8 @@ import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -42,7 +42,6 @@ import org.springframework.integration.core.MessageSource;
|
||||
import org.springframework.integration.core.MessagingTemplate;
|
||||
import org.springframework.integration.jdbc.storedproc.PrimeMapper;
|
||||
import org.springframework.integration.jdbc.storedproc.ProcedureParameter;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
@@ -50,8 +49,7 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Equivalent to {@link StoredProcPollingChannelAdapterWithNamespaceIntegrationTests}.
|
||||
@@ -62,9 +60,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
@ContextConfiguration(classes = StoredProcJavaConfigTests.Config.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
@Disabled("H2 v2 is broken for stored procedures")
|
||||
public class StoredProcJavaConfigTests {
|
||||
|
||||
@Autowired
|
||||
@@ -118,24 +116,24 @@ public class StoredProcJavaConfigTests {
|
||||
StoredProcExecutor executor = new StoredProcExecutor(dataSource());
|
||||
executor.setIgnoreColumnMetaData(true);
|
||||
executor.setStoredProcedureName("GET_PRIME_NUMBERS");
|
||||
List<ProcedureParameter> procedureParameters = new ArrayList<ProcedureParameter>();
|
||||
List<ProcedureParameter> procedureParameters = new ArrayList<>();
|
||||
procedureParameters.add(new ProcedureParameter("beginRange", 1, null));
|
||||
procedureParameters.add(new ProcedureParameter("endRange", 10, null));
|
||||
executor.setProcedureParameters(procedureParameters);
|
||||
List<SqlParameter> sqlParameters = new ArrayList<SqlParameter>();
|
||||
List<SqlParameter> sqlParameters = new ArrayList<>();
|
||||
sqlParameters.add(new SqlParameter("beginRange", Types.INTEGER));
|
||||
sqlParameters.add(new SqlParameter("endRange", Types.INTEGER));
|
||||
executor.setSqlParameters(sqlParameters);
|
||||
executor.setReturningResultSetRowMappers(Collections.<String, RowMapper<?>>singletonMap("out", new PrimeMapper()));
|
||||
executor.setReturningResultSetRowMappers(Collections.singletonMap("out", new PrimeMapper()));
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.setType(EmbeddedDatabaseType.H2)
|
||||
.addScript("classpath:h2-stored-procedures.sql")
|
||||
.build();
|
||||
.setType(EmbeddedDatabaseType.H2)
|
||||
.addScript("classpath:h2-stored-procedures.sql")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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,24 +26,24 @@ 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.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
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 Gary Russell
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@DirtiesContext // close at the end after class
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
@Disabled("H2 v2 is broken for stored procedures")
|
||||
public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
@@ -55,15 +55,16 @@ public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void pollH2DatabaseUsingStoredProcedureCall() throws Exception {
|
||||
List<Message<?>> received = new ArrayList<Message<?>>();
|
||||
List<Message<?>> received = new ArrayList<>();
|
||||
|
||||
received.add(consumer.poll(60000));
|
||||
|
||||
Message<?> message = received.get(0);
|
||||
context.stop();
|
||||
assertThat(message).isNotNull();
|
||||
assertThat(message.getPayload()).isNotNull();
|
||||
assertThat(message.getPayload() instanceof Collection<?>).isNotNull();
|
||||
assertThat(message.getPayload())
|
||||
.isNotNull()
|
||||
.isInstanceOf(Collection.class);
|
||||
|
||||
List<Integer> primeNumbers = (List<Integer>) message.getPayload();
|
||||
|
||||
@@ -80,13 +81,14 @@ public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests {
|
||||
// prevent message overload
|
||||
return null;
|
||||
}
|
||||
return Integer.valueOf(count.incrementAndGet());
|
||||
return count.incrementAndGet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<Message<?>>();
|
||||
private final BlockingQueue<Message<?>> messages = new LinkedBlockingQueue<>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<?> message) {
|
||||
@@ -96,5 +98,7 @@ public class StoredProcPollingChannelAdapterWithNamespaceIntegrationTests {
|
||||
Message<?> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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,23 +26,23 @@ 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.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
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)
|
||||
@DirtiesContext // close at the end after class
|
||||
@SpringJUnitConfig
|
||||
@DirtiesContext
|
||||
@Disabled("H2 v2 is broken for stored procedures")
|
||||
public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
@@ -53,20 +53,20 @@ public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
List<Message<Collection<Integer>>> received = new ArrayList<Message<Collection<Integer>>>();
|
||||
List<Message<Collection<Integer>>> received = new ArrayList<>();
|
||||
|
||||
received.add(consumer.poll(2000));
|
||||
|
||||
Message<Collection<Integer>> message = received.get(0);
|
||||
context.stop();
|
||||
assertThat(message).isNotNull();
|
||||
assertThat(message.getPayload()).isNotNull();
|
||||
assertThat(message.getPayload() instanceof Collection<?>).isNotNull();
|
||||
assertThat(message.getPayload())
|
||||
.isNotNull()
|
||||
.isInstanceOf(Collection.class);
|
||||
|
||||
Collection<Integer> primeNumbers = message.getPayload();
|
||||
|
||||
assertThat(primeNumbers.size() == 4).isTrue();
|
||||
|
||||
}
|
||||
|
||||
static class Counter {
|
||||
@@ -78,13 +78,14 @@ public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
// prevent message overload
|
||||
return null;
|
||||
}
|
||||
return Integer.valueOf(count.incrementAndGet());
|
||||
return count.incrementAndGet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class Consumer {
|
||||
|
||||
private final BlockingQueue<Message<Collection<Integer>>> messages = new LinkedBlockingQueue<Message<Collection<Integer>>>();
|
||||
private final BlockingQueue<Message<Collection<Integer>>> messages = new LinkedBlockingQueue<>();
|
||||
|
||||
@ServiceActivator
|
||||
public void receive(Message<Collection<Integer>> message) {
|
||||
@@ -94,5 +95,7 @@ public class StoredProcPollingChannelAdapterWithSpringContextIntegrationTests {
|
||||
Message<Collection<Integer>> poll(long timeoutInMillis) throws InterruptedException {
|
||||
return messages.poll(timeoutInMillis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user