[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3555: Improve available port discovery in tests

2022-02-16 Thread GitBox


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



##
File path: 
integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/AvailablePortFinder.java
##
@@ -103,4 +124,19 @@ private static boolean isQuarkusReservedPort(int port) {
 }
 return false;
 }
+
+private static String getCallerClassName() {
+return 
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE)
+.walk(s -> s.map(StackWalker.StackFrame::getClassName)
+.filter(className -> 
!className.equals(AvailablePortFinder.class.getName()))
+.findFirst()

Review comment:
   Ok, actually it's Map so the value would appear 2 times in 
the map => OK




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




[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3555: Improve available port discovery in tests

2022-02-16 Thread GitBox


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



##
File path: 
integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/AvailablePortFinder.java
##
@@ -103,4 +124,19 @@ private static boolean isQuarkusReservedPort(int port) {
 }
 return false;
 }
+
+private static String getCallerClassName() {
+return 
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE)
+.walk(s -> s.map(StackWalker.StackFrame::getClassName)
+.filter(className -> 
!className.equals(AvailablePortFinder.class.getName()))
+.findFirst()

Review comment:
   So `findFirst()` returns the first class directly using 
`AvailablePortFinder` ? Would it work when we use `AvailablePortFinder` 2 times 
from the same class to reserve 2 distinct ports (if make sense) ?




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




[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3555: Improve available port discovery in tests

2022-02-16 Thread GitBox


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



##
File path: 
integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/AvailablePortFinder.java
##
@@ -103,4 +124,19 @@ private static boolean isQuarkusReservedPort(int port) {
 }
 return false;
 }
+
+private static String getCallerClassName() {
+return 
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE)
+.walk(s -> s.map(StackWalker.StackFrame::getClassName)
+.filter(className -> 
!className.equals(AvailablePortFinder.class.getName()))
+.findFirst()

Review comment:
   So `findFirst()` returns the first class directly using 
AvailablePortFinder ? Would it work when we use AvailablePortFinder 2 times 
from the same class to reserve 2 distinct ports (if make sense) ?




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




[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3555: Improve available port discovery in tests

2022-02-16 Thread GitBox


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



##
File path: 
integration-tests-support/test-support/src/main/java/org/apache/camel/quarkus/test/AvailablePortFinder.java
##
@@ -103,4 +124,19 @@ private static boolean isQuarkusReservedPort(int port) {
 }
 return false;
 }
+
+private static String getCallerClassName() {
+return 
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE)
+.walk(s -> s.map(StackWalker.StackFrame::getClassName)
+.filter(className -> 
!className.equals(AvailablePortFinder.class.getName()))

Review comment:
   Filtering on className should be enough then.




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