Expand my Community achievements bar.

tim-schwalbe-NZ
tim-schwalbe-NZ
Offline
Type
  • All
  • Questions
  • Discussions
  • Ideas
  • Blogs
Filter by user contributions
  • 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");...

    Type

    Questions

    Views

    5.3K

    Likes

    0

    Replies

    0
  • 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",...

    Type

    Questions

    Views

    5.4K

    Likes

    0

    Replies

    0
  • 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...

    Type

    Questions

    Views

    5.3K

    Likes

    0

    Replies

    0
  • 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);

    Type

    Questions

    Views

    5.3K

    Likes

    0

    Replies

    0
  • 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...

    Type

    Questions

    Views

    5.3K

    Likes

    0

    Replies

    0
  • 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...

    Type

    Questions

    Views

    9.2K

    Likes

    0

    Replies

    13
  • 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>...

    Type

    Questions

    Views

    4.6K

    Likes

    0

    Replies

    0
  • 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>...

    Type

    Questions

    Views

    4.6K

    Likes

    2

    Replies

    0
  • 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

    Type

    Questions

    Views

    6.2K

    Likes

    3

    Replies

    2
  • 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...

    Type

    Questions

    Views

    750

    Likes

    0

    Replies

    0
Top badges earned by tim-schwalbe-NZ
Customize the badges you want to showcase on your profile