-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix all the Checkstyle violations for those modules * Introduce a `MosquittoContainerTest` contract into the `spring-function-test-support` and use it in the MQTT modules * Fix READMEs for previously migrated modules to auto-configuration
- Loading branch information
1 parent
3f349ca
commit fbe0d22
Showing
24 changed files
with
163 additions
and
145 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.../src/main/java/org/springframework/cloud/fn/test/support/mqtt/MosquittoContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2021-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.fn.test.support.mqtt; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
/** | ||
* The base contract for JUnit tests based on the container for MQTT Mosquitto broker. The | ||
* Testcontainers 'reuse' option must be disabled,so, Ryuk container is started and will | ||
* clean all the containers up from this test suite after JVM exit. Since the Mosquitto | ||
* container instance is shared via static property, it is going to be started only once | ||
* per JVM, therefore the target Docker container is reused automatically. | ||
* | ||
* @author Artem Bilan | ||
*/ | ||
@Testcontainers(disabledWithoutDocker = true) | ||
public interface MosquittoContainerTest { | ||
|
||
GenericContainer<?> MOSQUITTO_CONTAINER = new GenericContainer<>("eclipse-mosquitto:2.0.13") | ||
.withCommand("mosquitto -c /mosquitto-no-auth.conf") | ||
.withExposedPorts(1883); | ||
|
||
@BeforeAll | ||
static void startContainer() { | ||
MOSQUITTO_CONTAINER.start(); | ||
} | ||
|
||
static String mqttUrl() { | ||
return "tcp://localhost:" + MOSQUITTO_CONTAINER.getFirstMappedPort(); | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
...st-support/src/main/java/org/springframework/cloud/fn/test/support/mqtt/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* The MQTT protocol testing support. | ||
*/ | ||
package org.springframework.cloud.fn.test.support.mqtt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ring-mqtt-common/src/main/java/org/springframework/cloud/fn/common/mqtt/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* The MQTT client auto-configuration support. | ||
*/ | ||
package org.springframework.cloud.fn.common.mqtt; |
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.springframework.cloud.fn.common.mqtt.MqttConfiguration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
dependencies { | ||
api project(':spring-mqtt-common') | ||
|
||
testImplementation project(':spring-function-test-support') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...-mqtt-consumer/src/main/java/org/springframework/cloud/fn/consumer/mqtt/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* The MQTT consumer auto-configuration support. | ||
*/ | ||
package org.springframework.cloud.fn.consumer.mqtt; |
1 change: 1 addition & 0 deletions
1
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.springframework.cloud.fn.consumer.mqtt.MqttConsumerConfiguration |
Oops, something went wrong.