gnodet commented on code in PR #26734:
URL: https://github.com/apache/camel/pull/26734#discussion_r4124702078


##########
core/camel-core/src/test/java/org/apache/camel/util/HttpResourceTimeoutTest.java:
##########
@@ -0,0 +1,173 @@
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.impl.engine.DefaultResourceResolvers;
+import org.apache.camel.spi.Resource;
+import org.apache.camel.support.ResourceHelper;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * An {@code http:} resource must not be able to stall the caller forever.
+ * <p/>
+ * The server here accepts the connection and then never answers, which is the 
only shape that reproduces the problem: a
+ * refused connection fails fast on its own, so nothing is proven by pointing 
at a closed port.
+ * <p/>
+ * The timeouts below are deliberately {@code SEPARATE_THREAD}: the default 
mode only measures elapsed time once the
+ * test method returns, so a regression that restores the indefinite wait 
would hang the build instead of failing it.
+ */
+public class HttpResourceTimeoutTest {

Review Comment:
   > I think this should be now the leading edge. using package private class 
is the new recommendation since JUnit 5. it is this way for good reasons. Some 
of the most important: better API contract, it ensures that we declare as 
public only when we really expect that it is reused in another class in another 
package/module. it avoids problems in case of refactor. it also increase 
slightly the readbaility by having slightly less code.
   > 
   > Anyway, this is not necessary to change just for that the PR. Would be 
just nice that the AI agent can really follow the provided rules on the first 
shot.
   
   FWIW, I added the rule in `claude.md` at some point, then was asked to 
revert it, which I did quite some time ago, because the change lead to too many 
differences between branches, so backport was more difficult.  I suppose Claus' 
agent was on an older revision of the file.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to