diff --git a/pom.xml b/pom.xml index 6612ad3..5575384 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,6 @@ 0.1.4 42.2.5 8.0.21 - 1.0.14 0.8.0.RELEASE 7.1.2.jre8-preview 2.5.4 @@ -242,13 +241,6 @@ test - - com.github.jasync-sql - jasync-r2dbc-mysql - ${jasync.version} - test - - dev.miku r2dbc-mysql diff --git a/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlDatabaseClientIntegrationTests.java b/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlDatabaseClientIntegrationTests.java deleted file mode 100644 index d2f3f2d..0000000 --- a/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlDatabaseClientIntegrationTests.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2019-2021 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.r2dbc.core; - -import io.r2dbc.spi.ConnectionFactory; - -import javax.sql.DataSource; - -import org.junit.Ignore; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import org.springframework.data.r2dbc.testing.ExternalDatabase; -import org.springframework.data.r2dbc.testing.MySqlTestSupport; - -/** - * Integration tests for {@link DatabaseClient} against MySQL using Jasync MySQL. - * - * @author Mark Paluch - */ -public class JasyncMySqlDatabaseClientIntegrationTests extends AbstractDatabaseClientIntegrationTests { - - @RegisterExtension public static final ExternalDatabase database = MySqlTestSupport.database(); - - @Override - protected DataSource createDataSource() { - return MySqlTestSupport.createDataSource(database); - } - - @Override - protected ConnectionFactory createConnectionFactory() { - return MySqlTestSupport.createJasyncConnectionFactory(database); - } - - @Override - protected String getCreateTableStatement() { - return MySqlTestSupport.CREATE_TABLE_LEGOSET; - } - - @Override - @Ignore("Jasync currently uses its own exceptions, see jasync-sql/jasync-sql#106") - @Test - public void shouldTranslateDuplicateKeyException() {} - -} diff --git a/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlTransactionalDatabaseClientIntegrationTests.java b/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlTransactionalDatabaseClientIntegrationTests.java deleted file mode 100644 index ae1fab7..0000000 --- a/src/test/java/org/springframework/data/r2dbc/core/JasyncMySqlTransactionalDatabaseClientIntegrationTests.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2019-2021 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.r2dbc.core; - -import io.r2dbc.spi.ConnectionFactory; -import reactor.core.publisher.Mono; - -import java.time.Duration; - -import javax.sql.DataSource; - -import org.junit.jupiter.api.extension.RegisterExtension; - -import org.springframework.data.r2dbc.testing.ExternalDatabase; -import org.springframework.data.r2dbc.testing.MySqlTestSupport; -import org.springframework.r2dbc.core.DatabaseClient; - -/** - * Transactional integration tests for {@link DatabaseClient} against MySQL using Jasync MySQL. - * - * @author Mark Paluch - */ -public class JasyncMySqlTransactionalDatabaseClientIntegrationTests - extends AbstractTransactionalDatabaseClientIntegrationTests { - - @RegisterExtension public static final ExternalDatabase database = MySqlTestSupport.database(); - - @Override - protected DataSource createDataSource() { - return MySqlTestSupport.createDataSource(database); - } - - @Override - protected ConnectionFactory createConnectionFactory() { - return MySqlTestSupport.createJasyncConnectionFactory(database); - } - - @Override - protected String getCreateTableStatement() { - return MySqlTestSupport.CREATE_TABLE_LEGOSET; - } - - @Override - protected Mono prepareForTransaction(DatabaseClient client) { - - /* - * We have to execute a sql statement first. - * Otherwise MySql don't have a transaction id. - * And we need to delay emitting the result so that MySql has time to write the transaction id, which is done in - * batches every now and then. - * @see: https://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema-internal-data.html - */ - return client.sql(getInsertIntoLegosetStatement()) // - .bind(0, 42055) // - .bind(1, "SCHAUFELRADBAGGER") // - .bindNull(2, Integer.class) // - .fetch().rowsUpdated() // - .delayElement(Duration.ofMillis(50)) // - .then(); - } - - @Override - protected String getCurrentTransactionIdStatement() { - return "SELECT tx.trx_id FROM information_schema.innodb_trx tx WHERE tx.trx_mysql_thread_id = connection_id()"; - } -} diff --git a/src/test/java/org/springframework/data/r2dbc/dialect/DialectResolverUnitTests.java b/src/test/java/org/springframework/data/r2dbc/dialect/DialectResolverUnitTests.java index b34c5a1..278ef51 100644 --- a/src/test/java/org/springframework/data/r2dbc/dialect/DialectResolverUnitTests.java +++ b/src/test/java/org/springframework/data/r2dbc/dialect/DialectResolverUnitTests.java @@ -1,7 +1,6 @@ package org.springframework.data.r2dbc.dialect; import static org.assertj.core.api.Assertions.*; -import static org.mockito.Mockito.*; import dev.miku.r2dbc.mysql.MySqlConnectionConfiguration; import dev.miku.r2dbc.mysql.MySqlConnectionFactory; @@ -26,9 +25,6 @@ import org.springframework.data.relational.core.dialect.LockClause; import org.springframework.data.relational.core.sql.LockOptions; import org.springframework.data.relational.core.sql.render.SelectRenderContext; -import com.github.jasync.r2dbc.mysql.JasyncConnectionFactory; -import com.github.jasync.sql.db.mysql.pool.MySQLConnectionFactory; - /** * Unit tests for {@link DialectResolver}. * @@ -44,14 +40,12 @@ public class DialectResolverUnitTests { MssqlConnectionFactory mssql = new MssqlConnectionFactory(MssqlConnectionConfiguration.builder().host("localhost") .database("foo").username("bar").password("password").build()); H2ConnectionFactory h2 = new H2ConnectionFactory(H2ConnectionConfiguration.builder().inMemory("mem").build()); - JasyncConnectionFactory jasyncMysql = new JasyncConnectionFactory(mock(MySQLConnectionFactory.class)); MySqlConnectionFactory mysql = MySqlConnectionFactory .from(MySqlConnectionConfiguration.builder().host("localhost").username("mysql").build()); assertThat(DialectResolver.getDialect(postgres)).isEqualTo(PostgresDialect.INSTANCE); assertThat(DialectResolver.getDialect(mssql)).isEqualTo(SqlServerDialect.INSTANCE); assertThat(DialectResolver.getDialect(h2)).isEqualTo(H2Dialect.INSTANCE); - assertThat(DialectResolver.getDialect(jasyncMysql)).isEqualTo(MySqlDialect.INSTANCE); assertThat(DialectResolver.getDialect(mysql)).isEqualTo(MySqlDialect.INSTANCE); } diff --git a/src/test/java/org/springframework/data/r2dbc/repository/JasyncMySqlR2dbcRepositoryIntegrationTests.java b/src/test/java/org/springframework/data/r2dbc/repository/JasyncMySqlR2dbcRepositoryIntegrationTests.java deleted file mode 100644 index d3bdb69..0000000 --- a/src/test/java/org/springframework/data/r2dbc/repository/JasyncMySqlR2dbcRepositoryIntegrationTests.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2019-2021 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.r2dbc.repository; - -import io.r2dbc.spi.ConnectionFactory; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import javax.sql.DataSource; - -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.RegisterExtension; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan.Filter; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.FilterType; -import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration; -import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories; -import org.springframework.data.r2dbc.repository.support.R2dbcRepositoryFactory; -import org.springframework.data.r2dbc.testing.ExternalDatabase; -import org.springframework.data.r2dbc.testing.MySqlTestSupport; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -/** - * Integration tests for {@link LegoSetRepository} using {@link R2dbcRepositoryFactory} against MySQL using Jasync - * MySQL. - * - * @author Mark Paluch - */ -@ExtendWith(SpringExtension.class) -@ContextConfiguration -public class JasyncMySqlR2dbcRepositoryIntegrationTests extends AbstractR2dbcRepositoryIntegrationTests { - - @RegisterExtension public static final ExternalDatabase database = MySqlTestSupport.database(); - - @Configuration - @EnableR2dbcRepositories(considerNestedRepositories = true, - includeFilters = @Filter(classes = MySqlLegoSetRepository.class, type = FilterType.ASSIGNABLE_TYPE)) - static class IntegrationTestConfiguration extends AbstractR2dbcConfiguration { - - @Bean - @Override - public ConnectionFactory connectionFactory() { - return MySqlTestSupport.createJasyncConnectionFactory(database); - } - } - - @Override - protected DataSource createDataSource() { - return MySqlTestSupport.createDataSource(database); - } - - @Override - protected ConnectionFactory createConnectionFactory() { - return MySqlTestSupport.createJasyncConnectionFactory(database); - } - - @Override - protected String getCreateTableStatement() { - return MySqlTestSupport.CREATE_TABLE_LEGOSET_WITH_ID_GENERATION; - } - - @Override - protected Class getRepositoryInterfaceType() { - return MySqlLegoSetRepository.class; - } - - interface MySqlLegoSetRepository extends LegoSetRepository { - - @Override - @Query("SELECT name FROM legoset") - Flux findAsProjection(); - - @Override - @Query("SELECT * FROM legoset WHERE manual = :manual") - Mono findByManual(int manual); - - @Override - @Query("SELECT id FROM legoset") - Flux findAllIds(); - } -} diff --git a/src/test/java/org/springframework/data/r2dbc/testing/MySqlTestSupport.java b/src/test/java/org/springframework/data/r2dbc/testing/MySqlTestSupport.java index b0429a3..bf859dd 100644 --- a/src/test/java/org/springframework/data/r2dbc/testing/MySqlTestSupport.java +++ b/src/test/java/org/springframework/data/r2dbc/testing/MySqlTestSupport.java @@ -125,15 +125,6 @@ public class MySqlTestSupport { return testContainerDatabase; } - /** - * Creates a new Jasync MySQL {@link ConnectionFactory} configured from the {@link ExternalDatabase}. - */ - public static ConnectionFactory createJasyncConnectionFactory(ExternalDatabase database) { - - ConnectionFactoryOptions options = ConnectionUtils.createOptions("mysql", database); - return new MysqlConnectionFactoryProvider().create(options); - } - /** * Creates a new R2DBC MySQL {@link ConnectionFactory} configured from the {@link ExternalDatabase}. */