本文整理汇总了Java中org.springframework.extensions.webscripts.DeclarativeWebScript类的典型用法代码示例。如果您正苦于以下问题:Java DeclarativeWebScript类的具体用法?Java DeclarativeWebScript怎么用?Java DeclarativeWebScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeclarativeWebScript类属于org.springframework.extensions.webscripts包,在下文中一共展示了DeclarativeWebScript类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: executeWebScript
import org.springframework.extensions.webscripts.DeclarativeWebScript; //导入依赖的package包/类
/**
* Execute web script and return result as a string.
*
* @param parameters map of all parameter values
* @return {@link String} result of web script
*/
protected String executeWebScript(Map<String, String> parameters, String content) throws Exception
{
DeclarativeWebScript webScript = getWebScript();
String template = getWebScriptTemplate();
// initialise webscript
webScript.init(getMockedContainer(template), getMockedDescription());
// execute webscript
WebScriptResponse mockedResponse = getMockedWebScriptResponse();
webScript.execute(getMockedWebScriptRequest(webScript, parameters, content), mockedResponse);
// return results
return mockedResponse.getWriter().toString();
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:22,代码来源:BaseWebScriptUnitTest.java
示例2: getMockedWebScriptRequest
import org.springframework.extensions.webscripts.DeclarativeWebScript; //导入依赖的package包/类
/**
* Helper method to get the mocked web script request.
*
* @param webScript declarative web script
* @param parameters web script parameter values
* @return {@link WebScriptRequest} mocked web script request
*/
@SuppressWarnings("rawtypes")
protected WebScriptRequest getMockedWebScriptRequest(DeclarativeWebScript webScript, final Map<String, String> parameters, String content) throws Exception
{
Match match = new Match(null, parameters, null, webScript);
org.springframework.extensions.webscripts.Runtime mockedRuntime = mock(org.springframework.extensions.webscripts.Runtime.class);
WebScriptRequest mockedRequest = mock(WebScriptRequest.class);
doReturn(match).when(mockedRequest).getServiceMatch();
doReturn(mockedRuntime).when(mockedRequest).getRuntime();
if (content != null && !content.isEmpty())
{
Content mockedContent = mock(Content.class);
doReturn(content).when(mockedContent).getContent();
doReturn(mockedContent).when(mockedRequest).getContent();
}
String [] paramNames = (String[])parameters.keySet().toArray(new String[parameters.size()]);
doReturn(paramNames).when(mockedRequest).getParameterNames();
doAnswer(new Answer()
{
@Override
public Object answer(InvocationOnMock invocation) throws Throwable
{
String paramName = (String)invocation.getArguments()[0];
return parameters.get(paramName);
}
}).when(mockedRequest).getParameter(anyString());
doReturn(new String[0]).when(mockedRequest).getHeaderNames();
doReturn("json").when(mockedRequest).getFormat();
return mockedRequest;
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:43,代码来源:BaseWebScriptUnitTest.java
示例3: getWebScript
import org.springframework.extensions.webscripts.DeclarativeWebScript; //导入依赖的package包/类
/**
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript()
*/
@Override
protected DeclarativeWebScript getWebScript()
{
return webScript;
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:9,代码来源:HoldPostUnitTest.java
示例4: getWebScript
import org.springframework.extensions.webscripts.DeclarativeWebScript; //导入依赖的package包/类
/**
* @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScript()
*/
@Override
protected DeclarativeWebScript getWebScript()
{
return webScript;
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:9,代码来源:RecordedVersionConfigGetUnitTest.java
示例5: getWebScript
import org.springframework.extensions.webscripts.DeclarativeWebScript; //导入依赖的package包/类
/**
* @return declarative webscript
*/
protected abstract DeclarativeWebScript getWebScript();
开发者ID:Alfresco,项目名称:records-management-old,代码行数:5,代码来源:BaseWebScriptUnitTest.java
注:本文中的org.springframework.extensions.webscripts.DeclarativeWebScript类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论