Skip to content

Commit

Permalink
feat(AsyncAPI 2.6.0): Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Feb 12, 2023
1 parent fa26600 commit 269be51
Show file tree
Hide file tree
Showing 11 changed files with 1,431 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ class AMQPChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): AMQPChannelBinding {
return AMQPChannelBinding.builder()
.`is`("routingKey")
.queue(AMQPChannelBinding.QueueProperties.builder()
.name("my-queue-name")
.durable(true)
.exclusive(true)
.autoDelete(false)
.build()
)
.exchange(AMQPChannelBinding.ExchangeProperties.builder()
.name("myExchange")
.type("topic")
.durable(true)
.autoDelete(false)
.build()
)
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -45,4 +25,27 @@ class AMQPChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): AMQPChannelBinding {
return AMQPChannelBinding.builder()
.`is`("routingKey")
.queue(AMQPChannelBinding.QueueProperties.builder()
.name("my-queue-name")
.durable(true)
.exclusive(true)
.autoDelete(false)
.build()
)
.exchange(AMQPChannelBinding.ExchangeProperties.builder()
.name("myExchange")
.type("topic")
.durable(true)
.autoDelete(false)
.build()
)
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ class AnypointMQChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): AnypointMQChannelBinding {
return AnypointMQChannelBinding.builder()
.destination("user-signup-exchg")
.destinationType("exchange")
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -32,4 +25,14 @@ class AnypointMQChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): AnypointMQChannelBinding {
return AnypointMQChannelBinding.builder()
.destination("user-signup-exchg")
.destinationType("exchange")
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,6 @@ class GooglePubSubChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): GooglePubSubChannelBinding {
return GooglePubSubChannelBinding.builder()
.topic("projects/your-project/topics/topic-proto-schema")
.messageRetentionDuration("86400s")
.messageStoragePolicy(GooglePubSubChannelBinding.MessageStoragePolicy(
listOf(
"us-central1",
"us-central2",
"us-east1",
"us-east4",
"us-east5",
"us-east7",
"us-south1",
"us-west1",
"us-west2",
"us-west3",
"us-west4"
)
))
.schemaSettings(GooglePubSubChannelBinding.SchemaSettings.builder()
.encoding("binary")
.name("projects/your-project/schemas/message-proto")
.build()
)
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -48,4 +21,34 @@ class GooglePubSubChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): GooglePubSubChannelBinding {
return GooglePubSubChannelBinding.builder()
.topic("projects/your-project/topics/topic-proto-schema")
.messageRetentionDuration("86400s")
.messageStoragePolicy(GooglePubSubChannelBinding.MessageStoragePolicy(
listOf(
"us-central1",
"us-central2",
"us-east1",
"us-east4",
"us-east5",
"us-east7",
"us-south1",
"us-west1",
"us-west2",
"us-west3",
"us-west4"
)
))
.schemaSettings(GooglePubSubChannelBinding.SchemaSettings.builder()
.encoding("binary")
.name("projects/your-project/schemas/message-proto")
.build()
)
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,6 @@ class IBMMQChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): IBMMQChannelBinding {
return IBMMQChannelBinding.builder()
.destinationType("topic")
.queue(IBMMQChannelBinding.Queue.builder()
.objectName("message")
.isPartitioned(false)
.exclusive(true)
.build()
)
.topic(Topic.builder()
.string("messages")
.objectName("message")
.durablePermitted(true)
.lastMsgRetained(true)
.build()
)
.maxMsgLength(1024)
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -42,4 +22,27 @@ class IBMMQChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): IBMMQChannelBinding {
return IBMMQChannelBinding.builder()
.destinationType("topic")
.queue(IBMMQChannelBinding.Queue.builder()
.objectName("message")
.isPartitioned(false)
.exclusive(true)
.build()
)
.topic(Topic.builder()
.string("messages")
.objectName("message")
.durablePermitted(true)
.lastMsgRetained(true)
.build()
)
.maxMsgLength(1024)
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@ class KafkaChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): KafkaChannelBinding {
return KafkaChannelBinding.builder()
.topic("my-specific-topic-name")
.partitions(20)
.replicas(3)
.topicConfiguration(KafkaChannelBinding.TopicConfiguration.builder()
.cleanupPolicy(listOf("delete", "compact"))
.retentionMs(604_800_000)
.retentionBytes(1_000_000_000)
.deleteRetentionMs(86_400_000)
.maxMessageBytes(1_048_588)
.build()
)
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -41,4 +25,23 @@ class KafkaChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): KafkaChannelBinding {
return KafkaChannelBinding.builder()
.topic("my-specific-topic-name")
.partitions(20)
.replicas(3)
.topicConfiguration(KafkaChannelBinding.TopicConfiguration.builder()
.cleanupPolicy(listOf("delete", "compact"))
.retentionMs(604_800_000)
.retentionBytes(1_000_000_000)
.deleteRetentionMs(86_400_000)
.maxMessageBytes(1_048_588)
.build()
)
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ class PulsarChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): PulsarChannelBinding {
return PulsarChannelBinding.builder()
.namespace("staging")
.persistence("persistent")
.compaction(1000)
.geoReplication(listOf("us-east1", "us-west1"))
.retention(PulsarChannelBinding.RetentionDefinition.builder()
.time(7)
.size(1000)
.build()
)
.ttl(360)
.deduplication(false)
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -37,4 +21,23 @@ class PulsarChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): PulsarChannelBinding {
return PulsarChannelBinding.builder()
.namespace("staging")
.persistence("persistent")
.compaction(1000)
.geoReplication(listOf("us-east1", "us-west1"))
.retention(PulsarChannelBinding.RetentionDefinition.builder()
.time(7)
.size(1000)
.build()
)
.ttl(360)
.deduplication(false)
.build()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,6 @@ class WebSocketsChannelBindingTest {

private val objectMapper = ObjectMapper()

private fun build(): WebSocketsChannelBinding {
return WebSocketsChannelBinding.builder()
.method("GET")
.query(mapOf(
Pair("type", "object"),
Pair("properties", mapOf(
Pair("ref", mapOf(
Pair("type", "string"),
Pair("description", "Referral.")
))
)),
))
.headers(mapOf(
Pair("type", "object"),
Pair("properties", mapOf(
Pair("Authentication", mapOf(
Pair("type", "string"),
Pair("description", "Authentication token")
))
)),
))
.build()
}

@Test
@DisplayName("Compare hand crafted model with parsed json")
fun compareModelWithParsedJson() {
Expand All @@ -49,4 +25,31 @@ class WebSocketsChannelBindingTest {
)
}

companion object {
@JvmStatic
fun build(): WebSocketsChannelBinding {
return WebSocketsChannelBinding.builder()
.method("GET")
.query(mapOf(
Pair("type", "object"),
Pair("properties", mapOf(
Pair("ref", mapOf(
Pair("type", "string"),
Pair("description", "Referral.")
))
)),
))
.headers(mapOf(
Pair("type", "object"),
Pair("properties", mapOf(
Pair("Authentication", mapOf(
Pair("type", "string"),
Pair("description", "Authentication token")
))
)),
))
.build()
}
}

}
Loading

0 comments on commit 269be51

Please sign in to comment.