feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457106411



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/test/java/org/apache/shardingsphere/sql/parser/binder/metadata/table/SchemaMetaDataLoaderTest.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import 
org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class SchemaMetaDataLoaderTest {
+    private static final String TEST_CATALOG = "catalog";
+
+    private static final String TABLE_TYPE = "TABLE";
+
+    private static final int MAX_CONNECTION_COUNT = 5;
+
+    private static final String DATABASE_TYPE_ORACLE = "Oracle";
+
+    @Mock
+    private DataSource dataSource;
+
+    @Mock
+    private Connection connection;
+
+    @Mock
+    private DatabaseMetaData databaseMetaData;
+
+    @Mock
+    private ResultSet tableExistResultSet;
+
+    @Before
+    public void setUp() throws SQLException {
+        when(dataSource.getConnection()).thenReturn(connection);
+        when(connection.getCatalog()).thenReturn(TEST_CATALOG);
+        when(connection.getMetaData()).thenReturn(databaseMetaData);
+        when(databaseMetaData.getTables(TEST_CATALOG, null, null, new 
String[]{TABLE_TYPE})).thenReturn(tableExistResultSet);
+    }
+
+    @Test
+    public void assertLoadAllTableNamesForOracle() throws SQLException {
+        SchemaMetaDataLoader.load(dataSource, MAX_CONNECTION_COUNT, 
DATABASE_TYPE_ORACLE);
+    }
+

Review comment:
       done.




----------------------------------------------------------------
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.

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


Reply via email to