本文整理汇总了Java中io.wcm.testing.mock.aem.junit.AemContextCallback类的典型用法代码示例。如果您正苦于以下问题:Java AemContextCallback类的具体用法?Java AemContextCallback怎么用?Java AemContextCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AemContextCallback类属于io.wcm.testing.mock.aem.junit包,在下文中一共展示了AemContextCallback类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContext
import io.wcm.testing.mock.aem.junit.AemContextCallback; //导入依赖的package包/类
/**
* Creates a new instance of {@link AemContext}, adds the project specific Sling Models and loads test data from the JSON file
* "/test-content.json" in the current classpath
*
* @param testBase Prefix of the classpath resource to load test data from. Optional, can be null. If null, test data will be
* loaded from /test-content.json
* @param contentRoot Path to import the JSON content to
* @return New instance of {@link AemContext}
*/
public static AemContext createContext(final String testBase, final String contentRoot) {
return new AemContext(
(AemContextCallback) context -> {
context.registerService(FormStructureHelperFactory.class, resource -> null);
context.registerService(ImplementationPicker.class, new ResourceTypeBasedResourcePicker());
if (testBase != null) {
if (StringUtils.isNotEmpty(testBase)) {
context.load().json(testBase + TEST_CONTENT_JSON, contentRoot);
} else {
context.load().json(TEST_CONTENT_JSON, contentRoot);
}
}
context.registerInjectActivateService(new MockAdapterFactory());
},
ResourceResolverType.JCR_MOCK
);
}
示例2: newAemContext
import io.wcm.testing.mock.aem.junit.AemContextCallback; //导入依赖的package包/类
public static AemContext newAemContext(AemContextCallback callback) {
return new AemContext(new SetUpCallback(callback));
}
示例3: SetUpCallback
import io.wcm.testing.mock.aem.junit.AemContextCallback; //导入依赖的package包/类
public SetUpCallback(AemContextCallback testCallback) {
this.testCallback = testCallback;
}