BRUT test framework reading and processing an image reference

Hi all,

for my client using BRXM 14.x and BRUT 3.0.0, I’m implementing a unit test that has a document with a reference to an image.
The problem is that the resulting bean returns NULL when I call the get-method.

With a lot of debugging deep into the code, I found that the logic in BRUT is treating the reference field as a string, in stead of a reference. In class JcrContentProcessor#applyProperties(...) the method isReferenceTypeProperty(modelProperty) is called, which returns FALSE.

Which is strange, because in my yaml file the field is defined as:

     /univecommon:image:
      jcr:primaryType: hippogallerypicker:imagelink
      hippo:docbase: c62ef221-4a04-49b3-95af-8971cd9cea18
      hippo:facets: []
      hippo:modes: []
      hippo:values: []

As I understand, this should be a ValueType#REFERENCE and the method should return TRUE.
What am I missing here?

Thanks in advance,
Dennis

Hi Dennis,

Could it be that the uuid the docbase is referring to is not imported? I’ll try to reproduce it

Hi Baris,

I did a intensive debug session last friday and found that the image is imported in the JCR. In the YAML files the reference is the same as the uuid of the image. Pretty sure the in-memory JCR uuid values where the same as well.

Hi Dennis,

Just reproduced it, although I don’t think this is related to the JcrContentProcessor. I fixed it locally in my test. Here’s what I think was going wrong:
In org.bloomreach.forge.brut.components.AbstractRepoTest#registerBaseNodeTypes BRUT has:

 registerNodeType("hippogallerypicker:imagelink");

whereas this should have been:

registerNodeType("hippogallerypicker:imagelink", "hippo:facetselect");

You see, the super type for the imagelink was not registered therefore the objectconverter didn’t know which bean class to use for that type. I can cut another release with this change and let you know here.
If you don’t want to wait (or actually test this out) of course you can override the org.bloomreach.forge.brut.components.AbstractRepoTest#registerBaseNodeTypes with this particular change(while keeping everything else of course).

I hope this fixes it!

cool, thanks. Quick find!
I’ll let you know what helps for me, but a fix is always good :slight_smile:

I tried to implement an “unregister” (via NodeManager) but I got this message:

org.bloomreach.forge.brut.components.exception.SetupTeardownException: The check for the existence of content using the given node type is not yet implemented, so to guarantee repository consistency the request to unregister the type is denied. Contributions to implement this feature would be welcome! To restore the broken behavior of previous Jackrabbit versions where this check was simply skipped, please set the disableCheckForReferencesInContentException system property to true.

Next option is to override the #registerBaseNodeTypes method. Which worked!

1 Like

Released BRUT version 3.0.1 , thanks for reporting!