You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/07/16 08:37:12 UTC

[GitHub] [shardingsphere] feiweihy opened a new pull request #6366: fix oracle bug which will occur when a database has multi users

feiweihy opened a new pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366


   fix oracle bug which will occur when a database has multi users
   
   Fixes #6362.
   
   Changes proposed in this pull request:
   -
   -
   -
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660465451


   > @tristaZero this pr is right ,but test not pass.
   > 
   > A schema is a collection of database objects (used by a user.).
   > Schema objects are the logical structures that directly refer to the database’s data.
   > A user is a name defined in the database that can connect to and access objects.
   > Schemas and users help database administrators manage database security.
   
   @yu199195 Thanks for the feedback, which made us positive about this PR. 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
yu199195 commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456231959



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
        test ci will not pass, ,maybe you can mock oracle datasource to complete this PR.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456205856



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       I used externl lib to run this file.
   Do you have another way to do?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
yu199195 commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456204204



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       What is the  jdbc driver ? 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456380660



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       but the bug will not occur when mocking db nor an oracle db which just have one app user, it will just happen when an oracle db has multi users. Without real db, how can i prove i have fixed it.

##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       but the bug will not occur when mocking db nor an oracle db which just have one app user, it will just happen when an oracle db has multi users. Without real db, how can i prove i have fixed it.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456192504



##########
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,108 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        System.out.println("Start...");
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";

Review comment:
       Hi, Please firstly look at the `travis-ci` test, which showed there is something wrong with your PR. I presume it is about check style here.
   
   Besides, I hope there is no Oracle database instance required for your unit test. Otherwise, It is supposed to be removed.
   
   I know those comments may frustrate you somehow, but what you did is entirely open to the whole community. I believe you also want to be a significant part of this community as well, don't you?
   
   If you need any help, please contact me.  :-)
   
   Best,
   Trista
   
   I am sorry 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-659810689


   Hi @yu199195 Hi what this contributor changed is related to your PR, could you give it a look?
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457047745



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/util/JdbcUtil.java
##########
@@ -36,7 +37,12 @@ public static String getSchema(final Connection connection, final String databas
         String result = null;
         try {
             if ("Oracle".equals(databaseType)) {
-                return null;
+                DatabaseMetaData metaData = connection.getMetaData();
+                if (null != metaData) {
+                    return metaData.getUserName() == null ? null : metaData.getUserName().toUpperCase();

Review comment:
       > Hi @feiweihy
   > 
   > I know that. Generally, we need a unit test to verify the changes from anyone. Here another our committer gave the same conclusion, which made me believe it very well may be correct. Thanks for your response.
   > I looked at Travis and triggered it again. However, the result shows,
   > 
   > ```
   > [INFO] -------------------------------------------------------
   > 1119[INFO]  T E S T S
   > 1120[INFO] -------------------------------------------------------
   > 1121[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoaderTest
   > 1122[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.917 s - in org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoaderTest
   > 1123[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest
   > 1124[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.024 s <<< FAILURE! - in org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest
   > 1125[ERROR] assertOracleLoad(org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest)  Time elapsed: 0.012 s  <<< ERROR!
   > 1126java.lang.NullPointerException
   > 1127	at org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest.assertOracleLoad(IndexMetaDataLoaderTest.java:71)
   > 1128
   > 1129[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.MetaDataConnectionTest
   > 1130[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 s - in org.apache.shardingsphere.sql.parser.binder.metadata.MetaDataConnectionTest
   > 1131[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest
   > 1132[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.008 s <<< FAILURE! - in org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest
   > 1133[ERROR] assertOracleGetSchema(org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest)  Time elapsed: 0.001 s  <<< ERROR!
   > 1134java.lang.NullPointerException
   > 1135	at org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest.assertOracleGetSchema(JdbcUtilTest.java:47)
   > 1136
   > 1137[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.SchemaMetaDataTest
   > 1138[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.239 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.SchemaMetaDataTest
   > 1139[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoaderTest
   > 1140[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.176 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoaderTest
   > 1141[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataTest
   > 1142[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataTest
   > 1143[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngineTest
   > 1144[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngineTest
   > 1145[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.RowNumberPaginationContextEngineTest
   > 1146[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.094 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.RowNumberPaginationContextEngineTest
   > 1147[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.TopPaginationContextEngineTest
   > 1148[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.TopPaginationContextEngineTest
   > 1149[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngineTest
   > 1150[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngineTest
   > 1151[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContextTest
   > 1152[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContextTest
   > 1153[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.engine.OrderByContextEngineTest
   > 1154[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.engine.OrderByContextEngineTest
   > 1155[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByItemTest
   > 1156[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.145 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByItemTest
   > 1157[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.engine.GroupByContextEngineTest
   > 1158[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.engine.GroupByContextEngineTest
   > 1159[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.ProjectionsContextTest
   > 1160[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.ProjectionsContextTest
   > 1161[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.DerivedColumnTest
   > 1162[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.DerivedColumnTest
   > 1163[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionsContextEngineTest
   > 1164[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionsContextEngineTest
   > 1165[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionEngineTest
   > 1166[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.099 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionEngineTest
   > 1167[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.ShorthandProjectionTest
   > 1168[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.ShorthandProjectionTest
   > 1169[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.AggregationDistinctProjectionTest
   > 1170[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.AggregationDistinctProjectionTest
   > 1171[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.InsertValueContextTest
   > 1172[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.InsertValueContextTest
   > 1173[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedParameterMarkerExpressionSegmentTest
   > 1174[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedParameterMarkerExpressionSegmentTest
   > 1175[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedLiteralExpressionSegmentTest
   > 1176[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedLiteralExpressionSegmentTest
   > 1177[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.OnDuplicateUpdateContextTest
   > 1178[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.OnDuplicateUpdateContextTest
   > 1179[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.keygen.engine.GeneratedKeyContextEngineTest
   > 1180[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.keygen.engine.GeneratedKeyContextEngineTest
   > 1181[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContextTest
   > 1182[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContextTest
   > 1183[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContextFactoryTest
   > 1184[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.122 s - in org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContextFactoryTest
   > 1185[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.impl.InsertStatementContextTest
   > 1186[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 s - in org.apache.shardingsphere.sql.parser.binder.statement.impl.InsertStatementContextTest
   > 1187[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.impl.SelectStatementContextTest
   > 1188[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s - in org.apache.shardingsphere.sql.parser.binder.statement.impl.SelectStatementContextTest
   > 1189[INFO] 
   > 1190[INFO] Results:
   > 1191[INFO] 
   > 1192[ERROR] Errors: 
   > 1193[ERROR]   IndexMetaDataLoaderTest.assertOracleLoad:71 » NullPointer
   > 1194[ERROR]   JdbcUtilTest.assertOracleGetSchema:47 » NullPointer
   > 1195[INFO] 
   > 1196[ERROR] Tests run: 133, Failures: 0, Errors: 2, Skipped: 0
   > 1197[INFO] 
   > 1198[INFO] 
   > 1199[INFO] ------------------------------------------------------------------------
   > 1200[INFO] Skipping shardingsphere
   > 1201[INFO] This project has been banned from the build due to previous failures.
   > 1202[INFO] ------------------------------------------------------------------------
   > 1203[INFO] ------------------------------------------------------------------------
   > 1204[INFO] Reactor Summary for shardingsphere 5.0.0-RC1-SNAPSHOT:
   > 1205[INFO] 
   > 1206[INFO] shardingsphere ..................................... SUCCESS [  6.580 s]
   > 1207[INFO] shardingsphere-sql-parser .......................... SUCCESS [  0.849 s]
   > 1208[INFO] shardingsphere-sql-parser-spi ...................... SUCCESS [  3.980 s]
   > 1209[INFO] shardingsphere-sql-parser-statement ................ SUCCESS [ 14.323 s]
   > 1210[INFO] shardingsphere-sql-parser-engine ................... SUCCESS [  7.343 s]
   > 1211[INFO] shardingsphere-sql-parser-binder ................... FAILURE [ 10.002 s]
   > 1212[INFO] shardingsphere-sql-parser-dialect .................. SKIPPED
   > 1213[INFO] shardingsphere-sql-parser-sql92 .................... SKIPPED
   > 1214[INFO] shardingsphere-sql-parser-mysql .................... SKIPPED
   > 1215[INFO] shardingsphere-sql-parser-postgresql ............... SKIPPED
   > 1216[INFO] shardingsphere-sql-parser-oracle ................... SKIPPED
   > 1217[INFO] shardingsphere-sql-parser-sqlserver ................ SKIPPED
   > 1218[INFO] shardingsphere-sql-parser-test ..................... SKIPPED
   > 1219[INFO] shardingsphere-db-protocol ......................... SKIPPED
   > 1220[INFO] shardingsphere-db-protocol-core .................... SKIPPED
   > 1221[INFO] shardingsphere-db-protocol-mysql ................... SKIPPED
   > 1222[INFO] shardingsphere-db-protocol-postgresql .............. SKIPPED
   > 1223[INFO] shardingsphere-infra ............................... SKIPPED
   > 1224[INFO] shardingsphere-infra-common ........................ SKIPPED
   > 1225[INFO] shardingsphere-infra-route ......................... SKIPPED
   > 1226[INFO] shardingsphere-infra-rewrite ....................... SKIPPED
   > 1227[INFO] shardingsphere-infra-rewrite-engine ................ SKIPPED
   > 1228[INFO] shardingsphere-infra-rewrite-test .................. SKIPPED
   > 1229[INFO] shardingsphere-infra-executor ...................... SKIPPED
   > 1230[INFO] shardingsphere-infra-merge ......................... SKIPPED
   > 1231[INFO] shardingsphere-transaction ......................... SKIPPED
   > 1232[INFO] shardingsphere-transaction-core .................... SKIPPED
   > 1233[INFO] shardingsphere-kernel .............................. SKIPPED
   > 1234[INFO] shardingsphere-kernel-context ...................... SKIPPED
   > 1235[INFO] shardingsphere-features ............................ SKIPPED
   > 1236[INFO] shardingsphere-sharding ............................ SKIPPED
   > 1237[INFO] shardingsphere-sharding-api ........................ SKIPPED
   > 1238[INFO] shardingsphere-sharding-common ..................... SKIPPED
   > 1239[INFO] shardingsphere-sharding-route ...................... SKIPPED
   > 1240[INFO] shardingsphere-master-slave ........................ SKIPPED
   > 1241[INFO] shardingsphere-master-slave-api .................... SKIPPED
   > 1242[INFO] shardingsphere-master-slave-common ................. SKIPPED
   > 1243[INFO] shardingsphere-master-slave-route .................. SKIPPED
   > 1244[INFO] shardingsphere-encrypt ............................. SKIPPED
   > 1245[INFO] shardingsphere-encrypt-api ......................... SKIPPED
   > 1246[INFO] shardingsphere-encrypt-common ...................... SKIPPED
   > 1247[INFO] shardingsphere-encrypt-rewrite ..................... SKIPPED
   > 1248[INFO] shardingsphere-sharding-rewrite .................... SKIPPED
   > 1249[INFO] shardingsphere-shadow .............................. SKIPPED
   > 1250[INFO] shardingsphere-shadow-api .......................... SKIPPED
   > 1251[INFO] shardingsphere-shadow-common ....................... SKIPPED
   > 1252[INFO] shardingsphere-shadow-rewrite ...................... SKIPPED
   > 1253[INFO] shardingsphere-shadow-route ........................ SKIPPED
   > 1254[INFO] shardingsphere-sharding-merge ...................... SKIPPED
   > 1255[INFO] shardingsphere-encrypt-merge ....................... SKIPPED
   > 1256[INFO] shardingsphere-replica ............................. SKIPPED
   > 1257[INFO] shardingsphere-replica-api ......................... SKIPPED
   > 1258[INFO] shardingsphere-replica-common ...................... SKIPPED
   > 1259[INFO] shardingsphere-replica-route ....................... SKIPPED
   > 1260[INFO] shardingsphere-replica-execute ..................... SKIPPED
   > 1261[INFO] shardingsphere-jdbc ................................ SKIPPED
   > 1262[INFO] shardingsphere-jdbc-core ........................... SKIPPED
   > 1263[INFO] shardingsphere-control-panel ....................... SKIPPED
   > 1264[INFO] shardingsphere-control-panel-spi ................... SKIPPED
   > 1265[INFO] shardingsphere-metrics ............................. SKIPPED
   > 1266[INFO] shardingsphere-metrics-configuration ............... SKIPPED
   > 1267[INFO] shardingsphere-cluster ............................. SKIPPED
   > 1268[INFO] shardingsphere-cluster-configuration ............... SKIPPED
   > 1269[INFO] shardingsphere-orchestration ....................... SKIPPED
   > 1270[INFO] shardingsphere-orchestration-core .................. SKIPPED
   > 1271[INFO] shardingsphere-orchestration-core-configuration .... SKIPPED
   > 1272[INFO] shardingsphere-orchestration-center ................ SKIPPED
   > 1273[INFO] shardingsphere-orchestration-center-api ............ SKIPPED
   > 1274[INFO] shardingsphere-orchestration-core-common ........... SKIPPED
   > 1275[INFO] shardingsphere-orchestration-core-configcenter ..... SKIPPED
   > 1276[INFO] shardingsphere-orchestration-core-registrycenter ... SKIPPED
   > 1277[INFO] shardingsphere-orchestration-core-metadatacenter ... SKIPPED
   > 1278[INFO] shardingsphere-orchestration-core-facade ........... SKIPPED
   > 1279[INFO] shardingsphere-orchestration-center-configuration .. SKIPPED
   > 1280[INFO] shardingsphere-cluster-heartbeat ................... SKIPPED
   > 1281[INFO] shardingsphere-cluster-state ....................... SKIPPED
   > 1282[INFO] shardingsphere-cluster-facade ...................... SKIPPED
   > 1283[INFO] shardingsphere-jdbc-orchestration .................. SKIPPED
   > 1284[INFO] shardingsphere-jdbc-spring ......................... SKIPPED
   > 1285[INFO] shardingsphere-jdbc-spring-infra ................... SKIPPED
   > 1286[INFO] shardingsphere-jdbc-spring-boot-starter-infra ...... SKIPPED
   > 1287[INFO] shardingsphere-jdbc-spring-namespace-infra ......... SKIPPED
   > 1288[INFO] shardingsphere-sharding-spring ..................... SKIPPED
   > 1289[INFO] shardingsphere-sharding-spring-boot-starter ........ SKIPPED
   > 1290[INFO] shardingsphere-shadow-spring ....................... SKIPPED
   > 1291[INFO] shardingsphere-shadow-spring-boot-starter .......... SKIPPED
   > 1292[INFO] shardingsphere-encrypt-spring ...................... SKIPPED
   > 1293[INFO] shardingsphere-encrypt-spring-boot-starter ......... SKIPPED
   > 1294[INFO] shardingsphere-master-slave-spring ................. SKIPPED
   > 1295[INFO] shardingsphere-master-slave-spring-boot-starter .... SKIPPED
   > 1296[INFO] shardingsphere-jdbc-transaction-spring ............. SKIPPED
   > 1297[INFO] shardingsphere-jdbc-core-spring .................... SKIPPED
   > 1298[INFO] shardingsphere-jdbc-core-spring-boot-starter ....... SKIPPED
   > 1299[INFO] shardingsphere-sharding-spring-namespace ........... SKIPPED
   > 1300[INFO] shardingsphere-master-slave-spring-namespace ....... SKIPPED
   > 1301[INFO] shardingsphere-encrypt-spring-namespace ............ SKIPPED
   > 1302[INFO] shardingsphere-shadow-spring-namespace ............. SKIPPED
   > 1303[INFO] shardingsphere-jdbc-core-spring-namespace .......... SKIPPED
   > 1304[INFO] shardingsphere-jdbc-orchestration-spring ........... SKIPPED
   > 1305[INFO] shardingsphere-jdbc-orchestration-spring-boot-starter SKIPPED
   > 1306[INFO] shardingsphere-jdbc-orchestration-spring-namespace . SKIPPED
   > 1307[INFO] shardingsphere-metrics-spi ......................... SKIPPED
   > 1308[INFO] shardingsphere-proxy ............................... SKIPPED
   > 1309[INFO] shardingsphere-proxy-common ........................ SKIPPED
   > 1310[INFO] shardingsphere-transaction-2pc ..................... SKIPPED
   > 1311[INFO] shardingsphere-transaction-xa ...................... SKIPPED
   > 1312[INFO] shardingsphere-transaction-xa-spi .................. SKIPPED
   > 1313[INFO] shardingsphere-transaction-xa-atomikos ............. SKIPPED
   > 1314[INFO] shardingsphere-transaction-xa-core ................. SKIPPED
   > 1315[INFO] shardingsphere-proxy-backend ....................... SKIPPED
   > 1316[INFO] shardingsphere-proxy-frontend ...................... SKIPPED
   > 1317[INFO] shardingsphere-proxy-frontend-spi .................. SKIPPED
   > 1318[INFO] shardingsphere-proxy-frontend-core ................. SKIPPED
   > 1319[INFO] shardingsphere-proxy-frontend-mysql ................ SKIPPED
   > 1320[INFO] shardingsphere-proxy-frontend-postgresql ........... SKIPPED
   > 1321[INFO] shardingsphere-orchestration-center-zookeeper-curator SKIPPED
   > 1322[INFO] shardingsphere-metrics-facade ...................... SKIPPED
   > 1323[INFO] shardingsphere-orchestration-core-schema ........... SKIPPED
   > 1324[INFO] shardingsphere-proxy-orchestration ................. SKIPPED
   > 1325[INFO] shardingsphere-opentracing ......................... SKIPPED
   > 1326[INFO] shardingsphere-metrics-prometheus .................. SKIPPED
   > 1327[INFO] shardingsphere-proxy-bootstrap ..................... SKIPPED
   > 1328[INFO] shardingsphere-sharding-time-service ............... SKIPPED
   > 1329[INFO] shardingsphere-scaling ............................. SKIPPED
   > 1330[INFO] shardingsphere-scaling-core ........................ SKIPPED
   > 1331[INFO] shardingsphere-scaling-mysql ....................... SKIPPED
   > 1332[INFO] shardingsphere-scaling-postgresql .................. SKIPPED
   > 1333[INFO] shardingsphere-scaling-bootstrap ................... SKIPPED
   > 1334[INFO] shardingsphere-transaction-xa-narayana ............. SKIPPED
   > 1335[INFO] shardingsphere-transaction-xa-bitronix ............. SKIPPED
   > 1336[INFO] shardingsphere-transaction-base .................... SKIPPED
   > 1337[INFO] shardingsphere-transaction-base-seata-at ........... SKIPPED
   > 1338[INFO] shardingsphere-control-panel-core .................. SKIPPED
   > 1339[INFO] shardingsphere-orchestration-center-etcd ........... SKIPPED
   > 1340[INFO] shardingsphere-orchestration-center-apollo ......... SKIPPED
   > 1341[INFO] shardingsphere-orchestration-center-nacos .......... SKIPPED
   > 1342[INFO] shardingsphere-integration-test .................... SKIPPED
   > 1343[INFO] shardingsphere-test-fixture ........................ SKIPPED
   > 1344[INFO] shardingsphere-proxy-docker-build .................. SKIPPED
   > 1345[INFO] shardingsphere-test-suite .......................... SKIPPED
   > 1346[INFO] shardingsphere-distribution ........................ SKIPPED
   > 1347[INFO] shardingsphere-src-distribution .................... SKIPPED
   > 1348[INFO] shardingsphere-jdbc-distribution ................... SKIPPED
   > 1349[INFO] shardingsphere-proxy-distribution .................. SKIPPED
   > 1350[INFO] shardingsphere-scaling-distribution ................ SKIPPED
   > 1351[INFO] ------------------------------------------------------------------------
   > 1352[INFO] BUILD FAILURE
   > 1353[INFO] ------------------------------------------------------------------------
   > 1354[INFO] Total time:  45.093 s
   > 1355[INFO] Finished at: 2020-07-19T01:51:23Z
   > 1356[INFO] ------------------------------------------------------------------------
   > 1357[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project shardingsphere-sql-parser-binder: There are test failures.
   > ```
   > 
   > Trista
   
   I have edited codes according to @yu199195 upstairs
   Meantime I provide  unit test SchemaMetaDataLoaderTest
   In this unit test, it just run in an non-real database environment. For real database, I will run it in our test environment.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
yu199195 commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457001744



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/util/JdbcUtil.java
##########
@@ -36,7 +37,12 @@ public static String getSchema(final Connection connection, final String databas
         String result = null;
         try {
             if ("Oracle".equals(databaseType)) {
-                return null;
+                DatabaseMetaData metaData = connection.getMetaData();
+                if (null != metaData) {
+                    return metaData.getUserName() == null ? null : metaData.getUserName().toUpperCase();

Review comment:
       maybe :
   
                   if (null != metaData) {
                       return Optional.ofNullable(metaData.getUserName()).map(String::toUpperCase).orElse(null);
                   } else {
                       return null;
                   }




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660572011


   Hi @feiweihy I know that. Generally, we need a unit test to guarantee the changes from anyone. Here another our committer gave the same conclusion, which made me believe it is very well may be correct. Thanks for your response.
   I looked at Travis and triggered it again. Don't worry about that.
   
   Trista


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] kimmking commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
kimmking commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-659309438


   keep ci passed first.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660471503


   > @feiweihy Hi Got it, thanks for your feedback. Since @yu199195 also gave us a double-check and the unit test seems a difficult block. Maybe we can firstly remove the unit test and merge this one. After that, we can consider the unit test. What do you think?
   
   Unit test has been removed. It seems impossible to run a unit test just depending on mocking database. 
   The unit test which has been removed  I provided can run successfully for this bug by importing external ojdbc lib. But in ci test environment, we can not import the lib. This is a paradox.
   I have installed the package for the code I modified, and use it in our test environment for a project. The test environment has not been abnormal these days.
   If @yu199195 also give a check what I modified is correct, I think I have really fix the bug.
   Thank you for your preciseness!
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660047163


   @yu199195 Hi, firstly I want to make sure what this contributor changed is correct or not?
   @feiweihy Do you think `org.apache.shardingsphere.sql.parser.binder.metadata.table.SchemaMetaDataTest` or `org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoaderTest` can give you some ideas?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660053789


   i saw developers use mocking db in these classes . but as i said upstairs,  the bug will not occur when mocking db nor an oracle db which just have one app user, it will just happen when an oracle db has multi users. Without real db, how can i prove i have fixed it.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero edited a comment on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660572011


   Hi @feiweihy 
   
   I know that. Generally, we need a unit test to verify the changes from anyone. Here another our committer gave the same conclusion, which made me believe it very well may be correct. Thanks for your response.
   I looked at Travis and triggered it again. Don't worry about that.
   
   Trista


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-659328503


   > @feiweihy Hi Appreciate your issue and PR!
   > A unit test is necessary to make your PR convinced.
   
   unit test class has been committed
   SchemaMetaDataLoaderTest.java
   run this file
   before fixed like this:
   ![beforeFixed](https://user-images.githubusercontent.com/36758723/87661712-aaecff80-c793-11ea-9e68-2702b082a523.png)
   after fixed like this:
   ![afterFixed](https://user-images.githubusercontent.com/36758723/87661723-af191d00-c793-11ea-90d6-1a4c78d03f6e.png)
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy edited a comment on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy edited a comment on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660471503


   > @feiweihy Hi Got it, thanks for your feedback. Since @yu199195 also gave us a double-check and the unit test seems a difficult block. Maybe we can firstly remove the unit test and merge this one. After that, we can consider the unit test. What do you think?
   
   Unit test has been removed. It seems impossible to run a unit test just depending on mocking database. 
   The unit test which has been removed  I provided can run successfully for this bug by importing external ojdbc lib. But in ci test environment, we can not import the lib. This is a paradox.
   I have installed the package for the code I modified, and use it in our test environment for a project. The test environment has not been abnormal these days.
   If @yu199195 also give a check what I modified is correct, I think I have really fixed the bug.
   Thank you for your preciseness!
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456185638



##########
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,108 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        System.out.println("Start...");

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:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
yu199195 commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660077782


   @tristaZero  this pr is right ,but test not pass.
   
   A schema is a collection of database objects (used by a user.).
   Schema objects are the logical structures that directly refer to the database’s data.
   A user is a name defined in the database that can connect to and access objects.
   Schemas and users help database administrators manage database security.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456184803



##########
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,108 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        System.out.println("Start...");

Review comment:
       Hi, `sout` is suggested to remove.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457049674



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/util/JdbcUtil.java
##########
@@ -36,7 +37,12 @@ public static String getSchema(final Connection connection, final String databas
         String result = null;
         try {
             if ("Oracle".equals(databaseType)) {
-                return null;
+                DatabaseMetaData metaData = connection.getMetaData();
+                if (null != metaData) {
+                    return metaData.getUserName() == null ? null : metaData.getUserName().toUpperCase();

Review comment:
       I ran project in Travis CI.
   There is no error in compiling stage, but at last error occur:
   [INFO] shardingsphere-control-panel-core .................. SUCCESS [  0.197 s]
   [INFO] shardingsphere-orchestration-center-etcd ........... SUCCESS [ 27.249 s]
   [INFO] shardingsphere-orchestration-center-apollo ......... SUCCESS [ 34.137 s]
   [INFO] shardingsphere-orchestration-center-nacos .......... SUCCESS [ 13.047 s]
   [INFO] shardingsphere-integration-test .................... SUCCESS [  0.713 s]
   [INFO] shardingsphere-test-fixture ........................ SUCCESS [  0.485 s]
   [INFO] shardingsphere-proxy-docker-build .................. SUCCESS [  1.355 s]
   [INFO] shardingsphere-test-suite .......................... SUCCESS [02:06 min]
   [INFO] shardingsphere-distribution ........................ SUCCESS [  0.196 s]
   [INFO] shardingsphere-src-distribution .................... SUCCESS [  1.144 s]
   [INFO] shardingsphere-jdbc-distribution ................... SUCCESS [  1.042 s]
   [INFO] shardingsphere-proxy-distribution .................. SUCCESS [  1.008 s]
   [INFO] shardingsphere-scaling-distribution ................ SUCCESS [ 32.450 s]
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time:  25:40 min
   [INFO] Finished at: 2020-07-20T04:29:11Z
   [INFO] ------------------------------------------------------------------------
   [ERROR] Failed to execute goal org.eluder.coveralls:coveralls-maven-plugin:4.3.0:report (default-cli) on project shardingsphere: Processing of input or output data failed: Report submission to Coveralls API failed with HTTP status 422: Unprocessable Entity (Couldn't find a repository matching this job.) -> [Help 1]
   [ERROR] 
   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
   [ERROR] Re-run Maven using the -X switch to enable full debug logging.
   [ERROR] 
   [ERROR] For more information about the errors and possible solutions, please read the following articles:
   [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
   /home/travis/.travis/functions: line 607:  4457 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
   The command "travis_wait 30 mvn --batch-mode --no-transfer-progress clean install cobertura:cobertura coveralls:report -DrepoToken="${COVERALLS_REPO_TOKEN}" -Dmaven.javadoc.skip=true" exited with 1.
   cache.2
   store build cache
   after_failure
   0.00s$ echo "build failed!"
   
   I think my codes will not lead to this result. 
   What is your opinion?@tristaZero @yu199195 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660466420


   @feiweihy Hi Got it, thanks for your feedback. Since @yu199195 also gave us a double-check and the unit test seems a difficult block. Maybe we can firstly remove the unit test and merge this one. After that, we can consider the unit test. What do you think?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660053426


   i saw developers use mocking db in these classes . but as i said upstairs,  the bug will not occur when mocking db nor an oracle db which just have one app user, it will just happen when an oracle db has multi users. Without real db, how can i prove i have fixed it.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-659292588


   @feiweihy Hi Appreciate your issue and PR!
   A unit test is necessary to make your PR convinced.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457099736



##########
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:
       This function is unit test for codes I edited.
   So I added two lines in this function. 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero edited a comment on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero edited a comment on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660572011


   Hi @feiweihy 
   
   I know that. Generally, we need a unit test to verify the changes from anyone. Here another our committer gave the same conclusion, which made me believe it very well may be correct. Thanks for your response.
   I looked at Travis and triggered it again. However, the result shows,
   
   ```
   [INFO] -------------------------------------------------------
   1119[INFO]  T E S T S
   1120[INFO] -------------------------------------------------------
   1121[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoaderTest
   1122[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.917 s - in org.apache.shardingsphere.sql.parser.binder.metadata.column.ColumnMetaDataLoaderTest
   1123[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest
   1124[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.024 s <<< FAILURE! - in org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest
   1125[ERROR] assertOracleLoad(org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest)  Time elapsed: 0.012 s  <<< ERROR!
   1126java.lang.NullPointerException
   1127	at org.apache.shardingsphere.sql.parser.binder.metadata.index.IndexMetaDataLoaderTest.assertOracleLoad(IndexMetaDataLoaderTest.java:71)
   1128
   1129[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.MetaDataConnectionTest
   1130[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 s - in org.apache.shardingsphere.sql.parser.binder.metadata.MetaDataConnectionTest
   1131[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest
   1132[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.008 s <<< FAILURE! - in org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest
   1133[ERROR] assertOracleGetSchema(org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest)  Time elapsed: 0.001 s  <<< ERROR!
   1134java.lang.NullPointerException
   1135	at org.apache.shardingsphere.sql.parser.binder.metadata.util.JdbcUtilTest.assertOracleGetSchema(JdbcUtilTest.java:47)
   1136
   1137[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.SchemaMetaDataTest
   1138[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.239 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.SchemaMetaDataTest
   1139[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoaderTest
   1140[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.176 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataLoaderTest
   1141[INFO] Running org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataTest
   1142[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in org.apache.shardingsphere.sql.parser.binder.metadata.table.TableMetaDataTest
   1143[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngineTest
   1144[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.LimitPaginationContextEngineTest
   1145[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.RowNumberPaginationContextEngineTest
   1146[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.094 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.RowNumberPaginationContextEngineTest
   1147[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.TopPaginationContextEngineTest
   1148[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.019 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.TopPaginationContextEngineTest
   1149[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngineTest
   1150[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.013 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.engine.PaginationContextEngineTest
   1151[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContextTest
   1152[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.pagination.PaginationContextTest
   1153[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.engine.OrderByContextEngineTest
   1154[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.engine.OrderByContextEngineTest
   1155[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByItemTest
   1156[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.145 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.orderby.OrderByItemTest
   1157[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.engine.GroupByContextEngineTest
   1158[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.groupby.engine.GroupByContextEngineTest
   1159[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.ProjectionsContextTest
   1160[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.ProjectionsContextTest
   1161[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.DerivedColumnTest
   1162[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.DerivedColumnTest
   1163[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionsContextEngineTest
   1164[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionsContextEngineTest
   1165[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionEngineTest
   1166[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.099 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionEngineTest
   1167[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.ShorthandProjectionTest
   1168[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.ShorthandProjectionTest
   1169[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.AggregationDistinctProjectionTest
   1170[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 s - in org.apache.shardingsphere.sql.parser.binder.segment.select.projection.impl.AggregationDistinctProjectionTest
   1171[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.InsertValueContextTest
   1172[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.InsertValueContextTest
   1173[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedParameterMarkerExpressionSegmentTest
   1174[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedParameterMarkerExpressionSegmentTest
   1175[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedLiteralExpressionSegmentTest
   1176[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.expression.DerivedLiteralExpressionSegmentTest
   1177[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.values.OnDuplicateUpdateContextTest
   1178[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.values.OnDuplicateUpdateContextTest
   1179[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.insert.keygen.engine.GeneratedKeyContextEngineTest
   1180[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 s - in org.apache.shardingsphere.sql.parser.binder.segment.insert.keygen.engine.GeneratedKeyContextEngineTest
   1181[INFO] Running org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContextTest
   1182[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 s - in org.apache.shardingsphere.sql.parser.binder.segment.table.TablesContextTest
   1183[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContextFactoryTest
   1184[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.122 s - in org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContextFactoryTest
   1185[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.impl.InsertStatementContextTest
   1186[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 s - in org.apache.shardingsphere.sql.parser.binder.statement.impl.InsertStatementContextTest
   1187[INFO] Running org.apache.shardingsphere.sql.parser.binder.statement.impl.SelectStatementContextTest
   1188[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 s - in org.apache.shardingsphere.sql.parser.binder.statement.impl.SelectStatementContextTest
   1189[INFO] 
   1190[INFO] Results:
   1191[INFO] 
   1192[ERROR] Errors: 
   1193[ERROR]   IndexMetaDataLoaderTest.assertOracleLoad:71 » NullPointer
   1194[ERROR]   JdbcUtilTest.assertOracleGetSchema:47 » NullPointer
   1195[INFO] 
   1196[ERROR] Tests run: 133, Failures: 0, Errors: 2, Skipped: 0
   1197[INFO] 
   1198[INFO] 
   1199[INFO] ------------------------------------------------------------------------
   1200[INFO] Skipping shardingsphere
   1201[INFO] This project has been banned from the build due to previous failures.
   1202[INFO] ------------------------------------------------------------------------
   1203[INFO] ------------------------------------------------------------------------
   1204[INFO] Reactor Summary for shardingsphere 5.0.0-RC1-SNAPSHOT:
   1205[INFO] 
   1206[INFO] shardingsphere ..................................... SUCCESS [  6.580 s]
   1207[INFO] shardingsphere-sql-parser .......................... SUCCESS [  0.849 s]
   1208[INFO] shardingsphere-sql-parser-spi ...................... SUCCESS [  3.980 s]
   1209[INFO] shardingsphere-sql-parser-statement ................ SUCCESS [ 14.323 s]
   1210[INFO] shardingsphere-sql-parser-engine ................... SUCCESS [  7.343 s]
   1211[INFO] shardingsphere-sql-parser-binder ................... FAILURE [ 10.002 s]
   1212[INFO] shardingsphere-sql-parser-dialect .................. SKIPPED
   1213[INFO] shardingsphere-sql-parser-sql92 .................... SKIPPED
   1214[INFO] shardingsphere-sql-parser-mysql .................... SKIPPED
   1215[INFO] shardingsphere-sql-parser-postgresql ............... SKIPPED
   1216[INFO] shardingsphere-sql-parser-oracle ................... SKIPPED
   1217[INFO] shardingsphere-sql-parser-sqlserver ................ SKIPPED
   1218[INFO] shardingsphere-sql-parser-test ..................... SKIPPED
   1219[INFO] shardingsphere-db-protocol ......................... SKIPPED
   1220[INFO] shardingsphere-db-protocol-core .................... SKIPPED
   1221[INFO] shardingsphere-db-protocol-mysql ................... SKIPPED
   1222[INFO] shardingsphere-db-protocol-postgresql .............. SKIPPED
   1223[INFO] shardingsphere-infra ............................... SKIPPED
   1224[INFO] shardingsphere-infra-common ........................ SKIPPED
   1225[INFO] shardingsphere-infra-route ......................... SKIPPED
   1226[INFO] shardingsphere-infra-rewrite ....................... SKIPPED
   1227[INFO] shardingsphere-infra-rewrite-engine ................ SKIPPED
   1228[INFO] shardingsphere-infra-rewrite-test .................. SKIPPED
   1229[INFO] shardingsphere-infra-executor ...................... SKIPPED
   1230[INFO] shardingsphere-infra-merge ......................... SKIPPED
   1231[INFO] shardingsphere-transaction ......................... SKIPPED
   1232[INFO] shardingsphere-transaction-core .................... SKIPPED
   1233[INFO] shardingsphere-kernel .............................. SKIPPED
   1234[INFO] shardingsphere-kernel-context ...................... SKIPPED
   1235[INFO] shardingsphere-features ............................ SKIPPED
   1236[INFO] shardingsphere-sharding ............................ SKIPPED
   1237[INFO] shardingsphere-sharding-api ........................ SKIPPED
   1238[INFO] shardingsphere-sharding-common ..................... SKIPPED
   1239[INFO] shardingsphere-sharding-route ...................... SKIPPED
   1240[INFO] shardingsphere-master-slave ........................ SKIPPED
   1241[INFO] shardingsphere-master-slave-api .................... SKIPPED
   1242[INFO] shardingsphere-master-slave-common ................. SKIPPED
   1243[INFO] shardingsphere-master-slave-route .................. SKIPPED
   1244[INFO] shardingsphere-encrypt ............................. SKIPPED
   1245[INFO] shardingsphere-encrypt-api ......................... SKIPPED
   1246[INFO] shardingsphere-encrypt-common ...................... SKIPPED
   1247[INFO] shardingsphere-encrypt-rewrite ..................... SKIPPED
   1248[INFO] shardingsphere-sharding-rewrite .................... SKIPPED
   1249[INFO] shardingsphere-shadow .............................. SKIPPED
   1250[INFO] shardingsphere-shadow-api .......................... SKIPPED
   1251[INFO] shardingsphere-shadow-common ....................... SKIPPED
   1252[INFO] shardingsphere-shadow-rewrite ...................... SKIPPED
   1253[INFO] shardingsphere-shadow-route ........................ SKIPPED
   1254[INFO] shardingsphere-sharding-merge ...................... SKIPPED
   1255[INFO] shardingsphere-encrypt-merge ....................... SKIPPED
   1256[INFO] shardingsphere-replica ............................. SKIPPED
   1257[INFO] shardingsphere-replica-api ......................... SKIPPED
   1258[INFO] shardingsphere-replica-common ...................... SKIPPED
   1259[INFO] shardingsphere-replica-route ....................... SKIPPED
   1260[INFO] shardingsphere-replica-execute ..................... SKIPPED
   1261[INFO] shardingsphere-jdbc ................................ SKIPPED
   1262[INFO] shardingsphere-jdbc-core ........................... SKIPPED
   1263[INFO] shardingsphere-control-panel ....................... SKIPPED
   1264[INFO] shardingsphere-control-panel-spi ................... SKIPPED
   1265[INFO] shardingsphere-metrics ............................. SKIPPED
   1266[INFO] shardingsphere-metrics-configuration ............... SKIPPED
   1267[INFO] shardingsphere-cluster ............................. SKIPPED
   1268[INFO] shardingsphere-cluster-configuration ............... SKIPPED
   1269[INFO] shardingsphere-orchestration ....................... SKIPPED
   1270[INFO] shardingsphere-orchestration-core .................. SKIPPED
   1271[INFO] shardingsphere-orchestration-core-configuration .... SKIPPED
   1272[INFO] shardingsphere-orchestration-center ................ SKIPPED
   1273[INFO] shardingsphere-orchestration-center-api ............ SKIPPED
   1274[INFO] shardingsphere-orchestration-core-common ........... SKIPPED
   1275[INFO] shardingsphere-orchestration-core-configcenter ..... SKIPPED
   1276[INFO] shardingsphere-orchestration-core-registrycenter ... SKIPPED
   1277[INFO] shardingsphere-orchestration-core-metadatacenter ... SKIPPED
   1278[INFO] shardingsphere-orchestration-core-facade ........... SKIPPED
   1279[INFO] shardingsphere-orchestration-center-configuration .. SKIPPED
   1280[INFO] shardingsphere-cluster-heartbeat ................... SKIPPED
   1281[INFO] shardingsphere-cluster-state ....................... SKIPPED
   1282[INFO] shardingsphere-cluster-facade ...................... SKIPPED
   1283[INFO] shardingsphere-jdbc-orchestration .................. SKIPPED
   1284[INFO] shardingsphere-jdbc-spring ......................... SKIPPED
   1285[INFO] shardingsphere-jdbc-spring-infra ................... SKIPPED
   1286[INFO] shardingsphere-jdbc-spring-boot-starter-infra ...... SKIPPED
   1287[INFO] shardingsphere-jdbc-spring-namespace-infra ......... SKIPPED
   1288[INFO] shardingsphere-sharding-spring ..................... SKIPPED
   1289[INFO] shardingsphere-sharding-spring-boot-starter ........ SKIPPED
   1290[INFO] shardingsphere-shadow-spring ....................... SKIPPED
   1291[INFO] shardingsphere-shadow-spring-boot-starter .......... SKIPPED
   1292[INFO] shardingsphere-encrypt-spring ...................... SKIPPED
   1293[INFO] shardingsphere-encrypt-spring-boot-starter ......... SKIPPED
   1294[INFO] shardingsphere-master-slave-spring ................. SKIPPED
   1295[INFO] shardingsphere-master-slave-spring-boot-starter .... SKIPPED
   1296[INFO] shardingsphere-jdbc-transaction-spring ............. SKIPPED
   1297[INFO] shardingsphere-jdbc-core-spring .................... SKIPPED
   1298[INFO] shardingsphere-jdbc-core-spring-boot-starter ....... SKIPPED
   1299[INFO] shardingsphere-sharding-spring-namespace ........... SKIPPED
   1300[INFO] shardingsphere-master-slave-spring-namespace ....... SKIPPED
   1301[INFO] shardingsphere-encrypt-spring-namespace ............ SKIPPED
   1302[INFO] shardingsphere-shadow-spring-namespace ............. SKIPPED
   1303[INFO] shardingsphere-jdbc-core-spring-namespace .......... SKIPPED
   1304[INFO] shardingsphere-jdbc-orchestration-spring ........... SKIPPED
   1305[INFO] shardingsphere-jdbc-orchestration-spring-boot-starter SKIPPED
   1306[INFO] shardingsphere-jdbc-orchestration-spring-namespace . SKIPPED
   1307[INFO] shardingsphere-metrics-spi ......................... SKIPPED
   1308[INFO] shardingsphere-proxy ............................... SKIPPED
   1309[INFO] shardingsphere-proxy-common ........................ SKIPPED
   1310[INFO] shardingsphere-transaction-2pc ..................... SKIPPED
   1311[INFO] shardingsphere-transaction-xa ...................... SKIPPED
   1312[INFO] shardingsphere-transaction-xa-spi .................. SKIPPED
   1313[INFO] shardingsphere-transaction-xa-atomikos ............. SKIPPED
   1314[INFO] shardingsphere-transaction-xa-core ................. SKIPPED
   1315[INFO] shardingsphere-proxy-backend ....................... SKIPPED
   1316[INFO] shardingsphere-proxy-frontend ...................... SKIPPED
   1317[INFO] shardingsphere-proxy-frontend-spi .................. SKIPPED
   1318[INFO] shardingsphere-proxy-frontend-core ................. SKIPPED
   1319[INFO] shardingsphere-proxy-frontend-mysql ................ SKIPPED
   1320[INFO] shardingsphere-proxy-frontend-postgresql ........... SKIPPED
   1321[INFO] shardingsphere-orchestration-center-zookeeper-curator SKIPPED
   1322[INFO] shardingsphere-metrics-facade ...................... SKIPPED
   1323[INFO] shardingsphere-orchestration-core-schema ........... SKIPPED
   1324[INFO] shardingsphere-proxy-orchestration ................. SKIPPED
   1325[INFO] shardingsphere-opentracing ......................... SKIPPED
   1326[INFO] shardingsphere-metrics-prometheus .................. SKIPPED
   1327[INFO] shardingsphere-proxy-bootstrap ..................... SKIPPED
   1328[INFO] shardingsphere-sharding-time-service ............... SKIPPED
   1329[INFO] shardingsphere-scaling ............................. SKIPPED
   1330[INFO] shardingsphere-scaling-core ........................ SKIPPED
   1331[INFO] shardingsphere-scaling-mysql ....................... SKIPPED
   1332[INFO] shardingsphere-scaling-postgresql .................. SKIPPED
   1333[INFO] shardingsphere-scaling-bootstrap ................... SKIPPED
   1334[INFO] shardingsphere-transaction-xa-narayana ............. SKIPPED
   1335[INFO] shardingsphere-transaction-xa-bitronix ............. SKIPPED
   1336[INFO] shardingsphere-transaction-base .................... SKIPPED
   1337[INFO] shardingsphere-transaction-base-seata-at ........... SKIPPED
   1338[INFO] shardingsphere-control-panel-core .................. SKIPPED
   1339[INFO] shardingsphere-orchestration-center-etcd ........... SKIPPED
   1340[INFO] shardingsphere-orchestration-center-apollo ......... SKIPPED
   1341[INFO] shardingsphere-orchestration-center-nacos .......... SKIPPED
   1342[INFO] shardingsphere-integration-test .................... SKIPPED
   1343[INFO] shardingsphere-test-fixture ........................ SKIPPED
   1344[INFO] shardingsphere-proxy-docker-build .................. SKIPPED
   1345[INFO] shardingsphere-test-suite .......................... SKIPPED
   1346[INFO] shardingsphere-distribution ........................ SKIPPED
   1347[INFO] shardingsphere-src-distribution .................... SKIPPED
   1348[INFO] shardingsphere-jdbc-distribution ................... SKIPPED
   1349[INFO] shardingsphere-proxy-distribution .................. SKIPPED
   1350[INFO] shardingsphere-scaling-distribution ................ SKIPPED
   1351[INFO] ------------------------------------------------------------------------
   1352[INFO] BUILD FAILURE
   1353[INFO] ------------------------------------------------------------------------
   1354[INFO] Total time:  45.093 s
   1355[INFO] Finished at: 2020-07-19T01:51:23Z
   1356[INFO] ------------------------------------------------------------------------
   1357[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project shardingsphere-sql-parser-binder: There are test failures.
   ```
   
   Trista


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457103610



##########
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:
       Sorry, I mean here is a blank line at line 75, and it is useless, could you remove it?
   @feiweihy 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456277444



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       I need to connect to real oracle database. Is it work to mock oracle database?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456189574



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/metadata/util/JdbcUtil.java
##########
@@ -36,7 +36,7 @@ public static String getSchema(final Connection connection, final String databas
         String result = null;
         try {
             if ("Oracle".equals(databaseType)) {

Review comment:
       Hi ``
   Maybe we can consider something like the following statement. I mean, we had better avoid the comparison of the absolute characters, like `"Oracle"`.
   
   > connection.getMetaData().getDatabaseProductName().equals(databaseType).
   
   It is not hard, could you give it a change?

##########
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,108 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        System.out.println("Start...");
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";

Review comment:
       Hi, Please firstly look at the CI test, which showed there is something wrong with your PR. I presume it is about check style here.
   
   Besides, I hope there is no Oracle database instance required for your unit test. Otherwise, It is supposed to be removed.
   
   I know those comments may frustrate you somehow, but what you did is entirely open to the whole community. I believe you also want to be a significant part of this community as well, don't you?
   
   If you need any help, please contact me.  :-)
   
   Best,
   Trista
   
   I am sorry 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero merged pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r457082525



##########
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:
       Hi @feiweihy Now this PR looks great. Good job!
   Here is the last one to improve, please remove this redundant line.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] feiweihy removed a comment on pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
feiweihy removed a comment on pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#issuecomment-660053789


   i saw developers use mocking db in these classes . but as i said upstairs,  the bug will not occur when mocking db nor an oracle db which just have one app user, it will just happen when an oracle db has multi users. Without real db, how can i prove i have fixed it.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456192504



##########
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,108 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        System.out.println("Start...");
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";

Review comment:
       Hi, Please firstly look at the `travis-c` test, which showed there is something wrong with your PR. I presume it is about check style here.
   
   Besides, I hope there is no Oracle database instance required for your unit test. Otherwise, It is supposed to be removed.
   
   I know those comments may frustrate you somehow, but what you did is entirely open to the whole community. I believe you also want to be a significant part of this community as well, don't you?
   
   If you need any help, please contact me.  :-)
   
   Best,
   Trista
   
   I am sorry 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [shardingsphere] yu199195 commented on a change in pull request #6366: fix oracle bug which will occur when a database has multi users

Posted by GitBox <gi...@apache.org>.
yu199195 commented on a change in pull request #6366:
URL: https://github.com/apache/shardingsphere/pull/6366#discussion_r456361728



##########
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,107 @@
+package org.apache.shardingsphere.sql.parser.binder.metadata.table;
+
+import org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaDataLoader;
+import org.junit.Test;
+
+import javax.sql.DataSource;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.LinkedList;
+import java.util.logging.Logger;
+
+public final class SchemaMetaDataLoaderTest {
+    private static int minIdleCount = 3;
+    private static int maxIdleCount = 10;
+    private static int currentIdleCount = 0;
+    private static final LinkedList<Connection> connectionsPool = new LinkedList<Connection>();
+
+    @Test
+    public void assertloadAllTableNamesForOracle() throws SQLException {
+        LiteDatasource dataSource = new LiteDatasource();
+        SchemaMetaDataLoader.load(dataSource,5,"Oracle");
+    }
+
+    class LiteDatasource implements DataSource{
+        private String url = "jdbc:oracle:thin:@192.168.1.1:1521/orcl";
+        private String user = "test";
+        private String password = "111111";
+        public LiteDatasource(){
+            try {
+                for (int i = 0; i < SchemaMetaDataLoaderTest.maxIdleCount; i++) {
+                    Class.forName("oracle.jdbc.OracleDriver");

Review comment:
       All of our database tests are mocks, If  a real database, how can someone else's environment have one?




----------------------------------------------------------------
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:
users@infra.apache.org