From 38a41fea90071033b7919bac0d12a25677dd04fc Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 19 Jan 2020 20:25:04 +0100 Subject: [PATCH] Use camelCase for Java method names -- always --- .../hc/client5/http/fluent/Request.java | 32 +++++++++---------- .../http/examples/fluent/FluentAsync.java | 8 ++--- .../http/examples/fluent/FluentExecutor.java | 6 ++-- .../examples/fluent/FluentQuickStart.java | 4 +-- .../http/examples/fluent/FluentRequests.java | 6 ++-- .../fluent/FluentResponseHandling.java | 2 +- .../hc/client5/http/fluent/TestRequest.java | 4 +-- .../hc/client5/testing/fluent/TestFluent.java | 20 ++++++------ 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java index 18678e491..955eea655 100644 --- a/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java +++ b/httpclient5-fluent/src/main/java/org/apache/hc/client5/http/fluent/Request.java @@ -93,67 +93,67 @@ public class Request { return new Request(new HttpUriRequestBase(methodName, uri)); } - public static Request Get(final URI uri) { + public static Request get(final URI uri) { return new Request(ClassicHttpRequests.get(uri)); } - public static Request Get(final String uri) { + public static Request get(final String uri) { return new Request(ClassicHttpRequests.get(uri)); } - public static Request Head(final URI uri) { + public static Request head(final URI uri) { return new Request(ClassicHttpRequests.head(uri)); } - public static Request Head(final String uri) { + public static Request head(final String uri) { return new Request(ClassicHttpRequests.head(uri)); } - public static Request Post(final URI uri) { + public static Request post(final URI uri) { return new Request(ClassicHttpRequests.post(uri)); } - public static Request Post(final String uri) { + public static Request post(final String uri) { return new Request(ClassicHttpRequests.post(uri)); } - public static Request Patch(final URI uri) { + public static Request patch(final URI uri) { return new Request(ClassicHttpRequests.patch(uri)); } - public static Request Patch(final String uri) { + public static Request patch(final String uri) { return new Request(ClassicHttpRequests.patch(uri)); } - public static Request Put(final URI uri) { + public static Request put(final URI uri) { return new Request(ClassicHttpRequests.put(uri)); } - public static Request Put(final String uri) { + public static Request put(final String uri) { return new Request(ClassicHttpRequests.put(uri)); } - public static Request Trace(final URI uri) { + public static Request trace(final URI uri) { return new Request(ClassicHttpRequests.trace(uri)); } - public static Request Trace(final String uri) { + public static Request trace(final String uri) { return new Request(ClassicHttpRequests.trace(uri)); } - public static Request Delete(final URI uri) { + public static Request delete(final URI uri) { return new Request(ClassicHttpRequests.delete(uri)); } - public static Request Delete(final String uri) { + public static Request delete(final String uri) { return new Request(ClassicHttpRequests.delete(uri)); } - public static Request Options(final URI uri) { + public static Request options(final URI uri) { return new Request(ClassicHttpRequests.options(uri)); } - public static Request Options(final String uri) { + public static Request options(final String uri) { return new Request(ClassicHttpRequests.options(uri)); } diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentAsync.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentAsync.java index 29d87d132..e73fa9abd 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentAsync.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentAsync.java @@ -50,10 +50,10 @@ public class FluentAsync { final Async async = Async.newInstance().use(threadpool); final Request[] requests = new Request[] { - Request.Get("http://www.google.com/"), - Request.Get("http://www.yahoo.com/"), - Request.Get("http://www.apache.com/"), - Request.Get("http://www.apple.com/") + Request.get("http://www.google.com/"), + Request.get("http://www.yahoo.com/"), + Request.get("http://www.apache.org/"), + Request.get("http://www.apple.com/") }; diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentExecutor.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentExecutor.java index 6333c9923..3228f6bb7 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentExecutor.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentExecutor.java @@ -51,13 +51,13 @@ public class FluentExecutor { .authPreemptive(new HttpHost("myproxy", 8080)); // Execute a GET with timeout settings and return response content as String. - executor.execute(Request.Get("http://somehost/") + executor.execute(Request.get("http://somehost/") .connectTimeout(Timeout.ofSeconds(1))) .returnContent().asString(); // Execute a POST with the 'expect-continue' handshake, using HTTP/1.1, // containing a request body as String and return response content as byte array. - executor.execute(Request.Post("http://somehost/do-stuff") + executor.execute(Request.post("http://somehost/do-stuff") .useExpectContinue() .version(HttpVersion.HTTP_1_1) .bodyString("Important stuff", ContentType.DEFAULT_TEXT) @@ -65,7 +65,7 @@ public class FluentExecutor { // Execute a POST with a custom header through the proxy containing a request body // as an HTML form and save the result to the file - executor.execute(Request.Post("http://somehost/some-form") + executor.execute(Request.post("http://somehost/some-form") .addHeader("X-Custom-header", "stuff") .viaProxy(new HttpHost("myproxy", 8080)) .bodyForm(Form.form().add("username", "vip").add("password", "secret").build()) diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentQuickStart.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentQuickStart.java index 67d600822..aaa52c8ba 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentQuickStart.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentQuickStart.java @@ -36,9 +36,9 @@ public class FluentQuickStart { // deallocation of system resources at the cost of having to buffer // response content in memory in some cases. - Request.Get("http://targethost/homepage") + Request.get("http://targethost/homepage") .execute().returnContent(); - Request.Post("http://targethost/login") + Request.post("http://targethost/login") .bodyForm(Form.form().add("username", "vip").add("password", "secret").build()) .execute().returnContent(); } diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentRequests.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentRequests.java index a2559f70d..ceed7c826 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentRequests.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentRequests.java @@ -42,13 +42,13 @@ public class FluentRequests { public static void main(final String... args)throws Exception { // Execute a GET with timeout settings and return response content as String. - Request.Get("http://somehost/") + Request.get("http://somehost/") .connectTimeout(Timeout.ofSeconds(1)) .execute().returnContent().asString(); // Execute a POST with the 'expect-continue' handshake, using HTTP/1.1, // containing a request body as String and return response content as byte array. - Request.Post("http://somehost/do-stuff") + Request.post("http://somehost/do-stuff") .useExpectContinue() .version(HttpVersion.HTTP_1_1) .bodyString("Important stuff", ContentType.DEFAULT_TEXT) @@ -56,7 +56,7 @@ public class FluentRequests { // Execute a POST with a custom header through the proxy containing a request body // as an HTML form and save the result to the file - Request.Post("http://somehost/some-form") + Request.post("http://somehost/some-form") .addHeader("X-Custom-header", "stuff") .viaProxy(new HttpHost("myproxy", 8080)) .bodyForm(Form.form().add("username", "vip").add("password", "secret").build()) diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentResponseHandling.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentResponseHandling.java index 9fa5aa174..65e4e7b60 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentResponseHandling.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/examples/fluent/FluentResponseHandling.java @@ -52,7 +52,7 @@ import org.xml.sax.SAXException; public class FluentResponseHandling { public static void main(final String... args)throws Exception { - final Document result = Request.Get("http://somehost/content") + final Document result = Request.get("http://somehost/content") .execute().handleResponse(new HttpClientResponseHandler() { @Override diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java index fb9d41cbf..8c4a55708 100644 --- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java +++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java @@ -41,14 +41,14 @@ public class TestRequest { @Test public void testGetFromString() { - final ClassicHttpRequest request = Request.Get(URI_STRING_FIXTURE).getRequest(); + final ClassicHttpRequest request = Request.get(URI_STRING_FIXTURE).getRequest(); Assert.assertEquals(HttpGet.class, request.getClass()); Assert.assertEquals("GET", request.getMethod()); } @Test public void testGetFromURI() { - final ClassicHttpRequest request = Request.Get(URI_FIXTURE).getRequest(); + final ClassicHttpRequest request = Request.get(URI_FIXTURE).getRequest(); Assert.assertEquals(HttpGet.class, request.getClass()); Assert.assertEquals("GET", request.getMethod()); } diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java index 086fdded1..016619637 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java @@ -95,7 +95,7 @@ public class TestFluent extends LocalServerTestBase { public void testGetRequest() throws Exception { final HttpHost target = start(); final String baseURL = "http://localhost:" + target.getPort(); - final String message = Request.Get(baseURL + "/").execute().returnContent().asString(); + final String message = Request.get(baseURL + "/").execute().returnContent().asString(); Assert.assertEquals("All is well", message); } @@ -119,18 +119,18 @@ public class TestFluent extends LocalServerTestBase { public void testGetRequestFailure() throws Exception { final HttpHost target = start(); final String baseURL = "http://localhost:" + target.getPort(); - Request.Get(baseURL + "/boom").execute().returnContent().asString(); + Request.get(baseURL + "/boom").execute().returnContent().asString(); } @Test public void testPostRequest() throws Exception { final HttpHost target = start(); final String baseURL = "http://localhost:" + target.getPort(); - final String message1 = Request.Post(baseURL + "/echo") + final String message1 = Request.post(baseURL + "/echo") .bodyString("what is up?", ContentType.TEXT_PLAIN) .execute().returnContent().asString(); Assert.assertEquals("what is up?", message1); - final String message2 = Request.Post(baseURL + "/echo") + final String message2 = Request.post(baseURL + "/echo") .bodyByteArray(new byte[]{1, 2, 3}, ContentType.APPLICATION_OCTET_STREAM) .execute().returnContent().asString(); Assert.assertEquals("echo", message2); @@ -140,7 +140,7 @@ public class TestFluent extends LocalServerTestBase { public void testContentAsStringWithCharset() throws Exception { final HttpHost target = start(); final String baseURL = "http://localhost:" + target.getPort(); - final Content content = Request.Post(baseURL + "/echo").bodyByteArray("Ü".getBytes("utf-8")).execute() + final Content content = Request.post(baseURL + "/echo").bodyByteArray("Ü".getBytes("utf-8")).execute() .returnContent(); Assert.assertEquals((byte)-61, content.asBytes()[0]); Assert.assertEquals((byte)-100, content.asBytes()[1]); @@ -152,10 +152,10 @@ public class TestFluent extends LocalServerTestBase { final HttpHost target = start(); final String baseURL = "http://localhost:" + target.getPort(); for (int i = 0; i < 20; i++) { - Request.Get(baseURL + "/").execute().returnContent(); - Request.Get(baseURL + "/").execute().returnResponse(); - Request.Get(baseURL + "/").execute().discardContent(); - Request.Get(baseURL + "/").execute().handleResponse(new HttpClientResponseHandler() { + Request.get(baseURL + "/").execute().returnContent(); + Request.get(baseURL + "/").execute().returnResponse(); + Request.get(baseURL + "/").execute().discardContent(); + Request.get(baseURL + "/").execute().handleResponse(new HttpClientResponseHandler() { @Override public Object handleResponse( @@ -166,7 +166,7 @@ public class TestFluent extends LocalServerTestBase { }); final File tmpFile = File.createTempFile("test", ".bin"); try { - Request.Get(baseURL + "/").execute().saveContent(tmpFile); + Request.get(baseURL + "/").execute().saveContent(tmpFile); } finally { tmpFile.delete(); }