当前位置: 首页>>代码示例>>Java>>正文


Java AemContextCallback类代码示例

本文整理汇总了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
    );
}
 
开发者ID:Adobe-Marketing-Cloud,项目名称:aem-core-wcm-components,代码行数:27,代码来源:CoreComponentTestContext.java

示例2: newAemContext

import io.wcm.testing.mock.aem.junit.AemContextCallback; //导入依赖的package包/类
public static AemContext newAemContext(AemContextCallback callback) {
  return new AemContext(new SetUpCallback(callback));
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:4,代码来源:AppAemContext.java

示例3: SetUpCallback

import io.wcm.testing.mock.aem.junit.AemContextCallback; //导入依赖的package包/类
public SetUpCallback(AemContextCallback testCallback) {
  this.testCallback = testCallback;
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:4,代码来源:AppAemContext.java


注:本文中的io.wcm.testing.mock.aem.junit.AemContextCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。