You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "jamesnetherton (via GitHub)" <gi...@apache.org> on 2023/04/26 06:28:41 UTC

[GitHub] [camel-quarkus] jamesnetherton commented on a diff in pull request #4828: MinIO: Extend test coverage #4707

jamesnetherton commented on code in PR #4828:
URL: https://github.com/apache/camel-quarkus/pull/4828#discussion_r1177397382


##########
integration-tests/minio/src/main/java/org/apache/camel/quarkus/component/minio/it/MinioResource.java:
##########
@@ -30,76 +34,169 @@
 import jakarta.ws.rs.GET;
 import jakarta.ws.rs.POST;
 import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
 import jakarta.ws.rs.Produces;
 import jakarta.ws.rs.QueryParam;
 import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.CamelContext;
 import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.Exchange;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.minio.MinioComponent;
 import org.apache.camel.component.minio.MinioConstants;
 import org.apache.camel.component.minio.MinioOperations;
+import org.apache.camel.util.Pair;
 
 @Path("/minio")
 @ApplicationScoped
 public class MinioResource {
 
     public static final String SERVER_ACCESS_KEY = "testAccessKey";
     public static final String SERVER_SECRET_KEY = "testSecretKey";
+    private static final String URL_AUTH = "accessKey=" + SERVER_ACCESS_KEY + "&secretKey=RAW(" + SERVER_SECRET_KEY + ")";
 
     @Inject
     ProducerTemplate producerTemplate;
 
     @Inject
     ConsumerTemplate consumerTemplate;
 
+    @Inject
+    CamelContext camelContext;
+
+    @Path("/consumerWithClientCreation/{endpoint}")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response consumerWithClientCreation(@PathParam("endpoint") String endpoint) {
+        MinioComponent minioComponent = camelContext.getComponent("minio", MinioComponent.class);
+        MinioClient client = minioComponent.getConfiguration().getMinioClient();
+        minioComponent.getConfiguration().setMinioClient(null);

Review Comment:
   May be better to have a dedicated component instance for this, then you don't need to mess with the original `minio` instance.
   
   E.g
   
   ```
   @Produces
   @Named("minioCamel")
   MinioComponent camelMinioComponent() {
       // Code to set null client, autowired disabled etc
   }
   ```



##########
integration-tests/minio/src/test/java/org/apache/camel/quarkus/component/minio/it/MinioTestResource.java:
##########
@@ -30,6 +30,7 @@ public class MinioTestResource implements QuarkusTestResourceLifecycleManager {
     public static final String CONTAINER_SECRET_KEY = "MINIO_SECRET_KEY";
     private final String CONTAINER_IMAGE = "minio/minio:RELEASE.2020-12-03T05-49-24Z";

Review Comment:
   Might be good to update the container image. Maybe to this:
   
   https://github.com/quarkiverse/quarkus-minio/blob/main/minio-client/deployment/src/main/java/io/quarkiverse/minio/client/deployment/devservices/MinioDevServicesBuildTimeConfig.java#L29



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