Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

subramanya_75
Community profile subramanya_75 Level 1
Job title here
Location here
1 BADGE
Level 1

Level 1

Learn more
Joined the community 06-11-2020 12:18:23 PM
Offline
Top badges earned by subramanya_75
Customize the badges you want to showcase on your profile
Re: Need Help with creating a stub for workflow model in...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
One last issue I am facing at the end of the servlet doget method I am closing all of the resoure resolver sessions like beow try{ json.addProperty("success", true); json.addProperty("destination_path", path); response.setStatus(SlingHttpServletResponse.SC_OK); response.setContentType("application/json"); response.getWriter().write(new Gson().toJson(json)); log.debug("TrashcanServlet Response 200 OK with response text: {} ", new Gson().toJson(json) ); } catch (TrashcanException e) { log.error("E...

Views

60

Likes

0

Replies

0
Need Help with creating a stub for workflow model in the Junit test case
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
This is my servlet that is invoking a workflow and it is using a workflow model.I am unable to create a stub for the workflow model in the testcase for the servlet.I am using a mock workflow model but it is returning null or throwing exception.The servlet code that starts workflow provided below. WorkflowSession wfSession = workflowService.getWorkflowSession(session); WorkflowModel wfModel = wfSession.getModel("/var/workflow/models/dam/dam_download_asset");WorkflowData wfData = wfSession.newWork...

Views

132

Likes

0

Replies

2
Re: Junit5 test case for accesscontrolManager functionali...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
Hi @Jörg_Hoh, There is a solution provided here for this issue here : [SLING-7195] Sling Mock Oak not working with AEM uber-jar 6.3.0 - ASF JIRA (apache.org)They have provided a sample zip package file which I could download and verify.But this sample package uses uses JUNIT 4 and not JUNIT 5.Below is the entry to be made to my pom.xml as per the provided solution there( this is a working solution that uses JUNIT4) junit junit 4.12 org.apache.sling org.apache.sling.testing.sling-mock 2.2.12 ...

Views

168

Likes

0

Replies

0
Re: Junit5 test case for accesscontrolManager functionali...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
Hi @Jörg_Hoh,I modified the context as private final AemContext aemContext = new AemContext(ResourceResolverType.JCR_OAK);I am getting this below exception:java.lang.RuntimeException: Unable to initialize JCR_OAK resource resolver factory: Unable to instantiate resourcer resolver: org.apache.sling.testing.mock.sling.oak.OakMockResourceResolverAdapter. Make sure this maven dependency is included: org.apache.sling:org.apache.sling.testing.sling-mock-oak I am using the Archetype 25 and below are en...

Views

203

Likes

0

Replies

0
Re: Junit5 test case for accesscontrolManager functionali...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
Everything works when code written in this test class.Problem is occcurs when session.getAccessControlmanager() is executed in the doGet() method in the servlet for which I am writing this test case. This is the code complete test case class for the servlet.( everything works in the testcase, but not when same code executed in servlet.class TrashcanServletTest {private final AemContext aemContext = new AemContext(ResourceResolverType.JCR_MOCK);//public final SlingContext aemContext = new SlingCo...

Views

162

Likes

0

Replies

0
Re: Junit5 test case for accesscontrolManager functionali...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
I modified the code as per belowat class level I have add a class level mock like below@MockSession session; Then in the test case wrapped this session using the SessionWrapper provided in URL mentioned earlier. below code works SessionWrapper wrapper = new SessionWrapper(session)assertSame("getAccessControlManager", accessControlManager, wrapper.getAccessControlManager()); final AccessControlManager accessControlManager = session.getAccessControlManager(); final Privilege moveToTrashCanPrivileg...

Views

179

Likes

0

Replies

0
Junit5 test case for accesscontrolManager functionality throws excpeption
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
I am reposting this question as my previous question was closed by mistake as resolved.This test case throws unsupported exception when using the JUNIT5 version as per belowI am instantiating the aem context at class level with below code@ExtendWith({ AemContextExtension.class, MockitoExtension.class })class TrashcanServletTest { private final AemContext aemContext = new AemContext(ResourceResolverType.JCR_MOCK); Testcase method is provided here : void testDoGetSlingHttpServletRequestSlingHttpSe...

Views

226

Likes

0

Replies

5
Re: Junit5 test case for accesscontrolManager functionali...
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
Hi @Vijayalaksmi_S,I have marked the correct answer by mistake.I have tried the method you have informed unfortunately it does not work.I need to know if anyone got this issue and ableto resolve this issue.The provided answer may work on JUNIT4 but not when using JUNIT5.I request some one to reopen this question and get this resolved

Views

196

Likes

0

Replies

0
Junit5 test case for accesscontrolManager functionality throws excpeption
Avatar
Validate 1
Level 1
subramanya_75
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
subramanya_75
- Adobe Experience Manager
This test case throws unsupported exception when using the JUNIT5 version as per belowI am instantiating the aem context at class level with below code@ExtendWith({ AemContextExtension.class, MockitoExtension.class })class TrashcanServletTest { private final AemContext aemContext = new AemContext(ResourceResolverType.JCR_MOCK); Testcase method is provided here : void testDoGetSlingHttpServletRequestSlingHttpServletResponse() throws UnsupportedRepositoryOperationException, RepositoryException { a...

Views

218

Likes

0

Replies

6