Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebRequest


    public void testGetRepositoryInvalidPathPassthroughMissing()
        throws Exception
    {
        String path = REQUEST_PATH + ".index/filecontent/foo.bar";

        WebRequest request = new GetMethodWebRequest( path );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseNotFound( response );
        assertThat( response.getContentAsString() ).contains(
            "Invalid path to Artifact: legacy paths should have an expected type ending in [s] in the second part of the path." );
    }
View Full Code Here


        String putUrl = "http://machine.com/repository/internal" + ARTIFACT_DEFAULT_LAYOUT;
        InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
        // verify that the file exists in resources-dir
        assertNotNull( "artifact.jar inputstream", is );

        WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );

        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseCreated( response );
        assertFileContents( "artifact.jar\n", repoRootInternal, ARTIFACT_DEFAULT_LAYOUT );
    }   
View Full Code Here

        InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
        // verify that the file exists in resources-dir
        assertNotNull( "artifact.jar inputstream", is );

        // send request #1 and verify it's successful
        WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseCreated( response );
       
        is = getClass().getResourceAsStream( "/artifact.jar.sha1" );
        request = new PutMethodWebRequest( checksumUrl, is, "application/octet-stream" );
View Full Code Here

        InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
        // verify that the file exists in resources-dir
        assertNotNull( "artifact.jar inputstream", is );
   
        // send request #1 and verify it's successful
        WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseCreated( response );
       
        is = getClass().getResourceAsStream( "/artifact.jar.sha1" );
        request = new PutMethodWebRequest( checksumUrl, is, "application/octet-stream" );
View Full Code Here

        InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
        // verify that the file exists in resources-dir
        assertNotNull( "artifact.jar inputstream", is );

        // send request #1 and verify it's successful
        WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseCreated( response );
       
        is = getClass().getResourceAsStream( "/artifact.jar.sha1" );
        request = new PutMethodWebRequest( checksumUrl, is, "application/octet-stream" );
View Full Code Here

        InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
        // verify that the file exists in resources-dir
        assertNotNull( "artifact.jar inputstream", is );

        // send request #1 and verify it's successful
        WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseCreated( response );
       
        is = getClass().getResourceAsStream( "/artifact.jar.sha1" );
        request = new PutMethodWebRequest( checksumUrl, is, "application/octet-stream" );
View Full Code Here

    {
        setupCleanRepo( repoRootInternal );

        String putUrl = "http://machine.com/repository/internal/path/to/";

        WebRequest request = new MkColMethodWebRequest( putUrl );

        WebResponse response = getServletUnitClient().getResponse( request );
       
        assertEquals(HttpServletResponse.SC_CONFLICT, response.getStatusCode());
       
View Full Code Here

        // --- Execution
        // process the response code later, not via an exception.
        //HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );

        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
        WebResponse response = getServletUnitClient().getResponse( request );

        // --- Verification

        switch ( expectation )
View Full Code Here

    @Test
    public void testBrowse()
        throws Exception
    {
        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertEquals( "Response", HttpServletResponse.SC_OK, response.getStatusCode() );

        // dumpResponse( response );
View Full Code Here

    @Test
    public void testBrowseSubdirectory()
        throws Exception
    {
        WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/org" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertEquals( "Response", HttpServletResponse.SC_OK, response.getStatusCode() );

        List<String> expectedLinks = Arrays.asList( "../", "apache/", "codehaus/" );
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.WebRequest

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.