test_class.declarator: context
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ChannelHandlerContext context;
test_class.type: ChannelHandlerContext
test_class.var_name: context
test_class.declarator: byteBuf
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ByteBuf byteBuf;
test_class.type: ByteBuf
test_class.var_name: byteBuf
test_class.file: shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngineTest.java
test_class.identifier: PostgreSQLPacketCodecEngineTest
test_case.body: @Test
      public void assertDecodeWithStickyPacket() {
          when(byteBuf.markReaderIndex()).thenReturn(byteBuf);
          when(byteBuf.readInt()).thenReturn(50);
          List<Object> out = new LinkedList<>();
          new PostgreSQLPacketCodecEngine().decode(context, byteBuf, out, 40);
          assertTrue(out.isEmpty());
      }
test_case.class_method_signature: PostgreSQLPacketCodecEngineTest.assertDecodeWithStickyPacket()
test_case.full_signature: @Test public void assertDecodeWithStickyPacket()
test_case.identifier: assertDecodeWithStickyPacket
test_case.invocations: thenReturn when markReaderIndex thenReturn when readInt decode assertTrue isEmpty
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertDecodeWithStickyPacket()
focal_class.file: shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/codec/PostgreSQLPacketCodecEngine.java
focal_class.identifier: PostgreSQLPacketCodecEngine
focal_class.interfaces: implements DatabasePacketCodecEngine<PostgreSQLPacket>
focal_class.class_method_signature: PostgreSQLPacketCodecEngine.isValidHeader(final int readableBytes)
focal_class.full_signature: @Override public boolean isValidHeader(final int readableBytes)
focal_class.identifier: isValidHeader
focal_class.modifiers: @Override public
focal_class.parameters: (final int readableBytes)
focal_class.return: boolean
focal_class.signature: boolean isValidHeader(final int readableBytes)
focal_class.class_method_signature: PostgreSQLPacketCodecEngine.decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_class.full_signature: @Override public void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_class.identifier: decode
focal_class.modifiers: @Override public
focal_class.parameters: (final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_class.return: void
focal_class.signature: void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_class.class_method_signature: PostgreSQLPacketCodecEngine.encode(final ChannelHandlerContext context, final PostgreSQLPacket message, final ByteBuf out)
focal_class.full_signature: @Override public void encode(final ChannelHandlerContext context, final PostgreSQLPacket message, final ByteBuf out)
focal_class.identifier: encode
focal_class.modifiers: @Override public
focal_class.parameters: (final ChannelHandlerContext context, final PostgreSQLPacket message, final ByteBuf out)
focal_class.return: void
focal_class.signature: void encode(final ChannelHandlerContext context, final PostgreSQLPacket message, final ByteBuf out)
focal_class.class_method_signature: PostgreSQLPacketCodecEngine.createPacketPayload(final ByteBuf message)
focal_class.full_signature: @Override public PostgreSQLPacketPayload createPacketPayload(final ByteBuf message)
focal_class.identifier: createPacketPayload
focal_class.modifiers: @Override public
focal_class.parameters: (final ByteBuf message)
focal_class.return: PostgreSQLPacketPayload
focal_class.signature: PostgreSQLPacketPayload createPacketPayload(final ByteBuf message)
focal_method.body: @Override
      public void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes) {
          int messageTypeLength = 0;
          if ('\0' == in.markReaderIndex().readByte()) {
              in.resetReaderIndex();
          } else {
              messageTypeLength = PostgreSQLPacket.MESSAGE_TYPE_LENGTH;
          }
          int payloadLength = in.readInt();
          int realPacketLength = payloadLength + messageTypeLength;
          if (readableBytes < realPacketLength) {
              in.resetReaderIndex();
              return;
          }
          in.resetReaderIndex();
          out.add(in.readRetainedSlice(payloadLength + messageTypeLength));
      }
focal_method.class_method_signature: PostgreSQLPacketCodecEngine.decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_method.full_signature: @Override public void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_method.identifier: decode
focal_method.invocations: readByte markReaderIndex resetReaderIndex readInt resetReaderIndex resetReaderIndex add readRetainedSlice
focal_method.modifiers: @Override public
focal_method.parameters: (final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)
focal_method.return: void
focal_method.signature: void decode(final ChannelHandlerContext context, final ByteBuf in, final List<Object> out, final int readableBytes)