Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.StaticWebApplicationContext.registerSingleton()


    public void testHandler()
            throws Exception
    {
        StaticWebApplicationContext appContext = new StaticWebApplicationContext();
        appContext.registerSingleton("echo", EchoImpl.class, new MutablePropertyValues());

        webAnnotations.hasWebServiceAnnotation(EchoImpl.class);
        control.setReturnValue(true);
        webAnnotations.hasHandlerChainAnnotation(EchoImpl.class);
        control.setReturnValue(false);
View Full Code Here


    public void testNoAnnotation()
            throws Exception
    {
        StaticWebApplicationContext appContext = new StaticWebApplicationContext();
        appContext.registerSingleton("echo", EchoImpl.class, new MutablePropertyValues());

        webAnnotations.hasWebServiceAnnotation(EchoImpl.class);
        control.setReturnValue(false);

        control.replay();
View Full Code Here

    @Before
    public void setUp() throws Exception {
        SecurityContextHolder.getContext().setAuthentication(currentUser);
        StaticWebApplicationContext ctx = new StaticWebApplicationContext();
        ctx.registerSingleton("expressionHandler", DefaultWebSecurityExpressionHandler.class);
        ctx.registerSingleton("wipe", MockWebInvocationPrivilegeEvaluator.class);
        MockServletContext servletCtx = new MockServletContext();
        servletCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
        authorizeTag = new JspAuthorizeTag();
        authorizeTag.setPageContext(new MockPageContext(servletCtx, request, new MockHttpServletResponse()));
View Full Code Here

    @Before
    public void setUp() throws Exception {
        SecurityContextHolder.getContext().setAuthentication(currentUser);
        StaticWebApplicationContext ctx = new StaticWebApplicationContext();
        ctx.registerSingleton("expressionHandler", DefaultWebSecurityExpressionHandler.class);
        ctx.registerSingleton("wipe", MockWebInvocationPrivilegeEvaluator.class);
        MockServletContext servletCtx = new MockServletContext();
        servletCtx.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ctx);
        authorizeTag = new JspAuthorizeTag();
        authorizeTag.setPageContext(new MockPageContext(servletCtx, request, new MockHttpServletResponse()));
    }
View Full Code Here

        MockServletContext servletContext = new MockServletContext();
        servletContext.setAttribute(StaticWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

        context.setServletContext(servletContext);
        context.registerSingleton("listener", MockApplicationListener.class, null);
        context.refresh();

        MockHttpSession session = new MockHttpSession(servletContext);
        MockApplicationListener listener = (MockApplicationListener) context.getBean("listener");
View Full Code Here

*/
public class DelegatingVariableResolverTests extends TestCase {

  public void testDelegatingVariableResolver() {
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("bean1", TestBean.class, null);
    wac.registerSingleton("var1", TestBean.class, null);
    wac.refresh();
    TestBean bean1 = (TestBean) wac.getBean("bean1");

    // We need to override the getWebApplicationContext method here:
View Full Code Here

public class DelegatingVariableResolverTests extends TestCase {

  public void testDelegatingVariableResolver() {
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("bean1", TestBean.class, null);
    wac.registerSingleton("var1", TestBean.class, null);
    wac.refresh();
    TestBean bean1 = (TestBean) wac.getBean("bean1");

    // We need to override the getWebApplicationContext method here:
    // FacesContext and ExternalContext are hard to mock.
View Full Code Here

    assertEquals("val1", resolver.resolveVariable(null, "var1"));
  }

  public void testSpringBeanVariableResolver() {
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("bean1", TestBean.class, null);
    wac.registerSingleton("var1", TestBean.class, null);
    wac.refresh();
    TestBean bean1 = (TestBean) wac.getBean("bean1");
    TestBean var1 = (TestBean) wac.getBean("var1");
View Full Code Here

  }

  public void testSpringBeanVariableResolver() {
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("bean1", TestBean.class, null);
    wac.registerSingleton("var1", TestBean.class, null);
    wac.refresh();
    TestBean bean1 = (TestBean) wac.getBean("bean1");
    TestBean var1 = (TestBean) wac.getBean("var1");

    // We need to override the getWebApplicationContext method here:
View Full Code Here

  public void testDelegatingFilterProxy() throws ServletException, IOException {
    ServletContext sc = new MockServletContext();

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.registerSingleton("targetFilter", MockFilter.class);
    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.