Yes I know it works, but the question is how to inject the Reference during unit tests?@Testpublic void testDoGetForJson() throws IOException, WCMException { IRssFeed rssFeed = new RssFeedImpl(); context.registerInjectActivateService(rssFeed); context.requestPathInfo().setSelectorString("rss");...
Hi, I think you have misunderstood me.I want to inject the RSSImpl inside the servlet not in the test. @Slf4jpublic class RssFeedServlet extends SlingSafeMethodsServlet { @Reference IRssFeed rssFeed; private final SimpleDateFormat ISO_FORMAT = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z",...
I think it's something wrong in the pom.xmlWhen I do this:IRssFeed rssFeed = new RssFeedImpl();context.registerInjectActivateService(rssFeed);I got this error, so the plugin does not work correctly and does not create the manifest for it.1232 [main] INFO org.apache.jackrabbit.oak.plugins.index.Index...
It works when deployed to an aem instance. It just don't get injected during the test.And its also in the context after doing: IRssFeed rssFeed = new RssFeedImpl();context.registerService(rssFeed);
Here is my pom file:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersio...
Hello, hopefully the last question this week.I inject my Service in the servlet with:@ReferenceIRssFeed rssFeed;The question is now how to do it with AEM Context.@Testpublic void testDoGetForJson() throws IOException, WCMException { context.registerService(IRssFeed.class, new RssFeedImpl());}I als...
I also solved this issue, it was an old version of commons-io in mail jet. After excluding it the error disappeared.you can look at the dep tree with: mvn dependency:tree -Dverbose<dependency> <groupId>com.mailjet</groupId> <artifactId>mailjet-client</artifactId> <version>4.0.6-SNAPSHOT</version>...
I found this image which seems to point to use the right Mock ResourceResolverBut after adding the following dep to my pom.xml I get an error. <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId> <version>...
Hello, I try to adapt a parsys to Node, it does work with real AEM instance, but with mocking it returns null as subPageNode. As you see in debug mode the par is there.Can any explain why this happens?Br,Tim
Hello I found a solution.It is very easy to load the content from AEM as a JSON and load it in your test case.Go to your Page and add the extension: press-releases.html.infinity.jsonOnce you have your JSON tree structure you can load it:context.load().json("/press-release-test-data/pressrelease1-tes...