# BRUT test framework reading and processing an image reference

**URL:** <https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [October 19, 2020, 7:09am UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187 "2020-10-19T07:09:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [October 19, 2020, 7:09am UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/1 "2020-10-19T07:09:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bcanvural](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/bcanvural/32/235_2.png) [@bcanvural](https://community.bloomreach.com/u/bcanvural)\
**Post date:** [October 19, 2020, 8:59am UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/2 "2020-10-19T08:59:27Z")

</div>

Hi Dennis,

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

---

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [October 19, 2020, 11:40am UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/3 "2020-10-19T11:40:50Z")

</div>

> [@bcanvural](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![bcanvural](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/bcanvural/32/235_2.png) [@bcanvural](https://community.bloomreach.com/u/bcanvural)\
**Post date:** [October 19, 2020, 12:09pm UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/4 "2020-10-19T12:09:21Z")

</div>

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:

```java
 registerNodeType("hippogallerypicker:imagelink");

```

whereas this should have been:

```java
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!

---

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [October 19, 2020, 12:57pm UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/5 "2020-10-19T12:57:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dennis\_Vonk](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/dennis_vonk/32/369_2.png) [@Dennis\_Vonk](https://community.bloomreach.com/u/Dennis_Vonk)\
**Post date:** [October 19, 2020, 4:01pm UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/6 "2020-10-19T16:01:43Z")

</div>

> [@bcanvural](#):
>
> `, "hippo:facetselect"`

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!

---

<div class="post-metadata">

**Author:** ![bcanvural](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/bcanvural/32/235_2.png) [@bcanvural](https://community.bloomreach.com/u/bcanvural)\
**Post date:** [October 20, 2020, 12:21pm UTC](https://community.bloomreach.com/t/brut-test-framework-reading-and-processing-an-image-reference/2187/7 "2020-10-20T12:21:50Z")

</div>

Released BRUT version 3.0.1 , thanks for reporting!
