You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/04/08 09:44:55 UTC

[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #3709: Fix #3656 Improve camel-quarkus-paho-mqtt5 test coverage

aldettinger commented on code in PR #3709:
URL: https://github.com/apache/camel-quarkus/pull/3709#discussion_r845940020


##########
integration-tests/paho-mqtt5/src/test/java/org/apache/camel/quarkus/component/paho/mqtt5/it/PahoMqtt5TestResource.java:
##########
@@ -32,25 +36,76 @@
     private static final Logger LOGGER = LoggerFactory.getLogger(PahoMqtt5TestResource.class);
     private static final String IMAGE = "eclipse-mosquitto:1.6.12";
     private static final int TCP_PORT = 1883;
+    private static final int SSL_PORT = 8883;
+    private static final int WS_PORT = 9001;
+    private static final String MQTT_USERNAME = "quarkus";
+    private static final String MQTT_PASSWORD = "quarkus";
 
     private GenericContainer<?> container;
+    private boolean useFixedPort = false;
+    private boolean startContainer = true;
+
+    @Override
+    public void init(Map<String, String> initArgs) {
+        initArgs.forEach((name, value) -> {
+            if (name.equals("useFixedPort")) {
+                useFixedPort = Boolean.parseBoolean(value);
+            } else if (name.equals("startContainer")) {
+                startContainer = Boolean.parseBoolean(value);
+            }
+        });
+    }
+
+    @Override
+    public void inject(TestInjector testInjector) {
+        testInjector.injectIntoFields(container,
+                new TestInjector.AnnotatedAndMatchesType(InjectPahoContainer.class, GenericContainer.class));
+    }
 
     @Override
     public Map<String, String> start() {
         LOGGER.info(TestcontainersConfiguration.getInstance().toString());
 
         try {
-            container = new GenericContainer<>(IMAGE)
-                    .withExposedPorts(TCP_PORT)
-                    .withLogConsumer(new Slf4jLogConsumer(LOGGER))
+            Map<String, String> result = new HashMap<>();
+
+            if (useFixedPort) {

Review Comment:
   Could you please describe why we need to have use `useFixedPort` ? When should we use it ? And when not to use it please ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org