Package org.springframework.web.portlet.context

Examples of org.springframework.web.portlet.context.StaticPortletApplicationContext


  }

  public void testInitApplicationContextWithNoViewNameSet() throws Exception {
    ParameterizableViewController controller = new ParameterizableViewController();
    try {
      controller.setApplicationContext(new StaticPortletApplicationContext());
      fail("should have thrown IllegalArgumentException");
    }
    catch (IllegalArgumentException ex) {
      // expected
    }
View Full Code Here


  }

  public void testSpecificBinderInitializingCommandProvidingFormController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MySpecificBinderInitializingCommandProvidingFormController.class));
        wac.refresh();
        return wac;
      }

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
View Full Code Here

  }

  public void testParameterDispatchingController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletContext(new MockPortletContext());
        RootBeanDefinition bd = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());
View Full Code Here

  }

  public void testTypeLevelParameterDispatchingController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletContext(new MockPortletContext());
        RootBeanDefinition bd = new RootBeanDefinition(MyTypeLevelParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        RootBeanDefinition bd2 = new RootBeanDefinition(MySpecialParameterDispatchingController.class);
        bd2.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller2", bd2);
        RootBeanDefinition bd3 = new RootBeanDefinition(MyOtherSpecialParameterDispatchingController.class);
        bd3.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller3", bd3);
        RootBeanDefinition bd4 = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd4.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller4", bd4);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());
View Full Code Here

    assertEnvironmentAwareInvoked(ctx, prodEnv);
  }

  @Test
  public void staticPortletApplicationContext() {
    StaticPortletApplicationContext ctx = new StaticPortletApplicationContext();

    assertHasStandardPortletEnvironment(ctx);

    registerEnvironmentBeanDefinition(ctx);

    ctx.setEnvironment(prodEnv);
    ctx.refresh();

    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodEnv);
  }
View Full Code Here

  }

  public void testInitApplicationContextWithNoViewNameSet() throws Exception {
    ParameterizableViewController controller = new ParameterizableViewController();
    try {
      controller.setApplicationContext(new StaticPortletApplicationContext());
      fail("should have thrown IllegalArgumentException");
    }
    catch (IllegalArgumentException ex) {
      // expected
    }
View Full Code Here

  public void testSpecificBinderInitializingCommandProvidingFormController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      @Override
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MySpecificBinderInitializingCommandProvidingFormController.class));
        wac.refresh();
        return wac;
      }
      @Override
      protected void render(ModelAndView mv, PortletRequest request, MimeResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
View Full Code Here

  public void testParameterDispatchingController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      @Override
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletContext(new MockPortletContext());
        RootBeanDefinition bd = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());
View Full Code Here

  public void testTypeLevelParameterDispatchingController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      @Override
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletContext(new MockPortletContext());
        RootBeanDefinition bd = new RootBeanDefinition(MyTypeLevelParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        RootBeanDefinition bd2 = new RootBeanDefinition(MySpecialParameterDispatchingController.class);
        bd2.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller2", bd2);
        RootBeanDefinition bd3 = new RootBeanDefinition(MyOtherSpecialParameterDispatchingController.class);
        bd3.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller3", bd3);
        RootBeanDefinition bd4 = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd4.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller4", bd4);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());
View Full Code Here

  @Test
  public void standardHandleMethodWithResources() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      @Override
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        StaticPortletApplicationContext wac = new StaticPortletApplicationContext();
        wac.setPortletConfig(getPortletConfig());
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyController.class));
        wac.refresh();
        return wac;
      }
    };
    portlet.init(new MockPortletConfig());
View Full Code Here

TOP

Related Classes of org.springframework.web.portlet.context.StaticPortletApplicationContext

Copyright © 2018 www.massapicom. 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.