Change Pax Probe location and sorroundings: an explorative adventure

17 views
Skip to first unread message

Massimo Bono

unread,
Apr 7, 2020, 12:39:17 PM4/7/20
to OPS4J
Hi all,

I'm exploring the pax-exam project because I want to change the location of the pax-exam probe generated (location in the file system and possibly its name): I'm using a karaf container to actually test and in that project in order to configure the probe itself I need to specify a method annotated with "@ProbeBuilder". By looking where the annotation "@ProbeBuilder" was actually used I discovered the methods `overwriteWithUserDefinition` and `createProbeBuilder` in `TestProbeBuilder` which , apparently, creates a probe implementation from a template (i.e., system.createProbe()). Looking at the method interface it seems that I just need to change the tem dir via the method `setTempDir`.

However, there is a problem: the associated method `getTempDir`, technically used to retrieve such a temp directory, is not used in the project at all (or at least, a search in my IDE gave no usage result).

Since I couldn't find usages of `getTempDir` method, I turn my attention on `system.createProbe()`. The only implementation I found was in `ReactorManager.createProbeBuilder`.
Here I noticed that the `tempDir` field of the pax-probe is populated by a temporary folder via the line `cache = createTemp(new File(work.getWorkingDirectory()));` whereas the `store` variable may represents an abstract storage location. Inspecting further the standard implementation of `TestProbeBuilderImpl.build()` seems to reveal that such a variable is responsible to decide where the probe is actually stored.

In particular, it seems that  the only implementation of `Store`, `TemporaryStore`, actually creates the probe in temp file via `createTempFile` and only then transfer it in a given location `TemporaryStore.getLocation()`. So changing the return value of such a method should do the trick.


My questions are:
 - what is the real purpose of `getTempDir` method in `TestProbeBuilder`? Is is really useless or it has an implicit need?
 - I've noticed that both the filename of such a probe and its symbolic name are hardcoded? Do you know any location in pax-exam (or karaf) where such hardcoded names are used? I ask this because if I can, I would like to change them :)
 - Is it indeed safe to change the instance of `Store` with another that allows me to change the actual probe-location?
 - If I want to add some javadoc documentation in some classes (like the totally undocumented `TestProbeBuilder`), what are the contribution rules? Can you give me a link to them so I can read them? On pax-exam site I couldn't find them, but maybe I'm just stupid :D

Thanks for any kind reply

Oliver Lietz

unread,
Apr 8, 2020, 2:54:15 PM4/8/20
to op...@googlegroups.com
On Tuesday, April 7, 2020 6:39:17 PM CEST Massimo Bono wrote:
> Hi all,

Hi Massimo,

> I'm exploring the pax-exam project because* I want to change the location
> of the pax-exam probe generated* (location in the file system and possibly
Why do you want to access the probe as file?
You can change the symbolic name via TestProbeBuilder.

Regards,
O.




Massimo Bono

unread,
Apr 10, 2020, 3:41:58 AM4/10/20
to OPS4J
Hi Oliver,

As for my use case, I want to relocate the file generated by pax (or copy it) in a specific folder so I can view its contents while debugging, nothing too big or fancy. I initially thought such a task would be easy to do. As for the symbolic name, my fault: yes I meant the probe name, not the symbolic name. Sorry for the confusion.
Reply all
Reply to author
Forward
0 new messages