You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/03/14 03:51:56 UTC
(shardingsphere) branch master updated: Add more test cases on OpenGaussCommandPacketTypeTest (#38422)
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 63dfa4fae03 Add more test cases on OpenGaussCommandPacketTypeTest (#38422)
63dfa4fae03 is described below
commit 63dfa4fae0399ad4331a4c0f8cac56896c0111b6
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Mar 14 11:51:49 2026 +0800
Add more test cases on OpenGaussCommandPacketTypeTest (#38422)
---
.../command/OpenGaussCommandPacketTypeTest.java | 24 +++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/database/protocol/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java b/database/protocol/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
index e9326f2fded..4ef2068c818 100644
--- a/database/protocol/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
+++ b/database/protocol/dialect/opengauss/src/test/java/org/apache/shardingsphere/database/protocol/opengauss/packet/command/OpenGaussCommandPacketTypeTest.java
@@ -20,22 +20,40 @@ package org.apache.shardingsphere.database.protocol.opengauss.packet.command;
import org.apache.shardingsphere.database.protocol.packet.command.CommandPacketType;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import java.util.stream.Stream;
import static org.hamcrest.Matchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.isA;
+import static org.hamcrest.MatcherAssert.assertThat;
class OpenGaussCommandPacketTypeTest {
@Test
void assertValueOfBatchBindCommand() {
- CommandPacketType actual = OpenGaussCommandPacketType.valueOf('U');
- assertThat(actual, is(OpenGaussCommandPacketType.BATCH_BIND_COMMAND));
+ assertThat(OpenGaussCommandPacketType.valueOf('U'), is(OpenGaussCommandPacketType.BATCH_BIND_COMMAND));
}
@Test
void assertValueOfPostgreSQLCommand() {
CommandPacketType actual = OpenGaussCommandPacketType.valueOf('Q');
+ assertThat(actual, is(PostgreSQLCommandPacketType.SIMPLE_QUERY));
assertThat(actual, isA(PostgreSQLCommandPacketType.class));
}
+
+ @ParameterizedTest(name = "{0}")
+ @MethodSource("isExtendedProtocolPacketTypeArguments")
+ void assertIsExtendedProtocolPacketType(final String name, final CommandPacketType commandPacketType, final boolean expectedIsExtendedProtocolPacketType) {
+ assertThat(OpenGaussCommandPacketType.isExtendedProtocolPacketType(commandPacketType), is(expectedIsExtendedProtocolPacketType));
+ }
+
+ private static Stream<Arguments> isExtendedProtocolPacketTypeArguments() {
+ return Stream.of(
+ Arguments.of("batch_bind_command", OpenGaussCommandPacketType.BATCH_BIND_COMMAND, true),
+ Arguments.of("postgresql_extended_command", PostgreSQLCommandPacketType.PARSE_COMMAND, true),
+ Arguments.of("postgresql_non_extended_command", PostgreSQLCommandPacketType.SIMPLE_QUERY, false));
+ }
}