Search in sources :

Example 6 with ServletRunner

use of com.meterware.servletunit.ServletRunner in project v7files by thiloplanz.

the class MiltonServletTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    Properties props = UnitTestSupport.getDefaultProperties();
    props.put("auth.provider", "demo");
    props.put("acl.provider", "global");
    props.put("acl.read", "admins");
    props.put("acl.write", "admins");
    UnitTestSupport.initConfiguration(props);
    sr = new ServletRunner();
    Hashtable<String, String> initParams = new Hashtable<String, String>();
    initParams.put("webdav.endpoint", "webdav");
    initParams.put("resource.factory.factory.class", ResourceFactoryFactory.class.getName());
    sr.registerServlet("myServlet/*", MiltonServlet.class.getName(), initParams);
}
Also used : Hashtable(java.util.Hashtable) ServletRunner(com.meterware.servletunit.ServletRunner) Properties(java.util.Properties)

Example 7 with ServletRunner

use of com.meterware.servletunit.ServletRunner in project cxf by apache.

the class ErrorContextSerletTest method testInvoke.

@Test
public void testInvoke() {
    try {
        sr = new ServletRunner(getResourceAsStream(getConfiguration()), CONTEXT);
        sr.newClient().getResponse(CONTEXT_URL + "/services");
        // there expect a spring bean exception
        fail("we expect a spring bean Exception here");
    } catch (Exception ex) {
        // supprot spring 2.0.x and sping 2.5
        assertTrue("we expect a Bean Exception here", ex instanceof org.springframework.beans.FatalBeanException);
    }
}
Also used : ServletRunner(com.meterware.servletunit.ServletRunner) BusException(org.apache.cxf.BusException) Test(org.junit.Test)

Example 8 with ServletRunner

use of com.meterware.servletunit.ServletRunner in project codeu-2018-team12 by codeu-2018-team12.

the class ProfileIntegrationTest method setup.

@Before
public void setup() throws IOException, SAXException {
    appEngineTestHelper.setUp();
    // Unfortunately, the ServletRunner constructors that take java.io.File (the
    // non-deprecated ones) have a bug, so we have to use the two argument string
    // form.
    // 
    // See https://sourceforge.net/p/httpunit/mailman/message/27259892 for details.
    servletRunner = new ServletRunner("src/main/webapp/WEB-INF/web.xml", "");
    servletClient = servletRunner.newClient();
}
Also used : ServletRunner(com.meterware.servletunit.ServletRunner) Before(org.junit.Before)

Example 9 with ServletRunner

use of com.meterware.servletunit.ServletRunner in project teammates by TEAMMATES.

the class GaeSimulation method setup.

/**
 * Sets up the GAE simulation.
 */
public synchronized void setup() {
    System.out.println("Setting up GAE simulation");
    LocalTaskQueueTestConfig localTasks = new LocalTaskQueueTestConfig();
    localTasks.setQueueXmlPath(QUEUE_XML_PATH);
    LocalUserServiceTestConfig localUserServices = new LocalUserServiceTestConfig();
    LocalDatastoreServiceTestConfig localDatastore = new LocalDatastoreServiceTestConfig();
    LocalMailServiceTestConfig localMail = new LocalMailServiceTestConfig();
    LocalSearchServiceTestConfig localSearch = new LocalSearchServiceTestConfig();
    localSearch.setPersistent(false);
    LocalModulesServiceTestConfig localModules = new LocalModulesServiceTestConfig();
    LocalLogServiceTestConfig localLog = new LocalLogServiceTestConfig();
    helper = new LocalServiceTestHelper(localDatastore, localMail, localUserServices, localTasks, localSearch, localModules, localLog);
    helper.setUp();
    sc = new ServletRunner().newClient();
    localLogService = LocalLogServiceTestConfig.getLocalLogService();
}
Also used : LocalLogServiceTestConfig(com.google.appengine.tools.development.testing.LocalLogServiceTestConfig) LocalDatastoreServiceTestConfig(com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig) LocalUserServiceTestConfig(com.google.appengine.tools.development.testing.LocalUserServiceTestConfig) LocalTaskQueueTestConfig(com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig) LocalServiceTestHelper(com.google.appengine.tools.development.testing.LocalServiceTestHelper) ServletRunner(com.meterware.servletunit.ServletRunner) LocalModulesServiceTestConfig(com.google.appengine.tools.development.testing.LocalModulesServiceTestConfig) LocalSearchServiceTestConfig(com.google.appengine.tools.development.testing.LocalSearchServiceTestConfig) LocalMailServiceTestConfig(com.google.appengine.tools.development.testing.LocalMailServiceTestConfig)

Aggregations

ServletRunner (com.meterware.servletunit.ServletRunner)9 Before (org.junit.Before)5 InputStream (java.io.InputStream)4 LocalDatastoreServiceTestConfig (com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig)1 LocalLogServiceTestConfig (com.google.appengine.tools.development.testing.LocalLogServiceTestConfig)1 LocalMailServiceTestConfig (com.google.appengine.tools.development.testing.LocalMailServiceTestConfig)1 LocalModulesServiceTestConfig (com.google.appengine.tools.development.testing.LocalModulesServiceTestConfig)1 LocalSearchServiceTestConfig (com.google.appengine.tools.development.testing.LocalSearchServiceTestConfig)1 LocalServiceTestHelper (com.google.appengine.tools.development.testing.LocalServiceTestHelper)1 LocalTaskQueueTestConfig (com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig)1 LocalUserServiceTestConfig (com.google.appengine.tools.development.testing.LocalUserServiceTestConfig)1 HttpNotFoundException (com.meterware.httpunit.HttpNotFoundException)1 Hashtable (java.util.Hashtable)1 Properties (java.util.Properties)1 BusException (org.apache.cxf.BusException)1 Test (org.junit.Test)1