stataru8 commented on code in PR #433:
URL: https://github.com/apache/camel-karaf/pull/433#discussion_r1679910303


##########
tests/features/camel-docker/src/main/java/org/apache/karaf/camel/test/CamelDockerRouteSupplier.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.karaf.camel.test;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.RouteDefinition;
+import 
org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteSupplier;
+import org.apache.karaf.camel.itests.CamelRouteSupplier;
+import org.osgi.service.component.annotations.Component;
+
+@Component(
+        name = "karaf-camel-docker-test",
+        immediate = true,
+        service = CamelRouteSupplier.class
+)
+public class CamelDockerRouteSupplier extends 
AbstractCamelSingleFeatureResultMockBasedRouteSupplier {
+
+    public static final String DOCKER_USERNAME = "test";
+    public static final String DOCKER_TEST_IMAGE = "hello-world:linux";
+
+    @Override
+    protected boolean consumerEnabled() {

Review Comment:
   I've tried to make a test for consumers:
   - `events` - It works but is unstable;
   ```
   20:47:51.056 INFO [dockerjava-netty-4-1] Received Event(status=save, 
id=sha256:d2c94e258dcb3c5ac2798d32e1249e42ef01cba4841c2234249495f87264ac5a, 
from=null, node=null, type=IMAGE, action=save, 
actor=EventActor(id=sha256:d2c94e258dcb3c5ac2798d32e1249e42ef01cba4841c2234249495f87264ac5a,
 
attributes={name=sha256:d2c94e258dcb3c5ac2798d32e1249e42ef01cba4841c2234249495f87264ac5a}),
 time=1721155670, timeNano=1721155670934422835)
   20:47:51.152 WARN [dockerjava-netty-1-1] Error processing exchange. 
Exchange[B99D96CB1A3AD23-000000000000000B]. Caused by: 
[java.util.concurrent.RejectedExecutionException - null]
   java.util.concurrent.RejectedExecutionException: null
           at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.runNotAllowed(RedeliveryErrorHandler.java:469)
 ~[!/:?]
           at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:402)
 ~[!/:?]
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
 [!/:?]
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189)
 [!/:?]
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166)
 [!/:?]
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
 [!/:?]
           at 
org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59)
 [!/:?]
           at org.apache.camel.processor.Pipeline.process(Pipeline.java:163) 
[!/:?]
           at 
org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:346)
 [!/:?]
           at 
org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:322)
 [!/:?]
           at 
org.apache.camel.component.docker.consumer.DockerEventsConsumer$EventsCallback.onNext(DockerEventsConsumer.java:97)
 [!/:?]
           at 
org.apache.camel.component.docker.consumer.DockerEventsConsumer$EventsCallback.onNext(DockerEventsConsumer.java:85)
 [!/:?]
           at 
com.github.dockerjava.core.exec.AbstrAsyncDockerCmdExec$1.onNext(AbstrAsyncDockerCmdExec.java:41)
 [!/:?]
           at 
com.github.dockerjava.netty.handler.JsonResponseCallbackHandler.channelRead0(JsonResponseCallbackHandler.java:55)
 [!/:?]
           at 
com.github.dockerjava.netty.handler.JsonResponseCallbackHandler.channelRead0(JsonResponseCallbackHandler.java:17)
 [!/:?]
           at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:66)
 [!/:?]
           at 
com.github.dockerjava.netty.handler.HttpResponseHandler.channelRead0(HttpResponseHandler.java:32)
 [!/:?]
           at 
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280) 
[!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:333)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:455)
 [!/:4.1.111.Final]
           at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
 [!/:4.1.111.Final]
           at 
io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
 [!/:4.1.111.Final]
           at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
 [!/:4.1.111.Final]
           at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
 [!/:4.1.111.Final]
           at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
 [!/:4.1.111.Final]
           at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
 [!/:4.1.111.Final]
           at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) 
[!/:4.1.111.Final]
           at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
 [!/:4.1.111.Final]
           at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) 
[!/:4.1.111.Final]
           at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) 
[!/:4.1.111.Final]
           at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
 [!/:4.1.111.Final]
           at 
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 
[!/:4.1.111.Final]
           at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 [!/:4.1.111.Final]
           at java.lang.Thread.run(Thread.java:833) [?:?]
   ```
   - `info` - The official doc is outdated;
   - `stats` - I need to set a container ID in the `from`, but the `form` is 
triggered before I can create a container
   ```
   1:46:42.277 INFO [Blueprint Event Dispatcher: 1] Apache Camel 4.7.0 
(camel-1) is starting
   21:46:43.150 INFO [Blueprint Event Dispatcher: 1] Routes startup (total:2)
   21:46:43.150 INFO [Blueprint Event Dispatcher: 1]     Started docker-route 
(timer://foo)
   21:46:43.150 INFO [Blueprint Event Dispatcher: 1]     Started docker-route2 
(docker://stats)
   21:46:43.151 INFO [Blueprint Event Dispatcher: 1] Apache Camel 4.7.0 
(camel-1) started in 873ms (build:0ms init:0ms start:873ms)
   21:46:43.168 ERROR [dockerjava-netty-1-1] Error during callback
   com.github.dockerjava.api.exception.NotFoundException: Status 404: 
{"message":"No such container: a"}
   ```
   ```
   21:50:43.135 INFO [Blueprint Event Dispatcher: 1] Apache Camel 4.7.0 
(camel-2) is starting
   21:50:43.258 ERROR [Blueprint Event Dispatcher: 1] Error starting 
CamelContext (camel-2) due to exception thrown: containerId was not specified
   java.lang.NullPointerException: containerId was not specified
   ```



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