This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 20af443 Rename auth to authentication or authenticated for meaningful
and clear reason (#10050)
20af443 is described below
commit 20af443ee6670aac77a9a3fcb1ee9dbc1c3c28df
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Apr 12 18:54:17 2021 +0800
Rename auth to authentication or authenticated for meaningful and clear
reason (#10050)
---
.../packet/handshake/MySQLAuthPluginData.java | 8 ++++----
.../handshake/MySQLAuthSwitchRequestPacket.java | 4 ++--
.../handshake/MySQLAuthSwitchResponsePacket.java | 2 +-
.../packet/handshake/MySQLHandshakePacket.java | 4 ++--
.../handshake/MySQLHandshakeResponse41Packet.java | 2 +-
.../packet/handshake/MySQLAuthPluginDataTest.java | 4 ++--
.../MySQLAuthSwitchRequestPacketTest.java | 2 +-
.../packet/handshake/MySQLHandshakePacketTest.java | 4 ++--
.../AuthenticationResultBuilder.java | 2 +-
.../netty/FrontendChannelInboundHandler.java | 14 ++++++-------
.../AuthenticationResultBuilderTest.java | 2 +-
.../DatabaseProtocolFrontendEngineFixture.java | 4 ++--
.../proxy/frontend/mysql/MySQLFrontendEngine.java | 10 +++++-----
.../MySQLAuthenticationEngine.java | 10 +++++-----
.../MySQLAuthenticationHandler.java | 14 ++++++-------
.../frontend/mysql/MySQLFrontendEngineTest.java | 14 ++++++-------
.../MySQLAuthenticationEngineTest.java | 14 ++++++-------
.../MySQLAuthenticationHandlerTest.java | 4 ++--
.../postgresql/PostgreSQLFrontendEngine.java | 12 +++++------
.../PostgreSQLAuthenticationEngine.java | 10 +++++-----
.../PostgreSQLAuthenticationHandler.java | 2 +-
.../PostgreSQLLoginResult.java | 2 +-
.../PostgreSQLAuthenticationEngineTest.java | 14 ++++++-------
.../PostgreSQLAuthenticationHandlerTest.java | 2 +-
.../AuthenticationEngine.java | 6 +++---
.../AuthenticationResult.java | 2 +-
.../spi/DatabaseProtocolFrontendEngine.java | 4 ++--
.../client/netty/MySQLCommandPacketDecoder.java | 6 +++---
.../mysql/client/netty/MySQLNegotiateHandler.java | 2 +-
.../netty/MySQLCommandPacketDecoderTest.java | 23 +++++++++++-----------
30 files changed, 101 insertions(+), 102 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginData.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginData.java
index 175b213..0b6de31 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginData.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginData.java
@@ -22,7 +22,7 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
- * Auth plugin data for MySQL.
+ * Authentication plugin data for MySQL.
*
* <p>
* The auth-plugin-data is the concatenation of strings
auth-plugin-data-part-1 and auth-plugin-data-part-2.
@@ -42,11 +42,11 @@ public final class MySQLAuthPluginData {
}
/**
- * Get auth plugin data.
+ * Get authentication plugin data.
*
- * @return auth plugin data
+ * @return authentication plugin data
*/
- public byte[] getAuthPluginData() {
+ public byte[] getAuthenticationPluginData() {
return Bytes.concat(authPluginDataPart1, authPluginDataPart2);
}
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java
index 8f24abf..f62ab92 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacket.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.db.protocol.mysql.packet.MySQLPacket;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
/**
- * MySQL auth switch request packet.
+ * MySQL authentication switch request packet.
*
* @see <a
href="https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest">AuthSwitchRequest</a>
*/
@@ -41,6 +41,6 @@ public final class MySQLAuthSwitchRequestPacket implements
MySQLPacket {
public void write(final MySQLPacketPayload payload) {
payload.writeInt1(0xfe);
payload.writeStringNul(authPluginName);
- payload.writeStringNul(new String(authPluginData.getAuthPluginData()));
+ payload.writeStringNul(new
String(authPluginData.getAuthenticationPluginData()));
}
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacket.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacket.java
index 935f0cf..7cd3811 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacket.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchResponsePacket.java
@@ -22,7 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
/**
- * MySQL auth switch request packet.
+ * MySQL authentication switch request packet.
*
* @see <a
href="https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchResponse">AuthSwitchResponse</a>
*/
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
index 8043791..92ace14 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
@@ -97,7 +97,7 @@ public final class MySQLHandshakePacket implements
MySQLPacket {
}
/**
- * Set auth plugin name.
+ * Set authentication plugin name.
*
* @param mysqlAuthenticationMethod MySQL authentication method
*/
@@ -116,7 +116,7 @@ public final class MySQLHandshakePacket implements
MySQLPacket {
payload.writeInt1(characterSet);
payload.writeInt2(statusFlag.getValue());
payload.writeInt2(capabilityFlagsUpper);
- payload.writeInt1(isClientPluginAuth() ?
authPluginData.getAuthPluginData().length + 1 : 0);
+ payload.writeInt1(isClientPluginAuth() ?
authPluginData.getAuthenticationPluginData().length + 1 : 0);
payload.writeReserved(10);
writeAuthPluginDataPart2(payload);
writeAuthPluginName(payload);
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java
index 29bfb28..bcbff83 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakeResponse41Packet.java
@@ -93,7 +93,7 @@ public final class MySQLHandshakeResponse41Packet implements
MySQLPacket {
}
/**
- * Set auth plugin name.
+ * Set authentication plugin name.
*
* @param mysqlAuthenticationMethod MySQL authentication method
*/
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginDataTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginDataTest.java
index 54e1c34..2a0f96a 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginDataTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthPluginDataTest.java
@@ -32,7 +32,7 @@ public final class MySQLAuthPluginDataTest {
MySQLAuthPluginData actual = new MySQLAuthPluginData(actualPart1,
actualPart2);
assertThat(actual.getAuthPluginDataPart1(), is(actualPart1));
assertThat(actual.getAuthPluginDataPart2(), is(actualPart2));
- assertThat(actual.getAuthPluginData(), is(Bytes.concat(actualPart1,
actualPart2)));
+ assertThat(actual.getAuthenticationPluginData(),
is(Bytes.concat(actualPart1, actualPart2)));
}
@Test
@@ -40,6 +40,6 @@ public final class MySQLAuthPluginDataTest {
MySQLAuthPluginData actual = new MySQLAuthPluginData();
assertThat(actual.getAuthPluginDataPart1().length, is(8));
assertThat(actual.getAuthPluginDataPart2().length, is(12));
- assertThat(actual.getAuthPluginData().length, is(20));
+ assertThat(actual.getAuthenticationPluginData().length, is(20));
}
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
index 446607e..467ed9f 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLAuthSwitchRequestPacketTest.java
@@ -39,7 +39,7 @@ public final class MySQLAuthSwitchRequestPacketTest {
@Test
public void assertWrite() {
- when(authPluginData.getAuthPluginData()).thenReturn(new byte[] {0x11,
0x22});
+ when(authPluginData.getAuthenticationPluginData()).thenReturn(new
byte[] {0x11, 0x22});
MySQLAuthSwitchRequestPacket authSwitchRequestPacket = new
MySQLAuthSwitchRequestPacket(1, "plugin", authPluginData);
authSwitchRequestPacket.write(payload);
verify(payload).writeInt1(0xfe);
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
index 7035710..b56e47f 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacketTest.java
@@ -97,7 +97,7 @@ public final class MySQLHandshakePacketTest {
verify(payload).writeInt1(MySQLServerInfo.CHARSET);
verify(payload).writeInt2(MySQLStatusFlag.SERVER_STATUS_AUTOCOMMIT.getValue());
verify(payload).writeInt2(MySQLCapabilityFlag.calculateHandshakeCapabilityFlagsUpper());
- verify(payload).writeInt1(authPluginData.getAuthPluginData().length +
1);
+
verify(payload).writeInt1(authPluginData.getAuthenticationPluginData().length +
1);
verify(payload).writeReserved(10);
verify(payload).writeStringNul(new
String(authPluginData.getAuthPluginDataPart2()));
}
@@ -116,7 +116,7 @@ public final class MySQLHandshakePacketTest {
verify(payload).writeInt1(MySQLServerInfo.CHARSET);
verify(payload).writeInt2(MySQLStatusFlag.SERVER_STATUS_AUTOCOMMIT.getValue());
verify(payload).writeInt2(MySQLCapabilityFlag.CLIENT_PLUGIN_AUTH.getValue() >>
16);
- verify(payload).writeInt1(authPluginData.getAuthPluginData().length +
1);
+
verify(payload).writeInt1(authPluginData.getAuthenticationPluginData().length +
1);
verify(payload).writeReserved(10);
verify(payload).writeStringNul(new
String(authPluginData.getAuthPluginDataPart2()));
verify(payload).writeStringNul(MySQLAuthenticationMethod.SECURE_PASSWORD_AUTHENTICATION.getMethodName());
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilder.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
similarity index 97%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilder.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
index 95a027a..acef336 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilder.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilder.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.auth;
+package org.apache.shardingsphere.proxy.frontend.authentication;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
index 4347ce0..d823b97 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/netty/FrontendChannelInboundHandler.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.infra.metadata.user.Grantee;
import
org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResult;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import
org.apache.shardingsphere.proxy.frontend.executor.ChannelThreadExecutorGroup;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.apache.shardingsphere.proxy.frontend.state.ProxyStateContext;
@@ -43,7 +43,7 @@ public final class FrontendChannelInboundHandler extends
ChannelInboundHandlerAd
private final BackendConnection backendConnection;
- private volatile boolean authorized;
+ private volatile boolean authenticated;
public FrontendChannelInboundHandler(final DatabaseProtocolFrontendEngine
databaseProtocolFrontendEngine) {
this.databaseProtocolFrontendEngine = databaseProtocolFrontendEngine;
@@ -54,21 +54,21 @@ public final class FrontendChannelInboundHandler extends
ChannelInboundHandlerAd
@Override
public void channelActive(final ChannelHandlerContext context) {
ChannelThreadExecutorGroup.getInstance().register(context.channel().id());
-
backendConnection.setConnectionId(databaseProtocolFrontendEngine.getAuthEngine().handshake(context));
+
backendConnection.setConnectionId(databaseProtocolFrontendEngine.getAuthenticationEngine().handshake(context));
}
@Override
public void channelRead(final ChannelHandlerContext context, final Object
message) {
- if (!authorized) {
- authorized = auth(context, (ByteBuf) message);
+ if (!authenticated) {
+ authenticated = authenticate(context, (ByteBuf) message);
return;
}
ProxyStateContext.execute(context, message,
databaseProtocolFrontendEngine, backendConnection);
}
- private boolean auth(final ChannelHandlerContext context, final ByteBuf
message) {
+ private boolean authenticate(final ChannelHandlerContext context, final
ByteBuf message) {
try (PacketPayload payload =
databaseProtocolFrontendEngine.getCodecEngine().createPacketPayload(message)) {
- AuthenticationResult authResult =
databaseProtocolFrontendEngine.getAuthEngine().auth(context, payload);
+ AuthenticationResult authResult =
databaseProtocolFrontendEngine.getAuthenticationEngine().authenticate(context,
payload);
if (authResult.isFinished()) {
backendConnection.setGrantee(new
Grantee(authResult.getUsername(), authResult.getHostname()));
backendConnection.setCurrentSchema(authResult.getDatabase());
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilderTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
similarity index 97%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilderTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
index b95193f..86ae833 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResultBuilderTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResultBuilderTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.auth;
+package org.apache.shardingsphere.proxy.frontend.authentication;
import org.junit.Test;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
index 390cb26..0135361 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.frontend.fixture;
import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
@@ -42,7 +42,7 @@ public final class DatabaseProtocolFrontendEngineFixture
implements DatabaseProt
}
@Override
- public AuthenticationEngine getAuthEngine() {
+ public AuthenticationEngine getAuthenticationEngine() {
return null;
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
index 8b2d186..176c2b8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngine.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
import
org.apache.shardingsphere.db.protocol.mysql.codec.MySQLPacketCodecEngine;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-import
org.apache.shardingsphere.proxy.frontend.mysql.auth.MySQLAuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.mysql.authentication.MySQLAuthenticationEngine;
import
org.apache.shardingsphere.proxy.frontend.mysql.command.MySQLCommandExecuteEngine;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
@@ -34,18 +34,18 @@ public final class MySQLFrontendEngine implements
DatabaseProtocolFrontendEngine
private final FrontendContext frontendContext = new FrontendContext(false,
true);
- private final MySQLAuthenticationEngine authEngine = new
MySQLAuthenticationEngine();
+ private final MySQLAuthenticationEngine authenticationEngine = new
MySQLAuthenticationEngine();
private final MySQLCommandExecuteEngine commandExecuteEngine = new
MySQLCommandExecuteEngine();
private final DatabasePacketCodecEngine<?> codecEngine = new
MySQLPacketCodecEngine();
@Override
- public String getDatabaseType() {
- return "MySQL";
+ public void release(final BackendConnection backendConnection) {
}
@Override
- public void release(final BackendConnection backendConnection) {
+ public String getDatabaseType() {
+ return "MySQL";
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
similarity index 93%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngine.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
index 4e27a13..04c7341 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.mysql.auth;
+package org.apache.shardingsphere.proxy.frontend.mysql.authentication;
import com.google.common.base.Strings;
import io.netty.channel.ChannelHandlerContext;
@@ -33,9 +33,9 @@ import
org.apache.shardingsphere.db.protocol.mysql.payload.MySQLPacketPayload;
import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
-import
org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationEngine;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResult;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -65,7 +65,7 @@ public final class MySQLAuthenticationEngine implements
AuthenticationEngine {
}
@Override
- public AuthenticationResult auth(final ChannelHandlerContext context,
final PacketPayload payload) {
+ public AuthenticationResult authenticate(final ChannelHandlerContext
context, final PacketPayload payload) {
if (MySQLConnectionPhase.AUTH_PHASE_FAST_PATH == connectionPhase) {
currentAuthResult = authPhaseFastPath(context, payload);
if (!currentAuthResult.isFinished()) {
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
similarity index 86%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandler.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
index de39823..e25d7b8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.mysql.auth;
+package org.apache.shardingsphere.proxy.frontend.mysql.authentication;
import com.google.common.base.Strings;
import lombok.Getter;
@@ -48,13 +48,13 @@ public final class MySQLAuthenticationHandler {
*
* @param username username
* @param hostname hostname
- * @param authResponse auth response
+ * @param authenticationResponse authentication response
* @param databaseName database name
* @return login success or failure
*/
- public Optional<MySQLServerErrorCode> login(final String username, final
String hostname, final byte[] authResponse, final String databaseName) {
+ public Optional<MySQLServerErrorCode> login(final String username, final
String hostname, final byte[] authenticationResponse, final String
databaseName) {
Optional<ShardingSphereUser> user =
ProxyContext.getInstance().getMetaDataContexts().getUsers().findUser(new
Grantee(username, hostname));
- if (!user.isPresent() || !isPasswordRight(user.get().getPassword(),
authResponse)) {
+ if (!user.isPresent() || !isPasswordRight(user.get().getPassword(),
authenticationResponse)) {
return Optional.of(MySQLServerErrorCode.ER_ACCESS_DENIED_ERROR);
}
return null == databaseName || SQLCheckEngine.check(databaseName,
getRules(databaseName), user.get().getGrantee())
@@ -68,9 +68,9 @@ public final class MySQLAuthenticationHandler {
private byte[] getAuthCipherBytes(final String password) {
byte[] sha1Password = DigestUtils.sha1(password);
byte[] doubleSha1Password = DigestUtils.sha1(sha1Password);
- byte[] concatBytes = new
byte[authPluginData.getAuthPluginData().length + doubleSha1Password.length];
- System.arraycopy(authPluginData.getAuthPluginData(), 0, concatBytes,
0, authPluginData.getAuthPluginData().length);
- System.arraycopy(doubleSha1Password, 0, concatBytes,
authPluginData.getAuthPluginData().length, doubleSha1Password.length);
+ byte[] concatBytes = new
byte[authPluginData.getAuthenticationPluginData().length +
doubleSha1Password.length];
+ System.arraycopy(authPluginData.getAuthenticationPluginData(), 0,
concatBytes, 0, authPluginData.getAuthenticationPluginData().length);
+ System.arraycopy(doubleSha1Password, 0, concatBytes,
authPluginData.getAuthenticationPluginData().length, doubleSha1Password.length);
byte[] sha1ConcatBytes = DigestUtils.sha1(concatBytes);
return xor(sha1Password, sha1ConcatBytes);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
index 9b92886..9ef9a79 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLFrontendEngineTest.java
@@ -35,9 +35,9 @@ import
org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUsers;
import
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResult;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
-import
org.apache.shardingsphere.proxy.frontend.mysql.auth.MySQLAuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.mysql.authentication.MySQLAuthenticationEngine;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -96,7 +96,7 @@ public final class MySQLFrontendEngineTest {
@Test
public void assertHandshake() {
- assertTrue(mysqlFrontendEngine.getAuthEngine().handshake(context) > 0);
+
assertTrue(mysqlFrontendEngine.getAuthenticationEngine().handshake(context) >
0);
verify(context).writeAndFlush(isA(MySQLHandshakePacket.class));
}
@@ -108,7 +108,7 @@ public final class MySQLFrontendEngineTest {
when(payload.readStringNulByBytes()).thenReturn("root".getBytes());
when(channel.remoteAddress()).thenReturn(new
InetSocketAddress("localhost", 3307));
when(context.channel()).thenReturn(channel);
- AuthenticationResult actual =
mysqlFrontendEngine.getAuthEngine().auth(context, payload);
+ AuthenticationResult actual =
mysqlFrontendEngine.getAuthenticationEngine().authenticate(context, payload);
assertThat(actual.getUsername(), is("root"));
assertNull(actual.getDatabase());
assertTrue(actual.isFinished());
@@ -123,7 +123,7 @@ public final class MySQLFrontendEngineTest {
when(payload.readStringNulByBytes()).thenReturn("root".getBytes());
when(channel.remoteAddress()).thenReturn(new
InetSocketAddress("localhost", 3307));
when(context.channel()).thenReturn(channel);
- AuthenticationResult actual =
mysqlFrontendEngine.getAuthEngine().auth(context, payload);
+ AuthenticationResult actual =
mysqlFrontendEngine.getAuthenticationEngine().authenticate(context, payload);
assertThat(actual.getUsername(), is("root"));
assertNull(actual.getDatabase());
assertTrue(actual.isFinished());
@@ -138,7 +138,7 @@ public final class MySQLFrontendEngineTest {
when(payload.readStringNulByBytes()).thenReturn("root".getBytes());
when(context.channel()).thenReturn(channel);
when(channel.remoteAddress()).thenReturn(new
InetSocketAddress(InetAddress.getByAddress(new byte[]{(byte) 192, (byte) 168,
(byte) 0, (byte) 102}), 3307));
- AuthenticationResult actual =
mysqlFrontendEngine.getAuthEngine().auth(context, payload);
+ AuthenticationResult actual =
mysqlFrontendEngine.getAuthenticationEngine().authenticate(context, payload);
assertThat(actual.getUsername(), is("root"));
assertNull(actual.getDatabase());
assertTrue(actual.isFinished());
@@ -149,7 +149,7 @@ public final class MySQLFrontendEngineTest {
private void setConnectionPhase(final MySQLConnectionPhase
connectionPhase) {
Field field =
MySQLAuthenticationEngine.class.getDeclaredField("connectionPhase");
field.setAccessible(true);
- field.set(mysqlFrontendEngine.getAuthEngine(), connectionPhase);
+ field.set(mysqlFrontendEngine.getAuthenticationEngine(),
connectionPhase);
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngineTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
similarity index 94%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngineTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
index 4f82244..e6dc0b8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationEngineTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngineTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.mysql.auth;
+package org.apache.shardingsphere.proxy.frontend.mysql.authentication;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
@@ -36,7 +36,7 @@ import
org.apache.shardingsphere.infra.metadata.user.ShardingSphereUsers;
import
org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;
import
org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import
org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResultBuilder;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
import org.junit.Before;
import org.junit.Test;
@@ -94,7 +94,7 @@ public final class MySQLAuthenticationEngineTest {
when(channel.remoteAddress()).thenReturn(new
InetSocketAddress("localhost", 3307));
when(channelHandlerContext.channel()).thenReturn(channel);
when(payload.readInt4()).thenReturn(MySQLCapabilityFlag.CLIENT_PLUGIN_AUTH.getValue());
- authenticationEngine.auth(channelHandlerContext, payload);
+ authenticationEngine.authenticate(channelHandlerContext, payload);
assertThat(getConnectionPhase(),
is(MySQLConnectionPhase.AUTHENTICATION_METHOD_MISMATCH));
}
@@ -109,7 +109,7 @@ public final class MySQLAuthenticationEngineTest {
when(channel.remoteAddress()).thenReturn(new
InetSocketAddress("localhost", 3307));
when(channelHandlerContext.channel()).thenReturn(channel);
setAuthenticationResult();
- authenticationEngine.auth(channelHandlerContext, payload);
+ authenticationEngine.authenticate(channelHandlerContext, payload);
assertThat(getAuthResponse(), is(authResponse));
}
@@ -126,7 +126,7 @@ public final class MySQLAuthenticationEngineTest {
ChannelHandlerContext context = getContext();
setMetaDataContexts();
when(authenticationHandler.login(anyString(), any(), any(),
anyString())).thenReturn(Optional.of(MySQLServerErrorCode.ER_ACCESS_DENIED_ERROR));
- authenticationEngine.auth(context, getPayload("root", "sharding_db",
authResponse));
+ authenticationEngine.authenticate(context, getPayload("root",
"sharding_db", authResponse));
verify(context).writeAndFlush(any(MySQLErrPacket.class));
}
@@ -135,7 +135,7 @@ public final class MySQLAuthenticationEngineTest {
ChannelHandlerContext context = getContext();
setMetaDataContexts();
setConnectionPhase(MySQLConnectionPhase.AUTH_PHASE_FAST_PATH);
- authenticationEngine.auth(context, getPayload("root", "ABSENT
DATABASE", authResponse));
+ authenticationEngine.authenticate(context, getPayload("root", "ABSENT
DATABASE", authResponse));
verify(context).writeAndFlush(any(MySQLErrPacket.class));
}
@@ -145,7 +145,7 @@ public final class MySQLAuthenticationEngineTest {
ChannelHandlerContext context = getContext();
when(authenticationHandler.login(anyString(), any(), any(),
anyString())).thenReturn(Optional.empty());
setMetaDataContexts();
- authenticationEngine.auth(context, getPayload("root", "sharding_db",
authResponse));
+ authenticationEngine.authenticate(context, getPayload("root",
"sharding_db", authResponse));
verify(context).writeAndFlush(any(MySQLOKPacket.class));
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
similarity index 98%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandlerTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
index 0af56f0..196c048 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/auth/MySQLAuthenticationHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.mysql.auth;
+package org.apache.shardingsphere.proxy.frontend.mysql.authentication;
import com.google.common.primitives.Bytes;
import lombok.SneakyThrows;
@@ -117,7 +117,7 @@ public final class MySQLAuthenticationHandlerTest {
@Test
public void assertGetAuthPluginData() {
-
assertThat(authenticationHandler.getAuthPluginData().getAuthPluginData(),
is(Bytes.concat(part1, part2)));
+
assertThat(authenticationHandler.getAuthPluginData().getAuthenticationPluginData(),
is(Bytes.concat(part1, part2)));
}
private void setAuthority(final ShardingSphereUser user) {
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
index 4a41fcf..5b94b7d 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/PostgreSQLFrontendEngine.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.codec.PostgreSQLPacketCo
import
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.binary.BinaryStatementRegistry;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-import
org.apache.shardingsphere.proxy.frontend.postgresql.auth.PostgreSQLAuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.postgresql.authentication.PostgreSQLAuthenticationEngine;
import
org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine;
import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
@@ -35,19 +35,19 @@ public final class PostgreSQLFrontendEngine implements
DatabaseProtocolFrontendE
private final FrontendContext frontendContext = new FrontendContext(true,
false);
- private final PostgreSQLAuthenticationEngine authEngine = new
PostgreSQLAuthenticationEngine();
+ private final PostgreSQLAuthenticationEngine authenticationEngine = new
PostgreSQLAuthenticationEngine();
private final PostgreSQLCommandExecuteEngine commandExecuteEngine = new
PostgreSQLCommandExecuteEngine();
private final DatabasePacketCodecEngine<?> codecEngine = new
PostgreSQLPacketCodecEngine();
@Override
- public String getDatabaseType() {
- return "PostgreSQL";
+ public void release(final BackendConnection backendConnection) {
+
BinaryStatementRegistry.getInstance().unregister(backendConnection.getConnectionId());
}
@Override
- public void release(final BackendConnection backendConnection) {
-
BinaryStatementRegistry.getInstance().unregister(backendConnection.getConnectionId());
+ public String getDatabaseType() {
+ return "PostgreSQL";
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
similarity index 95%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngine.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
index bb7f9bc..35a6718 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngine.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.postgresql.auth;
+package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
import com.google.common.base.Strings;
import io.netty.channel.ChannelHandlerContext;
@@ -34,9 +34,9 @@ import
org.apache.shardingsphere.db.protocol.postgresql.packet.handshake.Postgre
import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import
org.apache.shardingsphere.proxy.frontend.connection.ConnectionIdGenerator;
-import
org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResultBuilder;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationEngine;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResult;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResultBuilder;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -67,7 +67,7 @@ public final class PostgreSQLAuthenticationEngine implements
AuthenticationEngin
}
@Override
- public AuthenticationResult auth(final ChannelHandlerContext context,
final PacketPayload payload) {
+ public AuthenticationResult authenticate(final ChannelHandlerContext
context, final PacketPayload payload) {
if (SSL_REQUEST_PAYLOAD_LENGTH ==
payload.getByteBuf().markReaderIndex().readInt() && SSL_REQUEST_CODE ==
payload.getByteBuf().readInt()) {
context.writeAndFlush(new PostgreSQLSSLNegativePacket());
return AuthenticationResultBuilder.continued();
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandler.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
similarity index 99%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandler.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
index 1436663..f73d7e8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandler.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.postgresql.auth;
+package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLLoginResult.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
similarity index 99%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLLoginResult.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
index 0127ed6..ae60cb5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLLoginResult.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLLoginResult.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.postgresql.auth;
+package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
import lombok.Getter;
import
org.apache.shardingsphere.db.protocol.postgresql.constant.PostgreSQLErrorCode;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngineTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
similarity index 93%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngineTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
index 27fbca7..85db4a5 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationEngineTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationEngineTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.postgresql.auth;
+package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
@@ -29,7 +29,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
import
org.apache.shardingsphere.infra.context.metadata.impl.StandardMetaDataContexts;
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationResult;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationResult;
import org.apache.shardingsphere.transaction.context.TransactionContexts;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -65,7 +65,7 @@ public final class PostgreSQLAuthenticationEngineTest {
byteBuf.writeInt(8);
byteBuf.writeInt(80877103);
PacketPayload payload = new PostgreSQLPacketPayload(byteBuf);
- AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().auth(mock(ChannelHandlerContext.class),
payload);
+ AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().authenticate(mock(ChannelHandlerContext.class),
payload);
assertThat(actual.isFinished(), is(false));
}
@@ -78,7 +78,7 @@ public final class PostgreSQLAuthenticationEngineTest {
payload.writeStringNul(username);
payload.writeStringNul("database");
payload.writeStringNul("sharding_db");
- AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().auth(mock(ChannelHandlerContext.class),
payload);
+ AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().authenticate(mock(ChannelHandlerContext.class),
payload);
assertThat(actual.isFinished(), is(false));
}
@@ -87,7 +87,7 @@ public final class PostgreSQLAuthenticationEngineTest {
PostgreSQLPacketPayload payload = new
PostgreSQLPacketPayload(createByteBuf(8, 512));
payload.writeInt4(64);
payload.writeInt4(196608);
- AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().auth(mock(ChannelHandlerContext.class),
payload);
+ AuthenticationResult actual = new
PostgreSQLAuthenticationEngine().authenticate(mock(ChannelHandlerContext.class),
payload);
assertThat(actual.isFinished(), is(false));
}
@@ -109,7 +109,7 @@ public final class PostgreSQLAuthenticationEngineTest {
payload.writeStringNul(username);
ChannelHandlerContext channelHandlerContext =
mock(ChannelHandlerContext.class);
PostgreSQLAuthenticationEngine engine = new
PostgreSQLAuthenticationEngine();
- AuthenticationResult actual = engine.auth(channelHandlerContext,
payload);
+ AuthenticationResult actual =
engine.authenticate(channelHandlerContext, payload);
assertThat(actual.isFinished(), is(false));
assertThat(actual.getUsername(), is(username));
ArgumentCaptor<PostgreSQLAuthenticationMD5PasswordPacket>
argumentCaptor =
ArgumentCaptor.forClass(PostgreSQLAuthenticationMD5PasswordPacket.class);
@@ -124,7 +124,7 @@ public final class PostgreSQLAuthenticationEngineTest {
StandardMetaDataContexts standardMetaDataContexts = new
StandardMetaDataContexts();
standardMetaDataContexts.getUsers().getUsers().add(new
ShardingSphereUser(username, password, ""));
ProxyContext.getInstance().init(standardMetaDataContexts,
mock(TransactionContexts.class));
- actual = engine.auth(channelHandlerContext, payload);
+ actual = engine.authenticate(channelHandlerContext, payload);
assertThat(actual.isFinished(), is(password.equals(inputPassword)));
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandlerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
similarity index 99%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandlerTest.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
index 68c6e5e..6ac3bb6 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/auth/PostgreSQLAuthenticationHandlerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/authentication/PostgreSQLAuthenticationHandlerTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.postgresql.auth;
+package org.apache.shardingsphere.proxy.frontend.postgresql.authentication;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
similarity index 88%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationEngine.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
index e921e49..7b3c291 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationEngine.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.auth;
+package org.apache.shardingsphere.proxy.frontend.authentication;
import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.db.protocol.payload.PacketPayload;
@@ -34,11 +34,11 @@ public interface AuthenticationEngine {
int handshake(ChannelHandlerContext context);
/**
- * Authentication.
+ * Authenticate.
*
* @param context channel handler context
* @param payload packet payload
* @return authentication result
*/
- AuthenticationResult auth(ChannelHandlerContext context, PacketPayload
payload);
+ AuthenticationResult authenticate(ChannelHandlerContext context,
PacketPayload payload);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResult.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
similarity index 94%
rename from
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResult.java
rename to
shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
index 3aa6f26..db4edc3 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/auth/AuthenticationResult.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/authentication/AuthenticationResult.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.auth;
+package org.apache.shardingsphere.proxy.frontend.authentication;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
index 443a1ef..2831961 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-spi/src/main/java/org/apache/shardingsphere/proxy/frontend/spi/DatabaseProtocolFrontendEngine.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.frontend.spi;
import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
import
org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.BackendConnection;
import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
-import org.apache.shardingsphere.proxy.frontend.auth.AuthenticationEngine;
+import
org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeAwareSPI;
@@ -48,7 +48,7 @@ public interface DatabaseProtocolFrontendEngine extends
DatabaseTypeAwareSPI {
*
* @return authentication engine
*/
- AuthenticationEngine getAuthEngine();
+ AuthenticationEngine getAuthenticationEngine();
/**
* Get command execute engine.
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoder.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoder.java
index dcd9e0d..5070a39 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoder.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoder.java
@@ -42,16 +42,16 @@ public final class MySQLCommandPacketDecoder extends
ByteToMessageDecoder {
private States currentState = States.ResponsePacket;
- private boolean auth;
+ private boolean authenticated;
private InternalResultSet internalResultSet;
@Override
protected void decode(final ChannelHandlerContext ctx, final ByteBuf in,
final List<Object> out) {
MySQLPacketPayload payload = new MySQLPacketPayload(in);
- if (!auth) {
+ if (!authenticated) {
out.add(decodeHandshakePacket(payload));
- auth = true;
+ authenticated = true;
} else {
decodeCommandPacket(payload, out);
}
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandler.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandler.java
index 641c1ef..787ca7b 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandler.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandler.java
@@ -57,7 +57,7 @@ public final class MySQLNegotiateHandler extends
ChannelInboundHandlerAdapter {
if (msg instanceof MySQLHandshakePacket) {
MySQLHandshakePacket handshake = (MySQLHandshakePacket) msg;
MySQLHandshakeResponse41Packet handshakeResponsePacket = new
MySQLHandshakeResponse41Packet(1, MAX_PACKET_SIZE, CHARACTER_SET, username);
-
handshakeResponsePacket.setAuthResponse(generateAuthResponse(handshake.getAuthPluginData().getAuthPluginData()));
+
handshakeResponsePacket.setAuthResponse(generateAuthResponse(handshake.getAuthPluginData().getAuthenticationPluginData()));
handshakeResponsePacket.setCapabilityFlags(generateClientCapability());
handshakeResponsePacket.setDatabase("mysql");
handshakeResponsePacket.setAuthPluginName(MySQLAuthenticationMethod.SECURE_PASSWORD_AUTHENTICATION);
diff --git
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoderTest.java
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoderTest.java
index 2a60827..eb5a28b 100644
---
a/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoderTest.java
+++
b/shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLCommandPacketDecoderTest.java
@@ -17,6 +17,9 @@
package org.apache.shardingsphere.scaling.mysql.client.netty;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerInfo;
import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLStatusFlag;
import
org.apache.shardingsphere.db.protocol.mysql.packet.generic.MySQLEofPacket;
@@ -30,11 +33,7 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufUtil;
-import io.netty.buffer.Unpooled;
-
-import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -65,7 +64,7 @@ public final class MySQLCommandPacketDecoderTest {
@Test
public void assertDecodeHandshakePacket() {
MySQLCommandPacketDecoder commandPacketDecoder = new
MySQLCommandPacketDecoder();
- List<Object> actual = new ArrayList<>();
+ List<Object> actual = new LinkedList<>();
commandPacketDecoder.decode(null, mockHandshakePacket(), actual);
assertHandshakePacket(actual);
}
@@ -96,8 +95,8 @@ public final class MySQLCommandPacketDecoderTest {
@Test
public void assertDecodeOkPacket() throws NoSuchFieldException,
IllegalAccessException {
MySQLCommandPacketDecoder commandPacketDecoder = new
MySQLCommandPacketDecoder();
- List<Object> actual = new ArrayList<>();
- ReflectionUtil.setFieldValue(commandPacketDecoder, "auth", true);
+ List<Object> actual = new LinkedList<>();
+ ReflectionUtil.setFieldValue(commandPacketDecoder, "authenticated",
true);
commandPacketDecoder.decode(null, mockOkPacket(), actual);
assertPacketByType(actual, MySQLOKPacket.class);
}
@@ -111,8 +110,8 @@ public final class MySQLCommandPacketDecoderTest {
@Test
public void assertDecodeErrPacket() throws NoSuchFieldException,
IllegalAccessException {
MySQLCommandPacketDecoder commandPacketDecoder = new
MySQLCommandPacketDecoder();
- List<Object> actual = new ArrayList<>();
- ReflectionUtil.setFieldValue(commandPacketDecoder, "auth", true);
+ List<Object> actual = new LinkedList<>();
+ ReflectionUtil.setFieldValue(commandPacketDecoder, "authenticated",
true);
commandPacketDecoder.decode(null, mockErrPacket(), actual);
assertPacketByType(actual, MySQLErrPacket.class);
}
@@ -126,8 +125,8 @@ public final class MySQLCommandPacketDecoderTest {
@Test
public void assertDecodeQueryCommPacket() throws NoSuchFieldException,
IllegalAccessException {
MySQLCommandPacketDecoder commandPacketDecoder = new
MySQLCommandPacketDecoder();
- List<Object> actual = new ArrayList<>();
- ReflectionUtil.setFieldValue(commandPacketDecoder, "auth", true);
+ List<Object> actual = new LinkedList<>();
+ ReflectionUtil.setFieldValue(commandPacketDecoder, "authenticated",
true);
commandPacketDecoder.decode(null, mockEmptyResultSetPacket(), actual);
commandPacketDecoder.decode(null, mockFieldDefinition41Packet(),
actual);
commandPacketDecoder.decode(null, mockEofPacket(), actual);