Open HitmanInWis opened 2 months ago
true - the problem that it's not only com.day.cq.wcm.core.impl.TemplatedResourceAdapterFactory
is missing, but the whole implementation of the interface com.day.cq.wcm.api.TemplatedResource
as well - the related impl classes are not part of the API JAR. so it is more effort to reimplement all the contained functionality.
it would be great if you can come up with a PR.
Understood. Unfortunately I likely wont have time to spend creating a full-on implementation of this adapter (as you alluded to, it's a decent amount of code to produce). For now I've solved in my local implementation with a bit of a hack that wraps the templated resource (but doesn't actually merge it together with the content resource) and that works for my tests, but I don't think that would suffice for this library.
If this issue is simply "yep, it's an issue, but no one has time to fix so we're going to close" I understand.
AEM comes with
com.day.cq.wcm.core.impl.TemplatedResourceAdapterFactory
that allows you to take a current resource that is linked to a template, and merge in the template structure items in order to get a full picture of the resource and its properties. Using AEM Mock, however, adapting a resource (or request) toTemplatedResource.class
appears to always result in null, preventing testing of code that relies on this capability, such as code callingcom.adobe.cq.wcm.core.components.util.ComponentUtils#getEffectiveResource
from WCM Core.