package io.shardingsphere.core.metadata.datasource;

import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.metadata.datasource.dialect.H2DataSourceMetaData;
import io.shardingsphere.core.metadata.datasource.dialect.MySQLDataSourceMetaData;
import io.shardingsphere.core.metadata.datasource.dialect.OracleDataSourceMetaData;
import io.shardingsphere.core.metadata.datasource.dialect.PostgreSQLDataSourceMetaData;
import io.shardingsphere.core.metadata.datasource.dialect.SQLServerDataSourceMetaData;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

public class DataSourceMetaDataFactoryTest {
    
    @Test
    public void assertAllNewInstanceForH2() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.H2, "jdbc:h2:mem:ds_0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL") instanceof H2DataSourceMetaData));
    }
    
    @Test
    public void assertAllNewInstanceForMySQL() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.MySQL, "jdbc:mysql://127.0.0.1:3306/db_0") instanceof MySQLDataSourceMetaData));
    }
    
    @Test
    public void assertAllNewInstanceForOracle() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.Oracle, "jdbc:oracle:thin:@//127.0.0.1:3306/ds_0") instanceof OracleDataSourceMetaData));
    }
    
    @Test
    public void assertAllNewInstanceForPostgreSQL() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.PostgreSQL, "jdbc:postgresql://127.0.0.1:3306/ds_0") instanceof PostgreSQLDataSourceMetaData));
    }
    
    @Test
    public void assertAllNewInstanceForSQLServer() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.SQLServer, "jdbc:microsoft:sqlserver://127.0.0.1:3306;DatabaseName=ds_0") instanceof SQLServerDataSourceMetaData));
    }
}
@@ -1,8 +1,628 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * 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 * %3C/p%3E%0A */%0A%0A
 package 
@@ -1326,33 +1326,32 @@
      assertTrue(
-(
 DataSourceMetaDa
@@ -1486,33 +1486,32 @@
 aSourceMetaData)
-)
 ;%0A    %7D%0A    %0A   
@@ -1577,33 +1577,32 @@
      assertTrue(
-(
 DataSourceMetaDa
@@ -1706,33 +1706,32 @@
 aSourceMetaData)
-)
 ;%0A    %7D%0A    %0A   
@@ -1798,33 +1798,32 @@
      assertTrue(
-(
 DataSourceMetaDa
@@ -1936,33 +1936,32 @@
 aSourceMetaData)
-)
 ;%0A    %7D%0A    %0A   
@@ -2032,33 +2032,32 @@
      assertTrue(
-(
 DataSourceMetaDa
@@ -2176,33 +2176,32 @@
 aSourceMetaData)
-)
 ;%0A    %7D%0A    %0A   
@@ -2279,17 +2279,16 @@
 ertTrue(
-(
 DataSour
@@ -2443,17 +2443,16 @@
 etaData)
-)
 ;%0A    %7D%0A
@@ -2452,8 +2452,9 @@
 %0A    %7D%0A%7D
+%0A

add header