@@ -0,0 +1,3564 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.shardingsphere.infra.config.datasource.creator;%0A%0Aimport com.zaxxer.hikari.HikariDataSource;%0Aimport org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;%0Aimport org.apache.shardingsphere.infra.config.datasource.creator.impl.DefaultDataSourceCreator;%0Aimport org.junit.Test;%0A%0Aimport javax.sql.DataSource;%0A%0Aimport static org.hamcrest.CoreMatchers.instanceOf;%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic final class DefaultDataSourceCreatorTest %7B%0A    @Test%0A    public void assertCreateDataSourceConfiguration() %7B%0A        DefaultDataSourceCreator defaultDataSourceCreator = new DefaultDataSourceCreator();%0A        DataSourceConfiguration generateDataSourceConfiguration = defaultDataSourceCreator.createDataSourceConfiguration(createDataSource());%0A%0A        DataSourceConfiguration targetDataSourceConfiguration = createDataSourceConfiguration();%0A        assertThat(generateDataSourceConfiguration, is(targetDataSourceConfiguration));%0A    %7D%0A%0A    @Test%0A    public void assertCreateDataSource() %7B%0A        DefaultDataSourceCreator defaultDataSourceCreator = new DefaultDataSourceCreator();%0A        DataSource generateDataSource = defaultDataSourceCreator.createDataSource(createDataSourceConfiguration());%0A        assertThat(generateDataSource, instanceOf(HikariDataSource.class));%0A%0A        HikariDataSource targetDataSource = (HikariDataSource) generateDataSource;%0A        assertThat(targetDataSource.getUsername(), is(%22root%22));%0A        assertThat(targetDataSource.getPassword(), is(%22root%22));%0A        assertThat(targetDataSource.getDriverClassName(), is(%22org.h2.Driver%22));%0A        assertThat(targetDataSource.getJdbcUrl(), is(%22jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL%22));%0A    %7D%0A%0A    private DataSource createDataSource() %7B%0A        HikariDataSource dataSource = new HikariDataSource();%0A        dataSource.setDriverClassName(%22org.h2.Driver%22);%0A        dataSource.setJdbcUrl(%22jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL%22);%0A        dataSource.setUsername(%22root%22);%0A        dataSource.setPassword(%22root%22);%0A        return dataSource;%0A    %7D%0A%0A    private DataSourceConfiguration createDataSourceConfiguration() %7B%0A        DataSourceConfiguration dataSourceConfiguration = new DataSourceConfiguration(HikariDataSource.class.getName());%0A        dataSourceConfiguration.getProps().put(%22jdbcUrl%22, %22jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL%22);%0A        dataSourceConfiguration.getProps().put(%22driverClassName%22, %22org.h2.Driver%22);%0A        dataSourceConfiguration.getProps().put(%22username%22, %22root%22);%0A        dataSourceConfiguration.getProps().put(%22password%22, %22root%22);%0A        return dataSourceConfiguration;%0A    %7D%0A%7D%0A

add some unit test for DefaultDataSourceCreator (#12367)