Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext


        menuLoader = new MenuManagerImpl();
        menuLoader.menuPath = "web/WEB-INF/resources/menu/menu.xml";
        DES3CiphererDecipherer c = new DES3CiphererDecipherer();
        c.init();
        menuLoader.cipherer = c;
        MockServletContext servletContext = new MockServletContext();
        servletContext.setContextPath("/test");
        menuLoader.setServletContext(servletContext);
        menuLoader.init();
    }
View Full Code Here


        doAssertions(xfire);
    }
      
    public void testConfigLoaderWithParentContext() throws Exception
    {
      ServletContext servletCtx = new MockServletContext();
      ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext(new String[] {"org/codehaus/xfire/spring/xfire.xml"});

        XFireConfigLoader configLoader = new XFireConfigLoader();
        XFire xfire = configLoader.loadConfig("META-INF/xfire/sservices.xml", appCtx);
View Full Code Here

        });
    }

    @Test
    public void showForm() throws Exception {
        controller.setServletContext(new MockServletContext());
        assertEquals("No jsp in WEB-INF", "crud/template", controller.showForm("stubs.TrivialDomainEntity", null, null, new ModelMap(), new MockHttpSession()));
        controller.setServletContext(new MockServletContext("web", new FileSystemResourceLoader()));
        assertEquals("JSP in WEB-INF", "crud/demoapp/domain/book", controller.showForm("demoapp.domain.Book", null, null, new ModelMap(), new MockHttpSession()));
    }
View Full Code Here

    buildCfg();
    // initDispatcher(null);
  }

  protected Dispatcher initDispatcher(Map<String, String> params) {
    Dispatcher du = StrutsTestCaseHelper.initDispatcher(new MockServletContext(), params);
    configurationManager = du.getConfigurationManager();
    configuration = configurationManager.getConfiguration();
    container = configuration.getContainer();
    return du;
  }
View Full Code Here

   private ServletContext mockServletContext(
           ResteasyProviderFactory providerFactory,
           Registry registry,
           Dispatcher dispatcher)
   {
      MockServletContext context = new MockServletContext();

      if (providerFactory != null)
         context.setAttribute(ResteasyProviderFactory.class.getName(),providerFactory);

      if (registry != null)
         context.setAttribute(Registry.class.getName(),registry);

      if (dispatcher != null)
         context.setAttribute(Dispatcher.class.getName(),dispatcher);

      return context;
   }
View Full Code Here

    ServletServiceAdapterComponent comp =
      (ServletServiceAdapterComponent)initedAdapters.get(configFile);
   
    if (comp == null) {
      servlet.setConfFile(configFile);
      servlet.init(new MockServletConfig(new MockServletContext()));
     
      initedAdapters.put(configFile, comp);
     
      return servlet.getBuiltComponent();
    }
View Full Code Here

  protected HttpServletRequest request;
  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
View Full Code Here

  protected HttpServletRequest request;
  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
View Full Code Here

  protected Entry<ConfigToken<?>, Object> entry;
 
  @Before
  public void setup() {
    processor = getProcessor();
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, new Context(new MockFilterConfig()));
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
View Full Code Here

  protected HttpServletRequest request;
  protected Map<ConfigToken<?>, Object> confToBeApplied;

  @Before
  public void setup() {
    MockServletContext mockServletContext = new MockServletContext();
    MockPageContext mockPageContext = new MockPageContext(mockServletContext);
    request = (HttpServletRequest) mockPageContext.getRequest();
    confToBeApplied = new HashMap<ConfigToken<?>, Object>();
    tableConfiguration = new TableConfiguration(confToBeApplied, null, request);
    columnConfiguration = new ColumnConfiguration();
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockServletContext

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.