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 2021/11/29 09:16:13 UTC

[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3336: :white_check_mark: Kafka Oauth Integration test with Strimzi and Keyc…

aldettinger commented on a change in pull request #3336:
URL: https://github.com/apache/camel-quarkus/pull/3336#discussion_r758162980



##########
File path: integration-tests/kafka-oauth/src/test/java/org/apache/camel/quarkus/kafka/oauth/it/container/KafkaContainer.java
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
+ *
+ *      http://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.apache.camel.quarkus.kafka.oauth.it.container;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.github.dockerjava.api.command.InspectContainerResponse;
+import io.strimzi.StrimziKafkaContainer;
+import org.jboss.logging.Logger;
+import org.testcontainers.containers.FixedHostPortGenericContainer;
+import org.testcontainers.containers.Network;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.images.builder.Transferable;
+import org.testcontainers.utility.MountableFile;
+
+/**
+ * Inspired from https://github.com/quarkusio/quarkus/tree/main/integration-tests/kafka-oauth-keycloak/
+ */
+public class KafkaContainer extends FixedHostPortGenericContainer<KafkaContainer> {
+
+    private static final Logger LOGGER = Logger.getLogger(KafkaContainer.class);
+
+    private static final String STARTER_SCRIPT = "/testcontainers_start.sh";
+    private static final int KAFKA_PORT = 9092;
+    private static final String LATEST_KAFKA_VERSION;
+
+    private static final List<String> supportedKafkaVersions = new ArrayList<>(3);
+
+    static {
+        InputStream inputStream = StrimziKafkaContainer.class.getResourceAsStream("/kafka-versions.txt");
+        InputStreamReader streamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
+
+        try (BufferedReader bufferedReader = new BufferedReader(streamReader)) {
+            String kafkaVersion;
+            while ((kafkaVersion = bufferedReader.readLine()) != null) {
+                supportedKafkaVersions.add(kafkaVersion);
+            }
+        } catch (IOException e) {
+            LOGGER.error("Unable to load the supported Kafka versions", e);
+        }
+
+        // sort kafka version from low to high
+        Collections.sort(supportedKafkaVersions);

Review comment:
       With kafka versioning, is it possible one day to have a case where versions ordering differ from string ordering ? Like 3.0.1, 3.0.2 , 3.0.11 ?




-- 
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