Package com.meterware.servletunit

Examples of com.meterware.servletunit.ServletRunner$JasperJSPServletDescriptor


        HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
       
        InputStream is =
            getClass().getResourceAsStream( "/org/codehaus/ivory/plexus/web.xml");
   
        sr = new ServletRunner(is);
       
        PlexusTestServlet.Plexus = getContainer();
        sr.registerServlet("plexus", PlexusTestServlet.class.getName());
    }
View Full Code Here


        hostname = InetAddress.getLocalHost().getCanonicalHostName();
        mainThread = Thread.currentThread();
        this.setup = setup;
        pref = PropertyPreferences.SYSTEM_ROOT;
        log.info("Creating runner");
        runner = new ServletRunner(new File("webapp/WEB-INF/web.xml"), "/webapp");
        // Hashtable parms = new Hashtable();
        // parms.put("config", "/WEB-INF/struts-config.xml");
        // parms.put("debug", "2");
        // parms.put("detail", "2");
        // log.info("Registering servlet");
View Full Code Here

    protected ServletRunner runner;

    @Before
    public void setUpServlet() throws Exception {
        InputStream config = getClass().getResourceAsStream(CONFIG_PATH);
        runner = new ServletRunner(config, CONTEXT_PATH);
        HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
    }
View Full Code Here

  public void setUp() throws Exception {
    localTestServer = new LocalTestServer(null, null);
    localTestServer.start();
    localTestServer.register("/targetPath*", new RequestInfoHandler());//matches /targetPath and /targetPath/blahblah

    servletRunner = new ServletRunner();

    Properties servletProps = new Properties();
    servletProps.setProperty("http.protocol.handle-redirects", "false");
    servletProps.setProperty(ProxyServlet.P_LOG, "true");
    servletProps.setProperty(ProxyServlet.P_FORWARDEDFOR, "true");
View Full Code Here

   
    
    public void testHandleExceptionByJson() throws Exception
   
     
        ServletRunner sr = new ServletRunner();
    ServletUnitClient sc = sr.newClient();
    WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
    InvocationContext ic = sc.newInvocation( request );
   
        OAuth2ProblemException problem = new OAuth2ProblemException(OAuth2.ErrorCode.UNSUPPORTED_RESPONSE_TYPE);
        // if you do not specify status code 200 here response does not inluce anything
View Full Code Here

    }
   
    public void testHandleExceptionByRedirectURL() throws Exception
   
     
        ServletRunner sr = new ServletRunner();
    ServletUnitClient sc = sr.newClient();
    WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
    InvocationContext ic = sc.newInvocation( request );
   
        OAuth2ProblemException problem = new OAuth2ProblemException(OAuth2.ErrorCode.UNSUPPORTED_RESPONSE_TYPE);
        problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
View Full Code Here

    }

    public void testHandleExceptionByRedirectURL2() throws Exception
    {

        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();
        WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
        InvocationContext ic = sc.newInvocation( request );

        OAuth2ProblemException problem = new OAuth2ProblemException(OAuth2.ErrorCode.UNSUPPORTED_RESPONSE_TYPE);
        problem.setParameter(OAuth2ProblemException.HTTP_STATUS_CODE,new Integer(302));
View Full Code Here

    }
    public void testSendFormInJson() throws Exception
   
     
      for (String[] testCase : OAUTH_PARAMETERS) {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();
        WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );      
        InvocationContext ic = sc.newInvocation( request );     
      
            String label = testCase[0];
            //String realm = testCase[1];
View Full Code Here

    }
    public void testGetMessage() throws Exception
   
     
      for (String[] testCase : OAUTH_PARAMETERS) {
        ServletRunner sr = new ServletRunner();
        ServletUnitClient sc = sr.newClient();
        WebRequest request   = new PostMethodWebRequest( "https://test.meterware.com/myServlet" );
        request.setParameter( "grant_type", testCase[2] );
        request.setParameter( "client_id", testCase[3] );
        //request.setParameter( "client_secret", testCase[5] );
        request.setParameter( "code", testCase[4] );
View Full Code Here

            assertEquals("Message check", expectedRedirectURI, message.getParameter(OAuth2.REDIRECT_URI));
        }
    }
    public void testGetRequestURL() throws Exception
   
      ServletRunner sr = new ServletRunner();
      ServletUnitClient sc = sr.newClient();
        WebRequest request   = new GetMethodWebRequest( "http://test.meterware.com/myServlet" );
        request.setParameter( "color", "red" );
        InvocationContext ic = sc.newInvocation( request );
        String url = OAuth2Servlet.getRequestURL(ic.getRequest());
        assertEquals("URL check", "http://test.meterware.com/myServlet?color=red", url);       
View Full Code Here

TOP

Related Classes of com.meterware.servletunit.ServletRunner$JasperJSPServletDescriptor

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.