Skip to content

Commit

Permalink
Aggregate version to root pom
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Oct 22, 2023
1 parent ed6ed44 commit 6ccd848
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package org.apache.shardingsphere.transaction.xa.jta.connection.dialect;

import com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection;
import com.mysql.cj.jdbc.MysqlXAConnection;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.transaction.xa.fixture.DataSourceUtils;
import org.apache.shardingsphere.transaction.xa.jta.connection.XAConnectionWrapper;
Expand All @@ -34,8 +34,9 @@
import java.sql.Connection;
import java.sql.SQLException;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand All @@ -46,7 +47,7 @@ class MySQLXAConnectionWrapperTest {
@Test
void assertWrap() throws SQLException {
XAConnection actual = DatabaseTypedSPILoader.getService(XAConnectionWrapper.class, databaseType).wrap(createXADataSource(), mockConnection());
assertThat(actual.getXAResource(), instanceOf(JDBC4MysqlXAConnection.class));
assertThat(actual.getXAResource().getClass(), is(MysqlXAConnection.class));
}

private XADataSource createXADataSource() {
Expand All @@ -56,7 +57,7 @@ private XADataSource createXADataSource() {

private Connection mockConnection() throws SQLException {
Connection result = mock(Connection.class);
when(result.unwrap(com.mysql.jdbc.Connection.class)).thenReturn(mock(com.mysql.jdbc.Connection.class));
when(result.unwrap(com.mysql.cj.jdbc.JdbcConnection.class)).thenReturn(mock(com.mysql.cj.jdbc.JdbcConnection.class, RETURNS_DEEP_STUBS));
return result;
}
}

0 comments on commit 6ccd848

Please sign in to comment.