Skip to content

Commit

Permalink
Rename user name -> username
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Nov 16, 2023
1 parent 966ba4a commit fe68e34
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public abstract class MqttSimpleAuthBuilder<B extends MqttSimpleAuthBuilder<B>>
}

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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit fe68e34

Please sign in to comment.