Convert camel-2.20 Groovy tests to Java#8813
Conversation
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.context.ConfigurableApplicationContext; | ||
|
|
||
| public class SingleServiceCamelTest extends RetryOnAddressAlreadyInUse { |
There was a problem hiding this comment.
In tests that use http server and need a client to test it with we usually use https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/junit/http/AbstractHttpServerUsingTest.java Up to you to decide whether it would help you.
There was a problem hiding this comment.
thank you for this recommendation, i was able to remove the additional dependency on okhttp by switching to this
…race relation assertion, remove retryonaddressalreadyinuse
…race relation assertion, remove retryonaddressalreadyinuse
| span.hasName("input") | ||
| .hasKind(SpanKind.INTERNAL) | ||
| .hasNoParent() | ||
| .hasAttribute(stringKey("camel.uri"), "direct://input"), |
There was a problem hiding this comment.
It would be better to use hasAttributesSatisfyingExactly instead of hasAttribute, groovy tests also verify that all attributes are asserted.
hasAttributesSatisfyingExactly(equalTo(stringKey("camel.uri"), "direct://input")))
There was a problem hiding this comment.
thank you for the recommendation, I have updated accordingly
| span.hasName("GET /api/{module}/unit/{unitId}") | ||
| .hasKind(SpanKind.SERVER) | ||
| .hasParent(trace.getSpan(1)) | ||
| .hasAttributesSatisfying( |
There was a problem hiding this comment.
if possible use hasAttributesSatisfyingExactly
|
@jaydeluca looks good. See if you can replace the usages of |
…ests, update all hasAttributes to hasAttributesSatisfyingExactly
|
thank you @laurit and @mateuszrzeszutek for taking the time to review and provide guidance, I appreciate it |
Related to #7195
This PR converts the primary test package and decorators from groovy to Java for the camel-2.20 instrumentation.
A few notes:
Thank you for your consideration of my contribution