use of io.wcm.testing.mock.aem.junit.AemContext in project acs-aem-commons by Adobe-Consulting-Services.
the class SyntheticWorkflowSessionTest method setUp.
@Before
public void setUp() throws Exception {
context = new AemContext(ResourceResolverType.JCR_MOCK);
ResourceResolver resourceResolver = context.resourceResolver();
session = SyntheticWorkflowSession.createSyntheticWorkflowSession(new SyntheticWorkflowRunnerImpl(), resourceResolver.adaptTo(Session.class));
SyntheticWorkflowData workflowData = new SyntheticWorkflowData("JCR_PATH", "/content/test");
workflowData.getMetaDataMap().put("cat", "meow");
workflowData.getMetaDataMap().put("bird", "ka-kaw");
syntheticWorkflow = new SyntheticWorkflow("test", workflowData);
}
use of io.wcm.testing.mock.aem.junit.AemContext in project aem-core-cif-components by adobe.
the class TestContext method buildAemContextInternal.
private static AemContextBuilder buildAemContextInternal() {
return new AemContextBuilder().resourceResolverType(ResourceResolverType.JCR_MOCK).<AemContext>afterSetUp(context -> {
// register commonly required ootb services
context.registerService(PageManagerFactory.class, rr -> context.pageManager());
XSSAPI xssApi = mock(XSSAPI.class);
when(xssApi.filterHTML(Mockito.anyString())).then(i -> i.getArgumentAt(0, String.class));
context.registerService(XSSAPI.class, xssApi);
});
}
use of io.wcm.testing.mock.aem.junit.AemContext in project acs-aem-commons by Adobe-Consulting-Services.
the class SynthesizedSlingHttpServletRequestTest method setUp.
@Before
public void setUp() throws Exception {
context = new AemContext(ResourceResolverType.JCR_MOCK);
resourceResolver = context.resourceResolver();
synthesizedSlingHttpServletRequest = new SynthesizedSlingHttpServletRequest(context.request());
}
use of io.wcm.testing.mock.aem.junit.AemContext in project acs-aem-commons by Adobe-Consulting-Services.
the class RequestPathInfoWrapperTest method setUp.
@Before
public void setUp() throws Exception {
context = new AemContext(ResourceResolverType.JCR_OAK);
context.load().json(getClass().getResourceAsStream("RequestPathInfoWrapperContent.json"), TEST_PATH);
resourceResolver = context.resourceResolver();
requestPathInfoWrapper = RequestPathInfoWrapper.createRequestPathInfoWrapper(context.requestPathInfo(), resourceResolver.getResource(TEST_PATH));
}
use of io.wcm.testing.mock.aem.junit.AemContext in project aem-core-cif-components by adobe.
the class TestContext method buildAemContextInternal.
private static AemContextBuilder buildAemContextInternal() {
return new AemContextBuilder().resourceResolverType(ResourceResolverType.JCR_MOCK).<AemContext>afterSetUp(context -> {
// register commonly required ootb services
context.registerService(PageManagerFactory.class, rr -> context.pageManager());
context.registerService(Externalizer.class, new MockExternalizer());
context.registerInjectActivateService(new DefaultPathProcessor());
XSSAPI xssApi = mock(XSSAPI.class);
when(xssApi.filterHTML(Mockito.anyString())).then(i -> i.getArgumentAt(0, String.class));
context.registerService(XSSAPI.class, xssApi);
// register commonly used cif services
context.registerInjectActivateService(new SpecificPageStrategy());
context.registerInjectActivateService(new UrlProviderImpl());
});
}
Aggregations