We have some duplicated implementations of the following (non-exhaustive list, please add other relevant items if needed).
[ ] (test) get a random available port (see usages of co.elastic.apm.agent.testutils.TestPort and javax.net.ServerSocketFactory#createServerSocket(int, int, java.net.InetAddress))
[ ] (test) locate packaged artifacts from classpath/relative path (see co.elastic.apm.servlet.AgentFileAccessor#getTargetJar(java.lang.String, java.lang.String))
[ ] find path to the JVM binary (getJavaBinaryPath).
[ ] shutdown thread pools properly with co.elastic.apm.agent.util.ExecutorUtils, used both in tests and in production code.
Duplication is the the result of the following:
not every module has a dependency on apm-agent-core hence code reuse is limited
there is no root module that can host them
The goal would be to create one (or more) modules that provide
all the test-only features in the test scope so it can be reused in any other module testing
other items in the compile scope
no dependency on other agent modules, only common libraries (slf4j, junit, ...).
We have some duplicated implementations of the following (non-exhaustive list, please add other relevant items if needed).
co.elastic.apm.agent.testutils.TestPort
andjavax.net.ServerSocketFactory#createServerSocket(int, int, java.net.InetAddress)
)co.elastic.apm.servlet.AgentFileAccessor#getTargetJar(java.lang.String, java.lang.String)
)getJavaBinaryPath
).co.elastic.apm.agent.util.ExecutorUtils
, used both in tests and in production code.Duplication is the the result of the following:
apm-agent-core
hence code reuse is limitedThe goal would be to create one (or more) modules that provide
test
scope so it can be reused in any other module testingcompile
scope