This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 4186a0d Fix test case error for #10588 (#10592)
4186a0d is described below
commit 4186a0d5c52ec087c817ea6eef3cf18f96b901a3
Author: Liang Zhang <[email protected]>
AuthorDate: Mon May 31 20:13:10 2021 +0800
Fix test case error for #10588 (#10592)
---
.../command/query/binary/bind/PostgreSQLComBindExecutorTest.java | 6 ++----
.../command/query/text/PostgreSQLComQueryExecutorTest.java | 4 ++--
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
index b8af727..33c1441 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutorTest.java
@@ -33,6 +33,7 @@ import
org.apache.shardingsphere.proxy.backend.response.header.query.QueryRespon
import
org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryHeader;
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.frontend.command.executor.ResponseType;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -139,8 +140,7 @@ public final class PostgreSQLComBindExecutorTest {
@Test
public void assertExecuteBindPacketWithUpdateSQL() throws SQLException {
- UpdateResponseHeader updateResponseHeader =
mock(UpdateResponseHeader.class);
-
when(databaseCommunicationEngine.execute()).thenReturn(updateResponseHeader);
+ when(databaseCommunicationEngine.execute()).thenReturn(new
UpdateResponseHeader(mock(InsertStatement.class)));
PostgreSQLComBindExecutor executor = new
PostgreSQLComBindExecutor(bindPacket, backendConnection);
setMockFieldIntoExecutor(executor);
Collection<DatabasePacket<?>> actual = executor.execute();
@@ -149,8 +149,6 @@ public final class PostgreSQLComBindExecutorTest {
assertThat(actualPackets.next(),
is(instanceOf(PostgreSQLBindCompletePacket.class)));
assertThat(actualPackets.next(),
is(instanceOf(PostgreSQLCommandCompletePacket.class)));
assertThat(executor.getResponseType(), is(ResponseType.UPDATE));
- verify(updateResponseHeader).getSqlStatement();
- verify(updateResponseHeader).getUpdateCount();
}
@SneakyThrows
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutorTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutorTest.java
index 60f7e96..1118f7e 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutorTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/text/PostgreSQLComQueryExecutorTest.java
@@ -30,6 +30,7 @@ import
org.apache.shardingsphere.proxy.backend.response.header.query.impl.QueryH
import
org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandler;
import org.apache.shardingsphere.proxy.frontend.command.executor.ResponseType;
+import
org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -103,8 +104,7 @@ public final class PostgreSQLComQueryExecutorTest {
@Test
public void assertExecuteUpdate() throws SQLException {
- UpdateResponseHeader updateResponseHeader =
mock(UpdateResponseHeader.class);
-
when(textProtocolBackendHandler.execute()).thenReturn(updateResponseHeader);
+ when(textProtocolBackendHandler.execute()).thenReturn(new
UpdateResponseHeader(mock(InsertStatement.class)));
Collection<DatabasePacket<?>> actual = queryExecutor.execute();
assertThat(actual.size(), is(1));
assertThat(actual.iterator().next(),
is(instanceOf(PostgreSQLCommandCompletePacket.class)));