From fe68e341fb6d18ddcd35a61a95ba05b2600faf37 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Thu, 16 Nov 2023 20:12:17 +0100 Subject: [PATCH] Rename user name -> username --- .../client2/internal/mqtt/message/MqttReasonCodes.java | 2 +- .../mqtt/message/auth/MqttSimpleAuthBuilder.java | 2 +- .../mqtt/message/connect/mqtt3/Mqtt3ConnAckView.java | 8 ++++---- .../mqtt3/message/connect/Mqtt3ConnAckReturnCode.java | 4 ++-- .../mqtt5/message/connect/Mqtt5ConnAckReasonCode.java | 4 ++-- .../codec/decoder/mqtt3/Mqtt3ConnAckDecoderTest.java | 4 ++-- .../internal/mqtt/message/MqttReasonCodesTest.java | 2 +- .../message/connect/Mqtt3ConnAckReturnCodeTest.java | 4 ++-- .../message/connect/Mqtt5ConnAckReasonCodeTest.java | 10 +++++----- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodes.java b/src/main/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodes.java index 97c7b4c80..84ccbdfeb 100644 --- a/src/main/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodes.java +++ b/src/main/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodes.java @@ -41,7 +41,7 @@ public class MqttReasonCodes { public static final int IMPLEMENTATION_SPECIFIC_ERROR = 0x83; public static final int UNSUPPORTED_PROTOCOL_VERSION = 0x84; public static final int CLIENT_IDENTIFIER_NOT_VALID = 0x85; - public static final int BAD_USER_NAME_OR_PASSWORD = 0x86; + public static final int BAD_USERNAME_OR_PASSWORD = 0x86; public static final int NOT_AUTHORIZED = 0x87; public static final int SERVER_UNAVAILABLE = 0x88; public static final int SERVER_BUSY = 0x89; diff --git a/src/main/java/com/hivemq/client2/internal/mqtt/message/auth/MqttSimpleAuthBuilder.java b/src/main/java/com/hivemq/client2/internal/mqtt/message/auth/MqttSimpleAuthBuilder.java index aa2e8346d..5316f56f6 100644 --- a/src/main/java/com/hivemq/client2/internal/mqtt/message/auth/MqttSimpleAuthBuilder.java +++ b/src/main/java/com/hivemq/client2/internal/mqtt/message/auth/MqttSimpleAuthBuilder.java @@ -58,7 +58,7 @@ public abstract class MqttSimpleAuthBuilder> } public @NotNull MqttSimpleAuth build() { - Checks.state((username != null) || (password != null), "Either user name or password must be given."); + Checks.state((username != null) || (password != null), "Either username or password must be given."); return new MqttSimpleAuth(username, password); } diff --git a/src/main/java/com/hivemq/client2/internal/mqtt/message/connect/mqtt3/Mqtt3ConnAckView.java b/src/main/java/com/hivemq/client2/internal/mqtt/message/connect/mqtt3/Mqtt3ConnAckView.java index 123bb7df0..d3fca2d6a 100644 --- a/src/main/java/com/hivemq/client2/internal/mqtt/message/connect/mqtt3/Mqtt3ConnAckView.java +++ b/src/main/java/com/hivemq/client2/internal/mqtt/message/connect/mqtt3/Mqtt3ConnAckView.java @@ -58,8 +58,8 @@ public class Mqtt3ConnAckView implements Mqtt3ConnAck { return Mqtt5ConnAckReasonCode.CLIENT_IDENTIFIER_NOT_VALID; case SERVER_UNAVAILABLE: return Mqtt5ConnAckReasonCode.SERVER_UNAVAILABLE; - case BAD_USER_NAME_OR_PASSWORD: - return Mqtt5ConnAckReasonCode.BAD_USER_NAME_OR_PASSWORD; + case BAD_USERNAME_OR_PASSWORD: + return Mqtt5ConnAckReasonCode.BAD_USERNAME_OR_PASSWORD; case NOT_AUTHORIZED: return Mqtt5ConnAckReasonCode.NOT_AUTHORIZED; default: @@ -77,8 +77,8 @@ public class Mqtt3ConnAckView implements Mqtt3ConnAck { return IDENTIFIER_REJECTED; case SERVER_UNAVAILABLE: return SERVER_UNAVAILABLE; - case BAD_USER_NAME_OR_PASSWORD: - return BAD_USER_NAME_OR_PASSWORD; + case BAD_USERNAME_OR_PASSWORD: + return BAD_USERNAME_OR_PASSWORD; case NOT_AUTHORIZED: return NOT_AUTHORIZED; default: diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCode.java b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCode.java index 687edf20c..f2dbd6004 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCode.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCode.java @@ -46,9 +46,9 @@ public enum Mqtt3ConnAckReturnCode implements Mqtt3ReturnCode { */ SERVER_UNAVAILABLE, /** - * The server does not accept the user name or password specified by the client. + * The server does not accept the username or password specified by the client. */ - BAD_USER_NAME_OR_PASSWORD, + BAD_USERNAME_OR_PASSWORD, /** * The client is not authorized to connect. */ diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCode.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCode.java index 5153e16a9..1e6b0fde1 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCode.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCode.java @@ -58,9 +58,9 @@ public enum Mqtt5ConnAckReasonCode implements Mqtt5ReasonCode { */ CLIENT_IDENTIFIER_NOT_VALID(MqttReasonCodes.CLIENT_IDENTIFIER_NOT_VALID), /** - * The server does not accept the user name or password specified by the client. + * The server does not accept the username or password specified by the client. */ - BAD_USER_NAME_OR_PASSWORD(MqttReasonCodes.BAD_USER_NAME_OR_PASSWORD), + BAD_USERNAME_OR_PASSWORD(MqttReasonCodes.BAD_USERNAME_OR_PASSWORD), /** * The client is not authorized to connect. */ diff --git a/src/test/java/com/hivemq/client2/internal/mqtt/codec/decoder/mqtt3/Mqtt3ConnAckDecoderTest.java b/src/test/java/com/hivemq/client2/internal/mqtt/codec/decoder/mqtt3/Mqtt3ConnAckDecoderTest.java index 5581bc149..93830ef4f 100644 --- a/src/test/java/com/hivemq/client2/internal/mqtt/codec/decoder/mqtt3/Mqtt3ConnAckDecoderTest.java +++ b/src/test/java/com/hivemq/client2/internal/mqtt/codec/decoder/mqtt3/Mqtt3ConnAckDecoderTest.java @@ -157,8 +157,8 @@ void decode_SERVER_BAD_USERNAME_OR_PASSWORD(final boolean sessionPresent) { assertNull(connAck); } else { assertNotNull(connAck); - assertEquals(Mqtt5ConnAckReasonCode.BAD_USER_NAME_OR_PASSWORD, connAck.getReasonCode()); - // Mqtt3ConnAckReturnCode.BAD_USER_NAME_OR_PASSWORD + assertEquals(Mqtt5ConnAckReasonCode.BAD_USERNAME_OR_PASSWORD, connAck.getReasonCode()); + // Mqtt3ConnAckReturnCode.BAD_USERNAME_OR_PASSWORD assertFalse(connAck.isSessionPresent()); } } diff --git a/src/test/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodesTest.java b/src/test/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodesTest.java index b30ae9a5c..ef07b2794 100644 --- a/src/test/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodesTest.java +++ b/src/test/java/com/hivemq/client2/internal/mqtt/message/MqttReasonCodesTest.java @@ -97,7 +97,7 @@ void test_getCode_clientIdentifierNotValid() { @Test void test_getCode_badUsernameOrPassword() { - assertEquals(0x86, MqttReasonCodes.BAD_USER_NAME_OR_PASSWORD); + assertEquals(0x86, MqttReasonCodes.BAD_USERNAME_OR_PASSWORD); } @Test diff --git a/src/test/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCodeTest.java b/src/test/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCodeTest.java index b38f685b5..be6496635 100644 --- a/src/test/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCodeTest.java +++ b/src/test/java/com/hivemq/client2/mqtt/mqtt3/message/connect/Mqtt3ConnAckReturnCodeTest.java @@ -50,7 +50,7 @@ void getCode_serverUnavailable() { @Test void getCode_badUserNameOrPassword() { - assertEquals(0x04, Mqtt3ConnAckReturnCode.BAD_USER_NAME_OR_PASSWORD.getCode()); + assertEquals(0x04, Mqtt3ConnAckReturnCode.BAD_USERNAME_OR_PASSWORD.getCode()); } @Test @@ -79,7 +79,7 @@ void isError_false(final @NotNull Mqtt3ConnAckReturnCode returnCode) { @ParameterizedTest @EnumSource(value = Mqtt3ConnAckReturnCode.class, names = { - "UNSUPPORTED_PROTOCOL_VERSION", "IDENTIFIER_REJECTED", "SERVER_UNAVAILABLE", "BAD_USER_NAME_OR_PASSWORD", + "UNSUPPORTED_PROTOCOL_VERSION", "IDENTIFIER_REJECTED", "SERVER_UNAVAILABLE", "BAD_USERNAME_OR_PASSWORD", "NOT_AUTHORIZED" }) void isError_true(final @NotNull Mqtt3ConnAckReturnCode returnCode) { diff --git a/src/test/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCodeTest.java b/src/test/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCodeTest.java index fedf7c2ab..62871dfc1 100644 --- a/src/test/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCodeTest.java +++ b/src/test/java/com/hivemq/client2/mqtt/mqtt5/message/connect/Mqtt5ConnAckReasonCodeTest.java @@ -59,7 +59,7 @@ void fromCode_invalidCodes() { Arguments.of(Mqtt5ConnAckReasonCode.IMPLEMENTATION_SPECIFIC_ERROR, 0x83), Arguments.of(Mqtt5ConnAckReasonCode.UNSUPPORTED_PROTOCOL_VERSION, 0x84), Arguments.of(Mqtt5ConnAckReasonCode.CLIENT_IDENTIFIER_NOT_VALID, 0x85), - Arguments.of(Mqtt5ConnAckReasonCode.BAD_USER_NAME_OR_PASSWORD, 0x86), + Arguments.of(Mqtt5ConnAckReasonCode.BAD_USERNAME_OR_PASSWORD, 0x86), Arguments.of(Mqtt5ConnAckReasonCode.NOT_AUTHORIZED, 0x87), Arguments.of(Mqtt5ConnAckReasonCode.SERVER_UNAVAILABLE, 0x88), Arguments.of(Mqtt5ConnAckReasonCode.SERVER_BUSY, 0x89), @@ -85,7 +85,7 @@ void isError_false(final @NotNull Mqtt5ConnAckReasonCode reasonCode) { @ParameterizedTest @EnumSource(value = Mqtt5ConnAckReasonCode.class, names = { "UNSPECIFIED_ERROR", "MALFORMED_PACKET", "PROTOCOL_ERROR", "IMPLEMENTATION_SPECIFIC_ERROR", - "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USER_NAME_OR_PASSWORD", + "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USERNAME_OR_PASSWORD", "NOT_AUTHORIZED", "SERVER_UNAVAILABLE", "SERVER_BUSY", "BANNED", "BAD_AUTHENTICATION_METHOD", "TOPIC_NAME_INVALID", "PACKET_TOO_LARGE", "QUOTA_EXCEEDED", "PAYLOAD_FORMAT_INVALID", "RETAIN_NOT_SUPPORTED", "QOS_NOT_SUPPORTED", "USE_ANOTHER_SERVER", "SERVER_MOVED", @@ -98,7 +98,7 @@ void isError_true(final @NotNull Mqtt5ConnAckReasonCode reasonCode) { @ParameterizedTest @EnumSource(value = Mqtt5ConnAckReasonCode.class, names = { "SUCCESS", "UNSPECIFIED_ERROR", "MALFORMED_PACKET", "PROTOCOL_ERROR", "IMPLEMENTATION_SPECIFIC_ERROR", - "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USER_NAME_OR_PASSWORD", + "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USERNAME_OR_PASSWORD", "NOT_AUTHORIZED", "SERVER_UNAVAILABLE", "SERVER_BUSY", "BANNED", "BAD_AUTHENTICATION_METHOD", "TOPIC_NAME_INVALID", "PACKET_TOO_LARGE", "QUOTA_EXCEEDED", "PAYLOAD_FORMAT_INVALID", "RETAIN_NOT_SUPPORTED", "QOS_NOT_SUPPORTED", "USE_ANOTHER_SERVER", "SERVER_MOVED", @@ -111,7 +111,7 @@ void canBeSentByServer_true(final @NotNull Mqtt5ConnAckReasonCode reasonCode) { @ParameterizedTest @EnumSource(value = Mqtt5ConnAckReasonCode.class, names = { "SUCCESS", "UNSPECIFIED_ERROR", "MALFORMED_PACKET", "PROTOCOL_ERROR", "IMPLEMENTATION_SPECIFIC_ERROR", - "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USER_NAME_OR_PASSWORD", + "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USERNAME_OR_PASSWORD", "NOT_AUTHORIZED", "SERVER_UNAVAILABLE", "SERVER_BUSY", "BANNED", "BAD_AUTHENTICATION_METHOD", "TOPIC_NAME_INVALID", "PACKET_TOO_LARGE", "QUOTA_EXCEEDED", "PAYLOAD_FORMAT_INVALID", "RETAIN_NOT_SUPPORTED", "QOS_NOT_SUPPORTED", "USE_ANOTHER_SERVER", "SERVER_MOVED", @@ -124,7 +124,7 @@ void canBeSentByClient_false(final @NotNull Mqtt5ConnAckReasonCode reasonCode) { @ParameterizedTest @EnumSource(value = Mqtt5ConnAckReasonCode.class, names = { "SUCCESS", "UNSPECIFIED_ERROR", "MALFORMED_PACKET", "PROTOCOL_ERROR", "IMPLEMENTATION_SPECIFIC_ERROR", - "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USER_NAME_OR_PASSWORD", + "UNSUPPORTED_PROTOCOL_VERSION", "CLIENT_IDENTIFIER_NOT_VALID", "BAD_USERNAME_OR_PASSWORD", "NOT_AUTHORIZED", "SERVER_UNAVAILABLE", "SERVER_BUSY", "BANNED", "BAD_AUTHENTICATION_METHOD", "TOPIC_NAME_INVALID", "PACKET_TOO_LARGE", "QUOTA_EXCEEDED", "PAYLOAD_FORMAT_INVALID", "RETAIN_NOT_SUPPORTED", "QOS_NOT_SUPPORTED", "USE_ANOTHER_SERVER", "SERVER_MOVED",