Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext


  @Before
  public void setUp()
  {
    request=new MockHttpServletRequest();
    response=new MockHttpServletResponse();
    application=new MockServletContext();
   
    webObjectSource=new DefaultWebObjectSource(request, response, application, new WebGenericConverter());
  }
View Full Code Here


  private Map<String, String> servletInitParameters;
 
  @Before
  public void setUp()
  {
    servletContext=new MockServletContext();
    servletInitParameters=new HashMap<String, String>();
    servletInitParameters.put(WebConstants.ServletInitParams.SOYBEAN_MILK_CONFIG, mySoybeanMilkFile);
  }
View Full Code Here

  {
    GenericConvertException re=null;
   
    try
    {
      converter.convert(new MockServletContext(), JavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
View Full Code Here

      {
        return (T)bean;
      }
    });
   
    JavaBean re=converter.convert(new MockServletContext(), JavaBean.class);
   
    Assert.assertTrue( (re == bean) );
  }
View Full Code Here

            }
        }
    }

    private ServletContext createServletContext() {
        MockServletContext ctx = new MockServletContext();
        File testDataDir = null;
        ;

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();

        Resource testDataResource = context.getResource("testdata");
        if (testDataResource == null)
            throw new RuntimeException("Can't find test data.");

        try {
            testDataDir = testDataResource.getFile();

            File services = new File(testDataDir, "services.xml");
            if (!services.exists())
                throw new FileNotFoundException(services.getPath());

            ctx.addInitParameter("GEOSERVER_DATA_DIR", testDataDir.getAbsolutePath());
            ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        } catch (IOException ex) {
            LOGGER.severe("Error in test files: " + ex.getMessage());
            throw new RuntimeException("Error in test files", ex);
        }
View Full Code Here

    public HibGeoServerTestApplicationContext(String[] configLocation, String dataPath)
            throws BeansException {
        super(configLocation, false);

        MockServletContext ctx = new MockServletContext();
        ctx.addInitParameter("GEOSERVER_DATA_DIR", dataPath);
        ctx.addInitParameter("serviceStrategy", "PARTIAL-BUFFER2");

        this.servletContext = ctx;
    }
View Full Code Here

    protected void setupAfterInitDispatcher(Dispatcher dispatcher) {
        // empty by default
    }

    protected void initServletMockObjects() {
        servletContext = new MockServletContext(resourceLoader);
        response = new MockHttpServletResponse();
        request = new MockHttpServletRequest();
        pageContext = new MockPageContext(servletContext, request, response);
    }
View Full Code Here

    protected void setupBeforeInitDispatcher() throws Exception {
    }

    protected void initServletMockObjects() {
        servletContext = new MockServletContext(resourceLoader);
        response = new MockHttpServletResponse();
        request = new MockHttpServletRequest();
        pageContext = new MockPageContext(servletContext, request, response);
    }
View Full Code Here

   
    public void testConfigurationManager() {
      Dispatcher du;
      InternalConfigurationManager configurationManager = new InternalConfigurationManager();
      try {
        du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
        du.setConfigurationManager(configurationManager);
       
        du.init();
       
            Dispatcher.setInstance(du);
View Full Code Here

    }
   
    public void testObjectFactoryDestroy() throws Exception {

        final InnerDestroyableObjectFactory destroyedObjectFactory = new InnerDestroyableObjectFactory();
        Dispatcher du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
        ConfigurationManager cm = new ConfigurationManager();
        Mock mockConfiguration = new Mock(Configuration.class);
        cm.setConfiguration((Configuration)mockConfiguration.proxy());
       
        Mock mockContainer = new Mock(Container.class);
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.