當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。