test_class.declarator: USER_NAME = "username"
test_class.modifier: private static final
test_class.original_string: private static final String USER_NAME = "username";
test_class.type: String
test_class.var_name: USER_NAME
test_class.declarator: PASSWORD = "password"
test_class.modifier: private static final
test_class.original_string: private static final String PASSWORD = "password";
test_class.type: String
test_class.var_name: PASSWORD
test_class.declarator: authResultCallback
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Promise<Object> authResultCallback;
test_class.type: Promise<Object>
test_class.var_name: authResultCallback
test_class.declarator: channelHandlerContext
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ChannelHandlerContext channelHandlerContext;
test_class.type: ChannelHandlerContext
test_class.var_name: channelHandlerContext
test_class.declarator: channel
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Channel channel;
test_class.type: Channel
test_class.var_name: channel
test_class.declarator: pipeline
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ChannelPipeline pipeline;
test_class.type: ChannelPipeline
test_class.var_name: pipeline
test_class.declarator: mysqlNegotiateHandler
test_class.modifier: private
test_class.original_string: private MySQLNegotiateHandler mysqlNegotiateHandler;
test_class.type: MySQLNegotiateHandler
test_class.var_name: mysqlNegotiateHandler
test_class.file: shardingsphere-scaling/shardingsphere-scaling-mysql/src/test/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandlerTest.java
test_class.identifier: MySQLNegotiateHandlerTest
test_case.body: @Test
      public void assertChannelReadHandshakeInitPacket() throws NoSuchFieldException, IllegalAccessException {
          MySQLHandshakePacket handshakePacket = new MySQLHandshakePacket(0, new MySQLAuthPluginData(new byte[8], new byte[12]));
          handshakePacket.setAuthPluginName(MySQLAuthenticationMethod.SECURE_PASSWORD_AUTHENTICATION);
          mysqlNegotiateHandler.channelRead(channelHandlerContext, handshakePacket);
          verify(channel).writeAndFlush(ArgumentMatchers.any(MySQLHandshakeResponse41Packet.class));
          ServerInfo serverInfo = ReflectionUtil.getFieldValueFromClass(mysqlNegotiateHandler, "serverInfo", ServerInfo.class);
          assertThat(serverInfo.getServerVersion().getMajor(), is(8));
          assertThat(serverInfo.getServerVersion().getMinor(), is(0));
          assertThat(serverInfo.getServerVersion().getSeries(), is(20));
      }
test_case.class_method_signature: MySQLNegotiateHandlerTest.assertChannelReadHandshakeInitPacket()
test_case.full_signature: @Test public void assertChannelReadHandshakeInitPacket()
test_case.identifier: assertChannelReadHandshakeInitPacket
test_case.invocations: setAuthPluginName channelRead writeAndFlush verify any getFieldValueFromClass assertThat getMajor getServerVersion is assertThat getMinor getServerVersion is assertThat getSeries getServerVersion is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertChannelReadHandshakeInitPacket()
focal_class.declarator: MAX_PACKET_SIZE = 1 << 24
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_PACKET_SIZE = 1 << 24;
focal_class.type: int
focal_class.var_name: MAX_PACKET_SIZE
focal_class.declarator: CHARACTER_SET = 33
focal_class.modifier: private static final
focal_class.original_string: private static final int CHARACTER_SET = 33;
focal_class.type: int
focal_class.var_name: CHARACTER_SET
focal_class.declarator: username
focal_class.modifier: private final
focal_class.original_string: private final String username;
focal_class.type: String
focal_class.var_name: username
focal_class.declarator: password
focal_class.modifier: private final
focal_class.original_string: private final String password;
focal_class.type: String
focal_class.var_name: password
focal_class.declarator: authResultCallback
focal_class.modifier: private final
focal_class.original_string: private final Promise<Object> authResultCallback;
focal_class.type: Promise<Object>
focal_class.var_name: authResultCallback
focal_class.declarator: serverInfo
focal_class.modifier: private
focal_class.original_string: private ServerInfo serverInfo;
focal_class.type: ServerInfo
focal_class.var_name: serverInfo
focal_class.file: shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/client/netty/MySQLNegotiateHandler.java
focal_class.identifier: MySQLNegotiateHandler
focal_class.class_method_signature: MySQLNegotiateHandler.channelRead(final ChannelHandlerContext ctx, final Object msg)
focal_class.full_signature: @Override public void channelRead(final ChannelHandlerContext ctx, final Object msg)
focal_class.identifier: channelRead
focal_class.modifiers: @Override public
focal_class.parameters: (final ChannelHandlerContext ctx, final Object msg)
focal_class.return: void
focal_class.signature: void channelRead(final ChannelHandlerContext ctx, final Object msg)
focal_class.class_method_signature: MySQLNegotiateHandler.generateClientCapability()
focal_class.full_signature: private int generateClientCapability()
focal_class.identifier: generateClientCapability
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int generateClientCapability()
focal_class.class_method_signature: MySQLNegotiateHandler.generateAuthResponse(final byte[] authPluginData)
focal_class.full_signature: @SneakyThrows(NoSuchAlgorithmException.class) private byte[] generateAuthResponse(final byte[] authPluginData)
focal_class.identifier: generateAuthResponse
focal_class.modifiers: @SneakyThrows(NoSuchAlgorithmException.class) private
focal_class.parameters: (final byte[] authPluginData)
focal_class.return: byte[]
focal_class.signature: byte[] generateAuthResponse(final byte[] authPluginData)
focal_class.superclass: extends ChannelInboundHandlerAdapter
focal_method.body: @Override
      public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
          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.setCapabilityFlags(generateClientCapability());
              handshakeResponsePacket.setDatabase("mysql");
              handshakeResponsePacket.setAuthPluginName(MySQLAuthenticationMethod.SECURE_PASSWORD_AUTHENTICATION);
              ctx.channel().writeAndFlush(handshakeResponsePacket);
              serverInfo = new ServerInfo();
              serverInfo.setServerVersion(new ServerVersion(handshake.getServerVersion()));
              return;
          }
          if (msg instanceof MySQLOKPacket) {
              ctx.channel().pipeline().remove(this);
              authResultCallback.setSuccess(serverInfo);
              return;
          }
          MySQLErrPacket error = (MySQLErrPacket) msg;
          ctx.channel().close();
          throw new RuntimeException(error.getErrorMessage());
      }
focal_method.class_method_signature: MySQLNegotiateHandler.channelRead(final ChannelHandlerContext ctx, final Object msg)
focal_method.full_signature: @Override public void channelRead(final ChannelHandlerContext ctx, final Object msg)
focal_method.identifier: channelRead
focal_method.invocations: setAuthResponse generateAuthResponse getAuthPluginData getAuthPluginData setCapabilityFlags generateClientCapability setDatabase setAuthPluginName writeAndFlush channel setServerVersion getServerVersion remove pipeline channel setSuccess close channel getErrorMessage
focal_method.modifiers: @Override public
focal_method.parameters: (final ChannelHandlerContext ctx, final Object msg)
focal_method.return: void
focal_method.signature: void channelRead(final ChannelHandlerContext ctx, final Object msg)