Skip to content

Commit

Permalink
tests(bindings): Anypoint MQ 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Apr 26, 2024
1 parent 718a49e commit 0ed0b0a
Show file tree
Hide file tree
Showing 76 changed files with 783 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.asyncapi.bindings.amqp.AMQPChannelBinding;
import com.asyncapi.bindings.amqp1.v0._1_0.channel.AMQP1ChannelBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.channel.AnypointMQChannelBinding;
import com.asyncapi.bindings.anypointmq.AnypointMQChannelBinding;
import com.asyncapi.bindings.googlepubsub.v0._1_0.channel.GooglePubSubChannelBinding;
import com.asyncapi.bindings.http.v0._1_0.channel.HTTPChannelBinding;
import com.asyncapi.bindings.ibmmq.v0._1_0.channel.IBMMQChannelBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.asyncapi.bindings.amqp.AMQPMessageBinding;
import com.asyncapi.bindings.amqp1.v0._1_0.message.AMQP1MessageBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.message.AnypointMQMessageBinding;
import com.asyncapi.bindings.anypointmq.AnypointMQMessageBinding;
import com.asyncapi.bindings.googlepubsub.v0._1_0.message.GooglePubSubMessageBinding;
import com.asyncapi.bindings.http.v0._1_0.message.HTTPMessageBinding;
import com.asyncapi.bindings.ibmmq.v0._1_0.message.IBMMQMessageBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.asyncapi.bindings.amqp.AMQPOperationBinding;
import com.asyncapi.bindings.amqp1.v0._1_0.operation.AMQP1OperationBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.operation.AnypointMQOperationBinding;
import com.asyncapi.bindings.anypointmq.AnypointMQOperationBinding;
import com.asyncapi.bindings.googlepubsub.v0._1_0.operation.GooglePubSubOperationBinding;
import com.asyncapi.bindings.http.v0._1_0.operation.HTTPOperationBinding;
import com.asyncapi.bindings.ibmmq.v0._1_0.operation.IBMMQOperationBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.asyncapi.bindings.amqp.AMQPServerBinding;
import com.asyncapi.bindings.amqp1.v0._1_0.server.AMQP1ServerBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.server.AnypointMQServerBinding;
import com.asyncapi.bindings.anypointmq.AnypointMQServerBinding;
import com.asyncapi.bindings.googlepubsub.v0._1_0.server.GooglePubSubServerBinding;
import com.asyncapi.bindings.http.v0._1_0.server.HTTPServerBinding;
import com.asyncapi.bindings.ibmmq.v0._1_0.server.IBMMQServerBinding;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.asyncapi.bindings.anypointmq;

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

/**
* Describes Anypoint MQ channel binding.
*
* @version 0.0.1
* @see <a href="https://github.com/asyncapi/bindings/blob/master/anypointmq/README.md#channel-binding-object">Anypoint MQ channel binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.anypointmq.v0._0_1.channel.AnypointMQChannelBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.anypointmq.v0._0_1.channel.AnypointMQChannelBinding.class, names = {
"0.0.1",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public class AnypointMQChannelBinding extends ChannelBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.asyncapi.bindings.anypointmq;

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

/**
* Describes Anypoint MQ message binding.
*
* @version 0.0.1
* @see <a href="https://github.com/asyncapi/bindings/blob/master/anypointmq/README.md#message-binding-object">Anypoint MQ message binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.anypointmq.v0._0_1.message.AnypointMQMessageBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.anypointmq.v0._0_1.message.AnypointMQMessageBinding.class, names = {
"0.0.1",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public class AnypointMQMessageBinding extends MessageBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.asyncapi.bindings.anypointmq;

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

/**
* Describes <a href="https://docs.mulesoft.com/mq/">Anypoint MQ</a> operation binding.
*
* @version 0.0.1
* @see <a href="https://github.com/asyncapi/bindings/tree/master/anypointmq#operation-binding-object">Anypoint MQ operation binding</a>
* @author Pavel Bodiachevskii
*/
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
defaultImpl = com.asyncapi.bindings.anypointmq.v0._0_1.operation.AnypointMQOperationBinding.class,
property = "bindingVersion",
visible = true
)
@JsonSubTypes({
@JsonSubTypes.Type(value = com.asyncapi.bindings.anypointmq.v0._0_1.operation.AnypointMQOperationBinding.class, names = {
"0.0.1",
"latest"
}),
})
@EqualsAndHashCode(callSuper = true)
public class AnypointMQOperationBinding extends OperationBinding {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.asyncapi.bindings.anypointmq;

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

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

import com.asyncapi.bindings.ChannelBinding;
import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
Expand All @@ -20,7 +19,7 @@
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonClassDescription("Describes Anypoint MQ channel binding.")
public class AnypointMQChannelBinding extends ChannelBinding {
public class AnypointMQChannelBinding extends com.asyncapi.bindings.anypointmq.AnypointMQChannelBinding {

/**
* OPTIONAL, defaults to the channel name.
Expand All @@ -46,13 +45,14 @@ public class AnypointMQChannelBinding extends ChannelBinding {
@JsonPropertyDescription("The type of destination, which MUST be either exchange or queue or fifo-queue. SHOULD be specified to document the messaging model (publish/subscribe, point-to-point, strict message ordering) supported by this channel.")
private AnypointMQChannelDestinationType destinationType = AnypointMQChannelDestinationType.QUEUE;

/**
* The version of this binding.
*/
@Nullable
@Builder.Default
@JsonProperty(value = "bindingVersion")
@JsonPropertyDescription("The version of this binding.")
private String bindingVersion = "0.0.1";
@Override
public String getBindingVersion() {
return "0.0.1";
}

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

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.asyncapi.bindings.anypointmq.v0._0_1.message;

import com.asyncapi.bindings.MessageBinding;
import com.asyncapi.v3.schema.AsyncAPISchema;
import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -21,7 +20,7 @@
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@JsonClassDescription("Describes Anypoint MQ message binding.")
public class AnypointMQMessageBinding extends MessageBinding {
public class AnypointMQMessageBinding extends com.asyncapi.bindings.anypointmq.AnypointMQMessageBinding {

/**
* A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers).
Expand All @@ -33,13 +32,14 @@ public class AnypointMQMessageBinding extends MessageBinding {
@JsonPropertyDescription("A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type object and have a properties key. Examples of Anypoint MQ protocol headers are messageId and messageGroupId.")
private AsyncAPISchema headers;

/**
* The version of this binding.
*/
@Nullable
@Builder.Default
@JsonProperty(value = "bindingVersion")
@JsonPropertyDescription("The version of this binding.")
private String bindingVersion = "0.0.1";
@Override
public String getBindingVersion() {
return "0.0.1";
}

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

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.asyncapi.bindings.anypointmq.v0._0_1.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 AnypointMQOperationBinding extends OperationBinding {
public class AnypointMQOperationBinding extends com.asyncapi.bindings.anypointmq.AnypointMQOperationBinding {

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

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

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.asyncapi.bindings.anypointmq.v0._0_1.server;

import com.asyncapi.bindings.ServerBinding;
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 AnypointMQServerBinding extends ServerBinding {
public class AnypointMQServerBinding extends com.asyncapi.bindings.anypointmq.AnypointMQServerBinding {

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

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.asyncapi.bindings.anypointmq;

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

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

import com.asyncapi.bindings.BindingTest;
import com.asyncapi.bindings.anypointmq.v0._0_1.channel.AnypointMQChannelBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.message.AnypointMQMessageBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.operation.AnypointMQOperationBinding;
import com.asyncapi.bindings.anypointmq.v0._0_1.server.AnypointMQServerBinding;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;

@DisplayName("latest")
public class AnypointMQLatestTest {

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

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

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

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

}
Loading

0 comments on commit 0ed0b0a

Please sign in to comment.