Package com.mockrunner.mock.web

Examples of com.mockrunner.mock.web.MockHttpServletRequest


    listeners.put( "globalObjects", "globalObjects" ); //$NON-NLS-1$ //$NON-NLS-2$
    return listeners;
  }

  public void testDoGet() throws ServletException, IOException {
    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpSession session = new MockHttpSession();
    request.setSession( session );
    request.setupAddParameter( "solution", "samples" ); //$NON-NLS-1$//$NON-NLS-2$
    request.setupAddParameter( "path", "steel-wheels/reports" ); //$NON-NLS-1$ //$NON-NLS-2$
    request.setupAddParameter( "action", "Inventory List.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$
    request.setupAddParameter( "details", "all" ); //$NON-NLS-1$ //$NON-NLS-2$

    MockHttpServletResponse response = new MockHttpServletResponse();
    UIServlet servlet = new UIServlet();
    servlet.service( request, response );
View Full Code Here


    pathParams.setParameter( "path", "/StubService/getString" );
    pathParams.setParameter( "remoteaddr", "http:test" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "GET" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService/getString" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/getString" );
    request.setRemoteAddr( REMOTE_ADDRESS );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    SimpleParameterProvider pathParams = new SimpleParameterProvider();
    pathParams.setParameter( "path", "/StubService/setString?str=testinput" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "GET" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService/setString" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/getString" );
    request.setRemoteAddr( REMOTE_ADDRESS );
    request.setQueryString( "str=testinput" );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    SimpleParameterProvider pathParams = new SimpleParameterProvider();
    pathParams.setParameter( "path", "/StubService/throwsError1" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "GET" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService/throwsError1" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/throwsError1" );
    request.setRemoteAddr( REMOTE_ADDRESS );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );
    try {
      StubService.throwsError1Called = false;
View Full Code Here

    SimpleParameterProvider pathParams = new SimpleParameterProvider();
    pathParams.setParameter( "path", "/StubService/throwsError2" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "GET" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService/throwsError2" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/throwsError2" );
    request.setRemoteAddr( REMOTE_ADDRESS );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    SimpleParameterProvider pathParams = new SimpleParameterProvider();
    pathParams.setParameter( "path", "/StubService/bogus" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "GET" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService/bogus" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/bogus" );
    request.setRemoteAddr( REMOTE_ADDRESS );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    pathParams.setParameter( "path", "/StubService" );
    pathParams.setParameter( "remoteaddr", "http:test" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "POST" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService" );
    request.setRemoteAddr( REMOTE_ADDRESS );
    request.setContentType( "application/soap+xml; charset=UTF-8; action=\"urn:getString\"" );
    String xml =
      "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://www.w3"
        + ".org/2003/05/soap-envelope\"><soapenv:Body><ns2:getString xmlns:ns2=\"http://webservice.pentaho"
        + ".com\"></ns2:getString></soapenv:Body></soapenv:Envelope>";
    request.setBodyContent( xml );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    pathParams.setParameter( "path", "/StubService" );
    pathParams.setParameter( "remoteaddr", "http:test" );
    parameterProviders.put( "path", pathParams );
    contentGenerator.setParameterProviders( parameterProviders );

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();

    request.setMethod( "PUT" );
    request.setRequestURI( "/pentaho/content/ws-run/StubService" );
    request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService" );
    request.setRemoteAddr( REMOTE_ADDRESS );
    request.setContentType( "application/soap+xml; charset=UTF-8; action=\"urn:getString\"" );
    String xml =
      "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv=\"http://www.w3"
        + ".org/2003/05/soap-envelope\"><soapenv:Body><ns2:getString xmlns:ns2=\"http://webservice.pentaho"
        + ".com\"></ns2:getString></soapenv:Body></soapenv:Envelope>";
    request.setBodyContent( xml );

    pathParams.setParameter( "httprequest", request );
    pathParams.setParameter( "httpresponse", response );

    try {
View Full Code Here

    listeners.put( "globalObjects", "globalObjects" ); //$NON-NLS-1$ //$NON-NLS-2$
    return listeners;
  }

  public void testDoGet() throws ServletException, IOException {
    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpSession session = new MockHttpSession();
    request.setSession( session );
    request.setupAddParameter( "action", "securitydetails" ); //$NON-NLS-1$//$NON-NLS-2$
    request.setupAddParameter( "details", "all" ); //$NON-NLS-1$ //$NON-NLS-2$
    MockHttpServletResponse response = new MockHttpServletResponse();
    HttpWebService servlet = new HttpWebService();
    servlet.doGet( request, response );
    assertTrue( "missing or invalid SOAP wrapper elements", //$NON-NLS-1$
        isSoapValid( response.getOutputStreamContent() ) );
View Full Code Here

    listeners.put( "globalObjects", "globalObjects" ); //$NON-NLS-1$ //$NON-NLS-2$
    return listeners;
  }

  public void testDoGet() throws ServletException, IOException {
    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpSession session = new MockHttpSession();
    request.setSession( session );
    request.setupAddParameter( "solution", "samples" ); //$NON-NLS-1$//$NON-NLS-2$
    request.setupAddParameter( "path", "steel-wheels/reports" ); //$NON-NLS-1$ //$NON-NLS-2$
    request.setupAddParameter( "action", "Inventory List.xaction" ); //$NON-NLS-1$ //$NON-NLS-2$
    request.setupAddParameter( "details", "all" ); //$NON-NLS-1$ //$NON-NLS-2$

    MockHttpServletResponse response = new MockHttpServletResponse();
    HttpMimeTypeListener listener = new HttpMimeTypeListener( request, response, "MyOwnReport" ); //$NON-NLS-1$
    listener.setMimeType( "text/html" ); //$NON-NLS-1$
  }
View Full Code Here

TOP

Related Classes of com.mockrunner.mock.web.MockHttpServletRequest

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.