DataSourceFactory { public DataSourceWrapper newInstance(final ScalingDataSourceConfiguration dataSourceConfig) { if (dataSourceConfig instanceof JDBCScalingDataSourceConfiguration) { return newInstanceDataSourceByJDBC((JDBCScalingDataSourceConfiguration) dataSourceConfig); } else if (dataSourceConfig instanceof ShardingSphereJDBCScalingDataSourceConfiguration) { return newInstanceDataSourceByShardingSphereJDBC((ShardingSphereJDBCScalingDataSourceConfiguration) dataSourceConfig); } throw new UnsupportedOperationException("Unsupported data source configuration"); }  DataSourceWrapper newInstance(final ScalingDataSourceConfiguration dataSourceConfig);  }
@Test public void assertNewJDBCInstance() { JDBCScalingDataSourceConfiguration config = new JDBCScalingDataSourceConfiguration( "jdbc:h2:mem:test_db_2;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL", "root", "password"); DataSourceWrapper actual = new DataSourceFactory().newInstance(config); assertNotNull(actual); }
@Test public void assertNewShardingSphereJDBCInstance() { ShardingSphereJDBCScalingDataSourceConfiguration config = new ShardingSphereJDBCScalingDataSourceConfiguration( FixtureShardingSphereJDBCConfiguration.DATA_SOURCE, FixtureShardingSphereJDBCConfiguration.RULE); DataSourceWrapper actual = new DataSourceFactory().newInstance(config); assertNotNull(actual); }