requestContext = new MockMarinerServletRequestContext(servletRequest, new MockHTTPServletResponse());
Project project = new RuntimeProjectMock("projectMock", expectations);
// requestContext.pushProject(project);
EnvironmentContext environmentContext = new ServletEnvironmentContext(
requestContext);
ContextInternals.setEnvironmentContext(requestContext,
environmentContext);
ExpressionFactory expressionFactory = ExpressionFactory.getDefaultInstance();
ExpressionContext expressionContext =
expressionFactory.createExpressionContext(
null,
NamespaceFactory.getDefaultInstance()
.createPrefixTracker());
expressionContext.setProperty(MarinerRequestContext.class,
requestContext, false);
final CurrentProjectProviderMock projectProviderMock =
new CurrentProjectProviderMock("projectProviderMock",
expectations);
projectProviderMock.expects.getCurrentProject().returns(project).any();
// Add a project provider in for resolving relative policy expressions
// without a project into absolute IDs containing a project.
expressionContext.setProperty(CurrentProjectProvider.class,
projectProviderMock, false);
environmentContext.setExpressionContext(expressionContext);
return requestContext;
}