Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebRequest


        File artifactFile = new File( repoRootLegacy, "commons-lang/jars/" + filename );
        artifactFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );

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

        assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
    }
View Full Code Here


        File artifactFile = new File( repoRootLegacy, commonsLangJar );
        artifactFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );

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

        assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
    }
View Full Code Here

        File checksumFile = new File( repoRootLegacy, "org.project/distributions/example-presentation-3.2.xml.zip" );
        checksumFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );

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

        assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
    }
View Full Code Here

        File checksumFile = new File( repoRootLegacy, dualExtensionPath );
        checksumFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );

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

        assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
    }
View Full Code Here

    }

    private OAuthToken getAccessToken(String refreshToken) throws IOException {
        final String tokenUrl = String.format(ACCESS_TOKEN_URL, refreshToken,
            oAuthParams.getRedirectUri(), oAuthParams.getClientId(), oAuthParams.getClientSecret());
        final WebRequest webRequest = new WebRequest(new URL(tokenUrl), HttpMethod.POST);

        final WebResponse webResponse = webClient.loadWebResponse(webRequest);
        if (webResponse.getStatusCode() != HttpStatus.SC_OK) {
            throw new IOException(String.format("Error getting access token: [%s: %s]",
                webResponse.getStatusCode(), webResponse.getStatusMessage()));
View Full Code Here

        File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
        dummyInternalResourceFile.getParentFile().mkdirs();
        FileUtils.writeStringToFile( dummyInternalResourceFile, "first", Charset.defaultCharset() );

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

        assertResponseOK( response );
        Assertions.assertThat( response.getContentAsString() ).isEqualTo( "first" );
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/" + path );
        WebResponse response = getServletUnitClient().getResponse( request );

        // --- Verification

        switch ( expectation )
View Full Code Here

        File artifactFile = new File( repoRootInternal, commonsLangJar );
        artifactFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, Charset.defaultCharset()  );

        WebRequest request = new GetMethodWebRequest(
            "http://machine.com/repository/internal/" + "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseOK( response );

        assertEquals( "Expected file contents", expectedArtifactContents, response.getContentAsString() );
View Full Code Here

        File checksumFile = new File( repoRootInternal, dualExtensionPath );
        checksumFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );

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

        assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
    }
View Full Code Here

        File checksumFile = new File( repoRootInternal, dualExtensionPath );
        checksumFile.getParentFile().mkdirs();

        FileUtils.writeStringToFile( checksumFile, expectedContents, Charset.defaultCharset()  );

        WebRequest request = new GetMethodWebRequest(
            "http://machine.com/repository/internal/" + "org.project/distributions/example-presentation-3.2.zip" );
        WebResponse response = getServletUnitClient().getResponse( request );
        assertResponseOK( response );

        assertEquals( "Expected file contents", expectedContents, response.getContentAsString() );
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.