Skip to content

Commit 5a6719b

Browse files
author
yannick
committed
addressed PR change requests
1 parent d099c25 commit 5a6719b

File tree

5 files changed

+22
-28
lines changed

5 files changed

+22
-28
lines changed

build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ dependencies {
148148
integrationTestImplementation("org.awaitility:awaitility:${property("awaitility.version")}")
149149
}
150150

151+
tasks.named<JavaCompile>("compileIntegrationTestJava") {
152+
javaCompiler.set(javaToolchains.compilerFor {
153+
languageVersion.set(JavaLanguageVersion.of(11))
154+
})
155+
}
156+
151157
val integrationTest by tasks.registering(Test::class) {
152158
group = "verification"
153159
description = "Runs integration tests."
@@ -162,11 +168,6 @@ val integrationTest by tasks.registering(Test::class) {
162168

163169
tasks.check { dependsOn(integrationTest) }
164170

165-
tasks.named<JavaCompile>("compileIntegrationTestJava").configure {
166-
javaCompiler.set(javaToolchains.compilerFor {
167-
languageVersion.set(JavaLanguageVersion.of(11))
168-
})
169-
}
170171
/* ******************** jars ******************** */
171172

172173
allprojects {

src/main/java/com/hivemq/client/internal/mqtt/message/connect/mqtt3/Mqtt3ConnectView.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@
2222
import com.hivemq.client.internal.mqtt.message.auth.mqtt3.Mqtt3SimpleAuthView;
2323
import com.hivemq.client.internal.mqtt.message.connect.MqttConnect;
2424
import com.hivemq.client.internal.mqtt.message.connect.MqttConnectRestrictions;
25-
import com.hivemq.client.internal.mqtt.message.connect.MqttConnectRestrictionsBuilder;
2625
import com.hivemq.client.internal.mqtt.message.publish.MqttWillPublish;
2726
import com.hivemq.client.internal.mqtt.message.publish.mqtt3.Mqtt3PublishView;
28-
import com.hivemq.client.internal.util.Checks;
2927
import com.hivemq.client.mqtt.mqtt3.message.auth.Mqtt3SimpleAuth;
3028
import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3Connect;
3129
import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3ConnectRestrictions;
3230
import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish;
33-
import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5ConnectRestrictions;
3431
import org.jetbrains.annotations.NotNull;
3532
import org.jetbrains.annotations.Nullable;
3633

@@ -42,28 +39,28 @@
4239
@Immutable
4340
public class Mqtt3ConnectView implements Mqtt3Connect {
4441

45-
public static final @NotNull Mqtt3ConnectView DEFAULT = of(DEFAULT_KEEP_ALIVE, DEFAULT_CLEAN_SESSION, null, null, MqttConnectRestrictions.DEFAULT);
42+
public static final @NotNull Mqtt3ConnectView DEFAULT =
43+
of(DEFAULT_KEEP_ALIVE, DEFAULT_CLEAN_SESSION, MqttConnectRestrictions.DEFAULT, null, null);
4644

4745
private static @NotNull MqttConnect delegate(
4846
final int keepAlive,
4947
final boolean cleanSession,
48+
final @NotNull MqttConnectRestrictions restrictions,
5049
final @Nullable MqttSimpleAuth simpleAuth,
51-
final @Nullable MqttWillPublish willPublish,
52-
final @NotNull MqttConnectRestrictions restrictions) {
50+
final @Nullable MqttWillPublish willPublish) {
5351

54-
return new MqttConnect(keepAlive, cleanSession, cleanSession ? 0 : MqttConnect.NO_SESSION_EXPIRY,
55-
restrictions, simpleAuth, null, willPublish,
56-
MqttUserPropertiesImpl.NO_USER_PROPERTIES);
52+
return new MqttConnect(keepAlive, cleanSession, cleanSession ? 0 : MqttConnect.NO_SESSION_EXPIRY, restrictions,
53+
simpleAuth, null, willPublish, MqttUserPropertiesImpl.NO_USER_PROPERTIES);
5754
}
5855

5956
static @NotNull Mqtt3ConnectView of(
6057
final int keepAlive,
6158
final boolean cleanSession,
59+
final @NotNull MqttConnectRestrictions restrictions,
6260
final @Nullable MqttSimpleAuth simpleAuth,
63-
final @Nullable MqttWillPublish willPublish,
64-
final @NotNull MqttConnectRestrictions mqttConnectRestrictions) {
61+
final @Nullable MqttWillPublish willPublish) {
6562

66-
return new Mqtt3ConnectView(delegate(keepAlive, cleanSession, simpleAuth, willPublish, mqttConnectRestrictions));
63+
return new Mqtt3ConnectView(delegate(keepAlive, cleanSession, restrictions, simpleAuth, willPublish));
6764
}
6865

6966
public static @NotNull Mqtt3ConnectView of(final @NotNull MqttConnect delegate) {
@@ -123,7 +120,8 @@ public boolean isCleanSession() {
123120
private @NotNull String toAttributeString() {
124121
final Mqtt3SimpleAuth simpleAuth = getRawSimpleAuth();
125122
final Mqtt3Publish willPublish = getRawWillPublish();
126-
return "keepAlive=" + getKeepAlive() + ", cleanSession=" + isCleanSession() +
123+
final Mqtt3ConnectRestrictions restrictions = getRestrictions();
124+
return "keepAlive=" + getKeepAlive() + ", cleanSession=" + isCleanSession() + ", restrictions=" + restrictions +
127125
((simpleAuth == null) ? "" : ", simpleAuth=" + simpleAuth) +
128126
((willPublish == null) ? "" : ", willPublish=" + willPublish);
129127
}

src/main/java/com/hivemq/client/internal/mqtt/message/connect/mqtt3/Mqtt3ConnectViewBuilder.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
import com.hivemq.client.mqtt.mqtt3.message.auth.Mqtt3SimpleAuth;
3030
import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3ConnectBuilder;
3131
import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3ConnectRestrictions;
32-
import com.hivemq.client.mqtt.mqtt3.message.connect.Mqtt3ConnectRestrictionsBuilder;
3332
import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish;
34-
import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5ConnectRestrictions;
3533
import org.jetbrains.annotations.NotNull;
3634
import org.jetbrains.annotations.Nullable;
3735

@@ -44,19 +42,19 @@ public abstract class Mqtt3ConnectViewBuilder<B extends Mqtt3ConnectViewBuilder<
4442

4543
private int keepAliveSeconds = Mqtt3ConnectView.DEFAULT_KEEP_ALIVE;
4644
private boolean cleanSession = Mqtt3ConnectView.DEFAULT_CLEAN_SESSION;
45+
private @NotNull MqttConnectRestrictions restrictions = MqttConnectRestrictions.DEFAULT;
4746
private @Nullable MqttSimpleAuth simpleAuth;
4847
private @Nullable MqttWillPublish willPublish;
49-
private @NotNull MqttConnectRestrictions restrictions = MqttConnectRestrictions.DEFAULT;
5048

5149
Mqtt3ConnectViewBuilder() {}
5250

5351
Mqtt3ConnectViewBuilder(final @NotNull Mqtt3ConnectView connect) {
5452
final MqttConnect delegate = connect.getDelegate();
5553
keepAliveSeconds = delegate.getKeepAlive();
5654
cleanSession = delegate.isCleanStart();
55+
restrictions = delegate.getRestrictions();
5756
simpleAuth = delegate.getRawSimpleAuth();
5857
willPublish = delegate.getRawWillPublish();
59-
restrictions = delegate.getRestrictions();
6058
}
6159

6260
abstract @NotNull B self();
@@ -106,7 +104,7 @@ public abstract class Mqtt3ConnectViewBuilder<B extends Mqtt3ConnectViewBuilder<
106104
}
107105

108106
public @NotNull Mqtt3ConnectView build() {
109-
return Mqtt3ConnectView.of(keepAliveSeconds, cleanSession, simpleAuth, willPublish, restrictions);
107+
return Mqtt3ConnectView.of(keepAliveSeconds, cleanSession, restrictions, simpleAuth, willPublish);
110108
}
111109

112110
public static class Default extends Mqtt3ConnectViewBuilder<Default> implements Mqtt3ConnectBuilder {

src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/Mqtt3ConnectBuilderBase.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
import com.hivemq.client.mqtt.mqtt3.message.auth.Mqtt3SimpleAuthBuilder;
2323
import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3Publish;
2424
import com.hivemq.client.mqtt.mqtt3.message.publish.Mqtt3WillPublishBuilder;
25-
import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5Connect;
26-
import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5ConnectRestrictions;
27-
import com.hivemq.client.mqtt.mqtt5.message.connect.Mqtt5ConnectRestrictionsBuilder;
2825
import org.jetbrains.annotations.NotNull;
2926
import org.jetbrains.annotations.Nullable;
3027

@@ -71,6 +68,7 @@ public interface Mqtt3ConnectBuilderBase<B extends Mqtt3ConnectBuilderBase<B>> {
7168
*
7269
* @param restrictions the restrictions from the client.
7370
* @return the builder.
71+
* @since 1.3
7472
*/
7573
@CheckReturnValue
7674
@NotNull B restrictions(@NotNull Mqtt3ConnectRestrictions restrictions);
@@ -83,6 +81,7 @@ public interface Mqtt3ConnectBuilderBase<B extends Mqtt3ConnectBuilderBase<B>> {
8381
*
8482
* @return the fluent builder for the restrictions.
8583
* @see #restrictions(Mqtt3ConnectRestrictions)
84+
* @since 1.3
8685
*/
8786
@CheckReturnValue
8887
Mqtt3ConnectRestrictionsBuilder.@NotNull Nested<? extends B> restrictions();

src/main/java/com/hivemq/client/mqtt/mqtt3/message/connect/Mqtt3ConnectRestrictionsBuilderBase.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public interface Mqtt3ConnectRestrictionsBuilderBase<B extends Mqtt3ConnectRestr
3737
*
3838
* @param receiveMaximum the send maximum.
3939
* @return the builder.
40-
* @since 1.3
4140
*/
4241
@CheckReturnValue
4342
@NotNull B sendMaximum(int receiveMaximum);
@@ -49,7 +48,6 @@ public interface Mqtt3ConnectRestrictionsBuilderBase<B extends Mqtt3ConnectRestr
4948
*
5049
* @param maximumPacketSize the maximum packet size for sending.
5150
* @return the builder.
52-
* @since 1.3
5351
*/
5452
@CheckReturnValue
5553
@NotNull B sendMaximumPacketSize(int maximumPacketSize);

0 commit comments

Comments
 (0)