orpiske commented on code in PR #13109:
URL: https://github.com/apache/camel/pull/13109#discussion_r1490713034


##########
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantContainer.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.test.infra.qdrant.services;
+
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantContainer extends GenericContainer<QdrantContainer> {
+    private static final ObjectMapper MAPPER = new ObjectMapper();
+    private static final HttpClient HTTP = HttpClient.newHttpClient();
+
+    public static final int HTTP_PORT = 6333;
+    public static final int GRPC_PORT = 6334;
+
+    public QdrantContainer(DockerImageName imageName) {
+        super(imageName);
+    }
+
+    @Override
+    protected void configure() {
+        super.configure();
+
+        withExposedPorts(HTTP_PORT, GRPC_PORT);
+        withLogConsumer(new 
Slf4jLogConsumer(LoggerFactory.getLogger(QdrantContainer.class)));
+        waitingFor(Wait.forLogMessage(".*Actix runtime found; starting in 
Actix runtime.*", 1));
+    }
+
+    public String getGrpcHost() {
+        return getHost();
+    }
+
+    public int getGrpcPort() {
+        return getMappedPort(GRPC_PORT);
+    }
+
+    public String getHttpHost() {
+        return getHost();
+    }
+
+    public int getHttpPort() {
+        return getMappedPort(HTTP_PORT);
+    }
+
+    public HttpResponse<byte[]> put(String path, Map<Object, Object> body) 
throws Exception {
+        final String reqPath = !path.startsWith("/") ? "/" + path : path;

Review Comment:
   I think you can use `StringHelper.after(path, "/", path)` here. 



##########
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/common/QdrantProperties.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.test.infra.qdrant.common;
+
+public class QdrantProperties {
+    public static final String INFRA_TYPE = "qdrant";
+    public static final String QDRANT_HTTP_HOST = "qdrant.http.host";
+    public static final String QDRANT_HTTP_PORT = "qdrant.http.port";
+    public static final String QDRANT_GRPC_HOST = "qdrant.grpc.host";
+    public static final String QDRANT_GRPC_PORT = "qdrant.grpc.port";
+    public static final String QDRANT_API_KEy = "qdrant.apiKey";

Review Comment:
   There's a small typo here `KEy` instead of `KEY`. 



##########
test-infra/camel-test-infra-qdrant/src/test/java/org/apache/camel/test/infra/qdrant/services/QdrantLocalContainerService.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.test.infra.qdrant.services;
+
+import java.net.http.HttpResponse;
+import java.util.Map;
+
+import org.apache.camel.test.infra.common.LocalPropertyResolver;
+import org.apache.camel.test.infra.common.services.ContainerService;
+import org.apache.camel.test.infra.qdrant.common.QdrantProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.utility.DockerImageName;
+
+public class QdrantLocalContainerService implements QdrantService, 
ContainerService<QdrantContainer> {
+    private static final Logger LOG = 
LoggerFactory.getLogger(QdrantLocalContainerService.class);
+
+    private final QdrantContainer container;
+
+    public QdrantLocalContainerService() {
+        
this(LocalPropertyResolver.getProperty(QdrantLocalContainerService.class, 
QdrantProperties.QDRANT_CONTAINER));
+    }
+
+    public QdrantLocalContainerService(String imageName) {
+        this(new QdrantContainer(DockerImageName.parse(imageName)));
+    }
+
+    public QdrantLocalContainerService(QdrantContainer container) {
+        this.container = container;
+    }
+
+    @Override
+    public void registerProperties() {
+        System.setProperty(QdrantProperties.QDRANT_HTTP_HOST, getHttpHost());
+        System.setProperty(QdrantProperties.QDRANT_HTTP_PORT, "" + 
getHttpPort());

Review Comment:
   Just a nitpick: `String.valueOf`, otherwise it keeps adding noise to 
SonarSource analysis. 



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to