Skip to content

Commit

Permalink
feat(bindings): MQT5 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Apr 30, 2024
1 parent 9e6e2fd commit 5d767df
Show file tree
Hide file tree
Showing 75 changed files with 827 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.asyncapi.bindings.kafka.KafkaChannelBinding;
import com.asyncapi.bindings.mercure.MercureChannelBinding;
import com.asyncapi.bindings.mqtt.v0._1_0.channel.MQTTChannelBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.channel.MQTT5ChannelBinding;
import com.asyncapi.bindings.mqtt5.MQTT5ChannelBinding;
import com.asyncapi.bindings.nats.NATSChannelBinding;
import com.asyncapi.bindings.pulsar.PulsarChannelBinding;
import com.asyncapi.bindings.redis.RedisChannelBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.asyncapi.bindings.kafka.KafkaMessageBinding;
import com.asyncapi.bindings.mercure.MercureMessageBinding;
import com.asyncapi.bindings.mqtt.v0._1_0.message.MQTTMessageBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.message.MQTT5MessageBinding;
import com.asyncapi.bindings.mqtt5.MQTT5MessageBinding;
import com.asyncapi.bindings.nats.NATSMessageBinding;
import com.asyncapi.bindings.pulsar.PulsarMessageBinding;
import com.asyncapi.bindings.redis.RedisMessageBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.asyncapi.bindings.kafka.KafkaOperationBinding;
import com.asyncapi.bindings.mercure.MercureOperationBinding;
import com.asyncapi.bindings.mqtt.v0._1_0.operation.MQTTOperationBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.operation.MQTT5OperationBinding;
import com.asyncapi.bindings.mqtt5.MQTT5OperationBinding;
import com.asyncapi.bindings.nats.NATSOperationBinding;
import com.asyncapi.bindings.pulsar.PulsarOperationBinding;
import com.asyncapi.bindings.redis.RedisOperationBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.asyncapi.bindings.kafka.KafkaServerBinding;
import com.asyncapi.bindings.mercure.MercureServerBinding;
import com.asyncapi.bindings.mqtt.v0._1_0.server.MQTTServerBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.server.MQTT5ServerBinding;
import com.asyncapi.bindings.mqtt5.MQTT5ServerBinding;
import com.asyncapi.bindings.nats.NATSServerBinding;
import com.asyncapi.bindings.pulsar.PulsarServerBinding;
import com.asyncapi.bindings.redis.RedisServerBinding;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.asyncapi.bindings.mqtt5;

import com.asyncapi.bindings.ChannelBinding;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
* <p>
* Describes MQTT 5 channel binding.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/mqtt5#channel-binding-object">MQTT 5 channel binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.mqtt5.v0._2_0.channel.MQTT5ChannelBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.mqtt5.v0._2_0.channel.MQTT5ChannelBinding.class, names = {
"0.2.0",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public abstract class MQTT5ChannelBinding extends ChannelBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.asyncapi.bindings.mqtt5;

import com.asyncapi.bindings.MessageBinding;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
* <p>
* Describes MQTT 5 message binding.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/mqtt5#message-binding-object">MQTT 5 message binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.mqtt5.v0._2_0.message.MQTT5MessageBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.mqtt5.v0._2_0.message.MQTT5MessageBinding.class, names = {
"0.2.0",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public abstract class MQTT5MessageBinding extends MessageBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.asyncapi.bindings.mqtt5;

import com.asyncapi.bindings.OperationBinding;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
* <p>
* Describes MQTT 5 operation binding.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/mqtt5#operation-binding-object">MQTT 5 operation binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.mqtt5.v0._2_0.operation.MQTT5OperationBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.mqtt5.v0._2_0.operation.MQTT5OperationBinding.class, names = {
"0.2.0",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public abstract class MQTT5OperationBinding extends OperationBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.asyncapi.bindings.mqtt5;

import com.asyncapi.bindings.ServerBinding;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.EqualsAndHashCode;

/**
* Describes MQTT 5 server binding.
*
* @version 0.2.0
* @see <a href="https://github.com/asyncapi/bindings/tree/master/mqtt5#server-binding-object">MQTT 5 server binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.mqtt5.v0._2_0.server.MQTT5ServerBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.mqtt5.v0._2_0.server.MQTT5ServerBinding.class, names = {
"0.2.0",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public abstract class MQTT5ServerBinding extends ServerBinding {}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.asyncapi.bindings.mqtt5.v0._2_0.channel;

import com.asyncapi.bindings.ChannelBinding;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.Nullable;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
Expand All @@ -17,5 +17,16 @@
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MQTT5ChannelBinding extends ChannelBinding {
public class MQTT5ChannelBinding extends com.asyncapi.bindings.mqtt5.MQTT5ChannelBinding {

@Override
public String getBindingVersion() {
return "0.2.0";
}

@Override
public void setBindingVersion(@Nullable String bindingVersion) {
super.setBindingVersion("0.2.0");
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.asyncapi.bindings.mqtt5.v0._2_0.message;

import com.asyncapi.bindings.MessageBinding;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.Nullable;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
Expand All @@ -17,5 +17,16 @@
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MQTT5MessageBinding extends MessageBinding {
public class MQTT5MessageBinding extends com.asyncapi.bindings.mqtt5.MQTT5MessageBinding {

@Override
public String getBindingVersion() {
return "0.2.0";
}

@Override
public void setBindingVersion(@Nullable String bindingVersion) {
super.setBindingVersion("0.2.0");
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.asyncapi.bindings.mqtt5.v0._2_0.operation;

import com.asyncapi.bindings.OperationBinding;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.Nullable;

/**
* This class MUST NOT contain any properties. Its name is reserved for future use.
Expand All @@ -17,5 +17,16 @@
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MQTT5OperationBinding extends OperationBinding {
public class MQTT5OperationBinding extends com.asyncapi.bindings.mqtt5.MQTT5OperationBinding {

@Override
public String getBindingVersion() {
return "0.2.0";
}

@Override
public void setBindingVersion(@Nullable String bindingVersion) {
super.setBindingVersion("0.2.0");
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.asyncapi.bindings.mqtt5.v0._2_0.server;

import com.asyncapi.bindings.ServerBinding;
import lombok.*;
import org.jetbrains.annotations.Nullable;

/**
* Describes MQTT 5 server binding.
Expand All @@ -15,15 +15,22 @@
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class MQTT5ServerBinding extends ServerBinding {
public class MQTT5ServerBinding extends com.asyncapi.bindings.mqtt5.MQTT5ServerBinding {

/**
* TODO: support reference, Schema object
* Session Expiry Interval in seconds or a Schema Object containing the definition of the interval.
*/
private int sessionExpiryInterval;

@Builder.Default
private String bindingVersion = "0.2.0";
@Override
public String getBindingVersion() {
return "0.2.0";
}

@Override
public void setBindingVersion(@Nullable String bindingVersion) {
super.setBindingVersion("0.2.0");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.platform.suite.api.SuiteDisplayName;

@Suite
@SuiteDisplayName("MQTT")
@SuiteDisplayName("MQTT5")
@SelectPackages("com.asyncapi.bindings.mqtt")
public class MQTT {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.asyncapi.bindings.mqtt5;

import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SuiteDisplayName;

@Suite
@SuiteDisplayName("MQTT5")
@SelectPackages("com.asyncapi.bindings.mqtt5")
public class MQTT5 {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.asyncapi.bindings.mqtt5;

import com.asyncapi.bindings.BindingTest;
import com.asyncapi.bindings.mqtt5.v0._2_0.channel.MQTT5ChannelBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.message.MQTT5MessageBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.operation.MQTT5OperationBinding;
import com.asyncapi.bindings.mqtt5.v0._2_0.server.MQTT5ServerBinding;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;

@DisplayName("latest")
public class MQTT5LatestTest {

@Nested
@DisplayName("channel")
class ChannelTest extends BindingTest<MQTT5ChannelBinding> {{
super.binding = MQTT5V0_2_0Test.channelBinding();
super.bindingTypeClass = MQTT5ChannelBinding.class;
super.pathToBindingJson = "/bindings/mqtt5/latest/channel/binding.json";
super.pathToExtendedBindingJson = "/bindings/mqtt5/latest/channel/binding - extended.json";
super.pathToWronglyExtendedBindingJson = "/bindings/mqtt5/latest/channel/binding - wrongly extended.json";
}}

@Nested
@DisplayName("message")
class Message extends BindingTest<MQTT5MessageBinding> {{
super.binding = MQTT5V0_2_0Test.messageBinding();
super.bindingTypeClass = MQTT5MessageBinding.class;
super.pathToBindingJson = "/bindings/mqtt5/latest/message/binding.json";
super.pathToExtendedBindingJson = "/bindings/mqtt5/latest/message/binding - extended.json";
super.pathToWronglyExtendedBindingJson = "/bindings/mqtt5/latest/message/binding - wrongly extended.json";
}}

@Nested
@DisplayName("operation")
class Operation extends BindingTest<MQTT5OperationBinding> {{
super.binding = MQTT5V0_2_0Test.operationBinding();
super.bindingTypeClass = MQTT5OperationBinding.class;
super.pathToBindingJson = "/bindings/mqtt5/latest/operation/binding.json";
super.pathToExtendedBindingJson = "/bindings/mqtt5/latest/operation/binding - extended.json";
super.pathToWronglyExtendedBindingJson = "/bindings/mqtt5/latest/operation/binding - wrongly extended.json";
}}

@Nested
@DisplayName("server")
class Server extends BindingTest<MQTT5ServerBinding> {{
super.binding = MQTT5V0_2_0Test.serverBinding();
super.bindingTypeClass = MQTT5ServerBinding.class;
super.pathToBindingJson = "/bindings/mqtt5/latest/server/binding.json";
super.pathToExtendedBindingJson = "/bindings/mqtt5/latest/server/binding - extended.json";
super.pathToWronglyExtendedBindingJson = "/bindings/mqtt5/latest/server/binding - wrongly extended.json";
}}

}
Loading

0 comments on commit 5d767df

Please sign in to comment.