Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource.adaptTo(TemplatedResource.class) = null #48

Open
HitmanInWis opened this issue Jul 25, 2024 · 2 comments
Open

Resource.adaptTo(TemplatedResource.class) = null #48

HitmanInWis opened this issue Jul 25, 2024 · 2 comments

Comments

@HitmanInWis
Copy link

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) to TemplatedResource.class appears to always result in null, preventing testing of code that relies on this capability, such as code calling com.adobe.cq.wcm.core.components.util.ComponentUtils#getEffectiveResource from WCM Core.

@stefanseifert
Copy link
Member

stefanseifert commented Aug 15, 2024

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.

@HitmanInWis
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants