This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 760b1d9  fix unit test (#6621)
760b1d9 is described below

commit 760b1d957169266d42e46586787c810b0fed233b
Author: kimmking <[email protected]>
AuthorDate: Sun Aug 9 00:02:29 2020 +0800

    fix unit test (#6621)
---
 .../DatabaseCommunicationEngineFactoryTest.java     | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
index ec1d503..86e75e5 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/DatabaseCommunicationEngineFactoryTest.java
@@ -18,12 +18,9 @@
 package org.apache.shardingsphere.proxy.backend.communication.jdbc;
 
 import org.apache.shardingsphere.kernel.context.SchemaContext;
-import org.apache.shardingsphere.kernel.context.runtime.RuntimeContext;
-import org.apache.shardingsphere.kernel.context.schema.ShardingSphereSchema;
 import 
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine;
 import 
org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngineFactory;
 import 
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
-import 
org.apache.shardingsphere.rdl.parser.engine.ShardingSphereSQLParserEngine;
 import org.apache.shardingsphere.sql.parser.sql.statement.SQLStatement;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,6 +32,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -42,17 +40,16 @@ public final class DatabaseCommunicationEngineFactoryTest {
     
     private SchemaContext schemaContext;
     
+    private BackendConnection backendConnection;
+    
     @Before
     public void setUp() {
-        schemaContext = mock(SchemaContext.class);
-        ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
-        RuntimeContext runtimeContext = mock(RuntimeContext.class);
-        ShardingSphereSQLParserEngine sqlParserEngine = 
mock(ShardingSphereSQLParserEngine.class);
-        when(sqlParserEngine.parse(anyString(), 
anyBoolean())).thenReturn(mock(SQLStatement.class));
-        when(runtimeContext.getSqlParserEngine()).thenReturn(sqlParserEngine);
-        when(schema.getRules()).thenReturn(Collections.emptyList());
-        when(schemaContext.getSchema()).thenReturn(schema);
-        when(schemaContext.getRuntimeContext()).thenReturn(runtimeContext);
+        schemaContext = mock(SchemaContext.class, RETURNS_DEEP_STUBS);
+        
when(schemaContext.getSchema().getRules()).thenReturn(Collections.emptyList());
+        
when(schemaContext.getRuntimeContext().getSqlParserEngine().parse(anyString(), 
anyBoolean())).thenReturn(mock(SQLStatement.class));
+    
+        backendConnection = mock(BackendConnection.class, RETURNS_DEEP_STUBS);
+        when(backendConnection.isSerialExecute()).thenReturn(true);
     }
     
     @Test

Reply via email to