Merge branch '6.0.x'
This commit is contained in:
commit
2cdc114273
|
|
@ -107,9 +107,9 @@ dependencies {
|
|||
api("org.apache.tomcat.embed:tomcat-embed-websocket:10.1.14")
|
||||
api("org.apache.tomcat:tomcat-util:10.1.14")
|
||||
api("org.apache.tomcat:tomcat-websocket:10.1.14")
|
||||
api("org.aspectj:aspectjrt:1.9.20")
|
||||
api("org.aspectj:aspectjtools:1.9.20")
|
||||
api("org.aspectj:aspectjweaver:1.9.20")
|
||||
api("org.aspectj:aspectjrt:1.9.20.1")
|
||||
api("org.aspectj:aspectjtools:1.9.20.1")
|
||||
api("org.aspectj:aspectjweaver:1.9.20.1")
|
||||
api("org.assertj:assertj-core:3.24.2")
|
||||
api("org.awaitility:awaitility:4.2.0")
|
||||
api("org.bouncycastle:bcpkix-jdk18on:1.72")
|
||||
|
|
@ -142,7 +142,7 @@ dependencies {
|
|||
api("org.seleniumhq.selenium:htmlunit-driver:2.70.0")
|
||||
api("org.seleniumhq.selenium:selenium-java:3.141.59")
|
||||
api("org.skyscreamer:jsonassert:1.5.1")
|
||||
api("org.slf4j:slf4j-api:2.0.7")
|
||||
api("org.slf4j:slf4j-api:2.0.9")
|
||||
api("org.testng:testng:7.8.0")
|
||||
api("org.webjars:underscorejs:1.8.3")
|
||||
api("org.webjars:webjars-locator-core:0.53")
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ public abstract class ConnectionFactoryUtils {
|
|||
if (conHolder != null && connectionEquals(conHolder, connection)) {
|
||||
// It's the transactional Connection: Don't close it.
|
||||
conHolder.released();
|
||||
return Mono.empty();
|
||||
}
|
||||
return Mono.from(connection.close());
|
||||
}).onErrorResume(NoTransactionException.class, ex -> Mono.from(connection.close()));
|
||||
|
|
@ -301,13 +302,13 @@ public abstract class ConnectionFactoryUtils {
|
|||
* @return the innermost target Connection, or the passed-in one if not wrapped
|
||||
* @see Wrapped#unwrap()
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Connection getTargetConnection(Connection con) {
|
||||
Object conToUse = con;
|
||||
while (conToUse instanceof Wrapped wrapped) {
|
||||
conToUse = wrapped.unwrap();
|
||||
Connection conToUse = con;
|
||||
while (conToUse instanceof Wrapped<?>) {
|
||||
conToUse = ((Wrapped<Connection>) conToUse).unwrap();
|
||||
}
|
||||
return (Connection) conToUse;
|
||||
return conToUse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
|
|
@ -231,7 +231,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory
|
|||
*/
|
||||
protected Connection getCloseSuppressingConnectionProxy(Connection target) {
|
||||
return (Connection) Proxy.newProxyInstance(SingleConnectionFactory.class.getClassLoader(),
|
||||
new Class<?>[] { Connection.class, Wrapped.class }, new CloseSuppressingInvocationHandler(target));
|
||||
new Class<?>[] {Connection.class, Wrapped.class}, new CloseSuppressingInvocationHandler(target));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ final class DefaultDatabaseClient implements DatabaseClient {
|
|||
*/
|
||||
private static Connection createConnectionProxy(Connection con) {
|
||||
return (Connection) Proxy.newProxyInstance(DatabaseClient.class.getClassLoader(),
|
||||
new Class<?>[] { Connection.class, Wrapped.class },
|
||||
new Class<?>[] {Connection.class, Wrapped.class},
|
||||
new CloseSuppressingInvocationHandler(con));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class R2dbcTransactionManagerUnitTests {
|
|||
|
||||
|
||||
@BeforeEach
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
void before() {
|
||||
when(connectionFactoryMock.create()).thenReturn((Mono) Mono.just(connectionMock));
|
||||
when(connectionMock.beginTransaction(any(io.r2dbc.spi.TransactionDefinition.class))).thenReturn(Mono.empty());
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class TransactionAwareConnectionFactoryProxyUnitTests {
|
|||
|
||||
|
||||
@BeforeEach
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
void before() {
|
||||
when(connectionFactoryMock.create()).thenReturn((Mono) Mono.just(connectionMock1),
|
||||
(Mono) Mono.just(connectionMock2), (Mono) Mono.just(connectionMock3));
|
||||
|
|
@ -146,14 +146,15 @@ class TransactionAwareConnectionFactoryProxyUnitTests {
|
|||
ConnectionFactoryUtils.getConnection(connectionFactoryMock)
|
||||
.doOnNext(transactionalConnection::set).flatMap(connection -> proxyCf.create()
|
||||
.doOnNext(wrappedConnection -> assertThat(((Wrapped<?>) wrappedConnection).unwrap()).isSameAs(connection)))
|
||||
.as(rxtx::transactional)
|
||||
.flatMapMany(Connection::close)
|
||||
.as(rxtx::transactional)
|
||||
.as(StepVerifier::create)
|
||||
.verifyComplete();
|
||||
|
||||
verify(connectionFactoryMock, times(1)).create();
|
||||
verify(connectionMock1, times(1)).close();
|
||||
verifyNoInteractions(connectionMock2);
|
||||
verifyNoInteractions(connectionMock3);
|
||||
verify(connectionFactoryMock, times(1)).create();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,13 +34,14 @@ public class MapConnectionFactoryLookupUnitTests {
|
|||
|
||||
private static final String CONNECTION_FACTORY_NAME = "connectionFactory";
|
||||
|
||||
|
||||
@Test
|
||||
public void getConnectionFactoriesReturnsUnmodifiableMap() {
|
||||
MapConnectionFactoryLookup lookup = new MapConnectionFactoryLookup();
|
||||
Map<String, ConnectionFactory> connectionFactories = lookup.getConnectionFactories();
|
||||
|
||||
assertThatThrownBy(() -> connectionFactories.put("",
|
||||
new DummyConnectionFactory())).isInstanceOf(UnsupportedOperationException.class);
|
||||
assertThatThrownBy(() -> connectionFactories.put("", new DummyConnectionFactory()))
|
||||
.isInstanceOf(UnsupportedOperationException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -52,8 +53,8 @@ public class MapConnectionFactoryLookupUnitTests {
|
|||
MapConnectionFactoryLookup lookup = new MapConnectionFactoryLookup();
|
||||
lookup.setConnectionFactories(connectionFactories);
|
||||
|
||||
ConnectionFactory connectionFactory = lookup.getConnectionFactory(CONNECTION_FACTORY_NAME);
|
||||
assertThat(connectionFactory).isNotNull().isSameAs(expectedConnectionFactory);
|
||||
assertThat(lookup.getConnectionFactory(CONNECTION_FACTORY_NAME))
|
||||
.isNotNull().isSameAs(expectedConnectionFactory);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -67,12 +68,12 @@ public class MapConnectionFactoryLookupUnitTests {
|
|||
lookup.setConnectionFactories(connectionFactories);
|
||||
lookup.addConnectionFactory(CONNECTION_FACTORY_NAME, expectedConnectionFactory);
|
||||
|
||||
ConnectionFactory connectionFactory = lookup.getConnectionFactory(CONNECTION_FACTORY_NAME);
|
||||
assertThat(connectionFactory).isNotNull().isSameAs(expectedConnectionFactory);
|
||||
assertThat(lookup.getConnectionFactory(CONNECTION_FACTORY_NAME))
|
||||
.isNotNull().isSameAs(expectedConnectionFactory);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void getConnectionFactoryWhereSuppliedMapHasNonConnectionFactoryTypeUnderSpecifiedKey() {
|
||||
Map connectionFactories = new HashMap<>();
|
||||
connectionFactories.put(CONNECTION_FACTORY_NAME, new Object());
|
||||
|
|
@ -86,8 +87,9 @@ public class MapConnectionFactoryLookupUnitTests {
|
|||
public void getConnectionFactoryWhereSuppliedMapHasNoEntryForSpecifiedKey() {
|
||||
MapConnectionFactoryLookup lookup = new MapConnectionFactoryLookup();
|
||||
|
||||
assertThatThrownBy(() -> lookup.getConnectionFactory(CONNECTION_FACTORY_NAME))
|
||||
.isInstanceOf(ConnectionFactoryLookupFailureException.class);
|
||||
assertThatThrownBy(
|
||||
() -> lookup.getConnectionFactory(CONNECTION_FACTORY_NAME)).isInstanceOf(
|
||||
ConnectionFactoryLookupFailureException.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,8 +84,9 @@ public class NamedParameterUtilsUnitTests {
|
|||
@Test
|
||||
public void substituteObjectArray() {
|
||||
MapBindParameterSource namedParams = new MapBindParameterSource(new HashMap<>());
|
||||
namedParams.addValue("a", Arrays.asList(new Object[] { "Walter", "Heisenberg" },
|
||||
new Object[] { "Walt Jr.", "Flynn" }));
|
||||
namedParams.addValue("a",
|
||||
Arrays.asList(new Object[] {"Walter", "Heisenberg"},
|
||||
new Object[] {"Walt Jr.", "Flynn"}));
|
||||
|
||||
PreparedOperation<?> operation = NamedParameterUtils.substituteNamedParameters(
|
||||
"xxx :a", BIND_MARKERS, namedParams);
|
||||
|
|
@ -96,8 +97,9 @@ public class NamedParameterUtilsUnitTests {
|
|||
@Test
|
||||
public void shouldBindObjectArray() {
|
||||
MapBindParameterSource namedParams = new MapBindParameterSource(new HashMap<>());
|
||||
namedParams.addValue("a", Arrays.asList(new Object[] { "Walter", "Heisenberg" },
|
||||
new Object[] { "Walt Jr.", "Flynn" }));
|
||||
namedParams.addValue("a",
|
||||
Arrays.asList(new Object[] {"Walter", "Heisenberg"},
|
||||
new Object[] {"Walt Jr.", "Flynn"}));
|
||||
|
||||
BindTarget bindTarget = mock();
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ class IndexedBindMarkersUnitTests {
|
|||
@Test
|
||||
void shouldCreateNewBindMarkers() {
|
||||
BindMarkersFactory factory = BindMarkersFactory.indexed("$", 0);
|
||||
|
||||
BindMarkers bindMarkers1 = factory.create();
|
||||
BindMarkers bindMarkers2 = factory.create();
|
||||
|
||||
|
|
@ -43,7 +42,6 @@ class IndexedBindMarkersUnitTests {
|
|||
@Test
|
||||
void shouldCreateNewBindMarkersWithOffset() {
|
||||
BindTarget bindTarget = mock();
|
||||
|
||||
BindMarkers bindMarkers = BindMarkersFactory.indexed("$", 1).create();
|
||||
|
||||
BindMarker first = bindMarkers.next();
|
||||
|
|
@ -60,10 +58,9 @@ class IndexedBindMarkersUnitTests {
|
|||
|
||||
@Test
|
||||
void nextShouldIncrementBindMarker() {
|
||||
String[] prefixes = { "$", "?" };
|
||||
String[] prefixes = {"$", "?"};
|
||||
|
||||
for (String prefix : prefixes) {
|
||||
|
||||
BindMarkers bindMarkers = BindMarkersFactory.indexed(prefix, 0).create();
|
||||
|
||||
BindMarker marker1 = bindMarkers.next();
|
||||
|
|
@ -76,9 +73,7 @@ class IndexedBindMarkersUnitTests {
|
|||
|
||||
@Test
|
||||
void bindValueShouldBindByIndex() {
|
||||
|
||||
BindTarget bindTarget = mock();
|
||||
|
||||
BindMarkers bindMarkers = BindMarkersFactory.indexed("$", 0).create();
|
||||
|
||||
bindMarkers.next().bind(bindTarget, "foo");
|
||||
|
|
@ -91,7 +86,6 @@ class IndexedBindMarkersUnitTests {
|
|||
@Test
|
||||
void bindNullShouldBindByIndex() {
|
||||
BindTarget bindTarget = mock();
|
||||
|
||||
BindMarkers bindMarkers = BindMarkersFactory.indexed("$", 0).create();
|
||||
|
||||
bindMarkers.next(); // ignore
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class NamedBindMarkersUnitTests {
|
|||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "$", "?" })
|
||||
@ValueSource(strings = {"$", "?"})
|
||||
void nextShouldIncrementBindMarker(String prefix) {
|
||||
BindMarkers bindMarkers = BindMarkersFactory.named(prefix, "p", 32).create();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue