complone commented on code in PR #17920:
URL: https://github.com/apache/shardingsphere/pull/17920#discussion_r902653244


##########
shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/test/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionWrapperFactoryTest.java:
##########
@@ -17,17 +17,46 @@
 
 package org.apache.shardingsphere.transaction.xa.jta.connection;
 
+import com.mysql.jdbc.jdbc2.optional.JDBC4MysqlXAConnection;
+import com.zaxxer.hikari.HikariDataSource;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeFactory;
-import 
org.apache.shardingsphere.transaction.xa.jta.connection.dialect.H2XAConnectionWrapper;
+import org.apache.shardingsphere.transaction.xa.fixture.DataSourceUtils;
+import 
org.apache.shardingsphere.transaction.xa.fixture.XAConnectionWrapperFixture;
+import 
org.apache.shardingsphere.transaction.xa.fixture.XADataSourceDefinitionFixture;
+import 
org.apache.shardingsphere.transaction.xa.jta.datasource.swapper.DataSourceSwapper;
 import org.junit.Test;
 
+import javax.sql.DataSource;
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public final class XAConnectionWrapperFactoryTest {
     
     @Test
-    public void assertGetInstance() {
-        
assertThat(XAConnectionWrapperFactory.getInstance(DatabaseTypeFactory.getInstance("H2")),
 instanceOf(H2XAConnectionWrapper.class));
+    public void assertGetInstance() throws SQLException {
+        XAConnectionWrapper xaConnectionWrapperFixTrue = new 
XAConnectionWrapperFixture();
+        XAConnection actual = 
xaConnectionWrapperFixTrue.wrap(createXADataSource(), mockConnection());
+        assertThat(actual.getXAResource(), 
instanceOf(JDBC4MysqlXAConnection.class));
+    }
+    
+    private XADataSource createXADataSource() {
+        DatabaseType databaseType = DatabaseTypeFactory.getInstance("FIXTURE");
+        DataSource dataSource = DataSourceUtils.build(HikariDataSource.class, 
databaseType, "foo_ds");
+        XADataSourceDefinitionFixture xaDataSourceDefinitionFixTure = new 
XADataSourceDefinitionFixture();

Review Comment:
   ```XADataSourceDefinitionFixture``` needs to get the database connection, 
the ```getXADriverClassName``` interface cannot be called using mock



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to