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


Java RequiredCache类代码示例

本文整理汇总了Java中org.springframework.extensions.webscripts.Description.RequiredCache的典型用法代码示例。如果您正苦于以下问题:Java RequiredCache类的具体用法?Java RequiredCache怎么用?Java RequiredCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RequiredCache类属于org.springframework.extensions.webscripts.Description包,在下文中一共展示了RequiredCache类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMockedDescription

import org.springframework.extensions.webscripts.Description.RequiredCache; //导入依赖的package包/类
/**
 * Helper method to get mocked description class
 * 
 * @return  {@link DescriptionExtension}    mocked description class
 */
protected Description getMockedDescription()
{
    Description mockedDescription = mock(Description.class);
    doReturn(mock(RequiredCache.class)).when(mockedDescription).getRequiredCache();
    return mockedDescription;
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:12,代码来源:BaseWebScriptUnitTest.java

示例2: getMockedContainer

import org.springframework.extensions.webscripts.Description.RequiredCache; //导入依赖的package包/类
/**
 * Helper method to get mocked container object.
 *  
 * @param template              classpath location of webscripts ftl template
 * @return {@link Container}    mocked container 
 */
protected Container getMockedContainer(String template) throws Exception
{
    FormatRegistry mockedFormatRegistry = mock(FormatRegistry.class);
    doReturn("application/json").when(mockedFormatRegistry).getMimeType(anyString(), anyString());
    
    ScriptProcessorRegistry mockedScriptProcessorRegistry = mock(ScriptProcessorRegistry.class);
    doReturn(null).when(mockedScriptProcessorRegistry).findValidScriptPath(anyString());
    
    TemplateProcessorRegistry mockedTemplateProcessorRegistry = mock(TemplateProcessorRegistry.class);
    doReturn(template).when(mockedTemplateProcessorRegistry).findValidTemplatePath(anyString());
    
    FTLTemplateProcessor ftlTemplateProcessor = new FTLTemplateProcessor()
    {
        @Override
        protected TemplateLoader getTemplateLoader()
        {
            return new ClassTemplateLoader(getClass(), "/");
        }
    };
    ftlTemplateProcessor.init();        
    
    doReturn(ftlTemplateProcessor).when(mockedTemplateProcessorRegistry).getTemplateProcessor(anyString());
    
    Container mockedContainer = mock(Container.class);
    doReturn(mockedFormatRegistry).when(mockedContainer).getFormatRegistry();
    doReturn(mockedScriptProcessorRegistry).when(mockedContainer).getScriptProcessorRegistry();
    doReturn(mockedTemplateProcessorRegistry).when(mockedContainer).getTemplateProcessorRegistry();
    
    Map<String, Object> containerTemplateParameters = new HashMap<>(5);
    containerTemplateParameters.put("jsonUtils", new JSONUtils());
    containerTemplateParameters.put("people", getMockedPeopleObject());
    doReturn(containerTemplateParameters).when(mockedContainer).getTemplateParameters();

    SearchPath mockedSearchPath = mock(SearchPath.class);
    doReturn(false).when(mockedSearchPath).hasDocument(anyString());
    doReturn(mockedSearchPath).when(mockedContainer).getSearchPath();
    
    // setup description
    Description mockDescription = mock(Description.class);
    doReturn(mock(RequiredCache.class)).when(mockDescription).getRequiredCache();
    
    return mockedContainer;
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:50,代码来源:BaseWebScriptUnitTest.java


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