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 assertAllNewInstance() {
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.MySQL, "jdbc:mysql://127.0.0.1:3306/db_0") instanceof MySQLDataSourceMetaData));
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.Oracle, "jdbc:oracle:thin:@//127.0.0.1:3306/ds_0") instanceof OracleDataSourceMetaData));
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.PostgreSQL, "jdbc:postgresql://127.0.0.1:3306/ds_0") instanceof PostgreSQLDataSourceMetaData));
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.SQLServer, "jdbc:microsoft:sqlserver://127.0.0.1:3306;DatabaseName=ds_0") instanceof SQLServerDataSourceMetaData));
        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.H2, "jdbc:h2:mem:ds_0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL") instanceof H2DataSourceMetaData));
    }
}
@@ -266,267 +266,8 @@
 ta;%0A
-import io.shardingsphere.core.metadata.datasource.dialect.OracleDataSourceMetaData;%0Aimport io.shardingsphere.core.metadata.datasource.dialect.PostgreSQLDataSourceMetaData;%0Aimport io.shardingsphere.core.metadata.datasource.dialect.SQLServerDataSourceMetaData;%0A
 impo
@@ -426,16 +426,21 @@
 Instance
+ForH2
 () %7B%0A   
@@ -511,21 +511,18 @@
 ype.
-MySQL
+H2
 , %22jdbc:
 mysq
@@ -521,195 +521,72 @@
 dbc:
-mysql://127.0.0.1:3306/db_0%22) instanceof MySQLDataSourceMetaData));%0A        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.Oracle, %22jdbc:oracle:thin:@//127.0.0.1:3306/ds_0
+h2:mem:ds_0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL
 %22) i
@@ -599,14 +599,10 @@
 eof 
-Oracle
+H2
 Data
@@ -627,170 +627,73 @@
     
+%7D%0A
     
-assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.PostgreSQL, %22jdbc:postgresql://127.0.0.1:3306/ds_0%22) instanceof PostgreSQLDataSourceMetaData));
+%0A    @Test%0A    public void assertAllNewInstanceForMySQL() %7B
 %0A   
@@ -760,25 +760,21 @@
 aseType.
+My
 SQL
-Server
 , %22jdbc:
@@ -778,267 +778,53 @@
 bc:m
-icrosoft:sqlserver://127.0.0.1:3306;DatabaseName=ds_0%22) instanceof SQLServerDataSourceMetaData));%0A        assertTrue((DataSourceMetaDataFactory.newInstance(DatabaseType.H2, %22jdbc:h2:mem:ds_0;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL%22) instanceof H2
+ysql://127.0.0.1:3306/db_0%22) instanceof MySQL
 Data

add tests