diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..e69de29 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..89add28 --- /dev/null +++ b/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + + net.altimate.app + my-app + 1.0-SNAPSHOT + + my-app + + http://www.example.com + + + UTF-8 + 17 + + + + + + org.junit + junit-bom + 5.11.0 + pom + import + + + + + + + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.junit.jupiter + junit-jupiter-params + test + + + org.apache.httpcomponents.client5 + httpclient5 + 5.4 + + + + + + + + + + + maven-clean-plugin + 3.4.0 + + + + maven-resources-plugin + 3.3.1 + + + maven-compiler-plugin + 3.13.0 + + + maven-surefire-plugin + 3.3.0 + + + maven-jar-plugin + 3.4.2 + + + maven-install-plugin + 3.1.2 + + + maven-deploy-plugin + 3.1.2 + + + + maven-site-plugin + 3.12.1 + + + maven-project-info-reports-plugin + 3.6.1 + + + + + diff --git a/src/main/java/net/altimate/app/App.java b/src/main/java/net/altimate/app/App.java new file mode 100644 index 0000000..ced1e2b --- /dev/null +++ b/src/main/java/net/altimate/app/App.java @@ -0,0 +1,40 @@ +//package net.altimate; +package org.apache.hc.client5.http.examples; + +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.message.StatusLine; + +public class App { + + public static void main(final String[] args) throws Exception { + try (final CloseableHttpClient httpclient = HttpClients.createDefault()) { + final HttpGet httpget = new HttpGet("http://httpbin.org/get"); + + System.out.println("Executing request " + httpget.getMethod() + " " + httpget.getUri()); + + final Result result = httpclient.execute(httpget, response -> { + System.out.println("----------------------------------------"); + System.out.println(httpget + "->" + new StatusLine(response)); + // Process response message and convert it into a value object + return new Result(response.getCode(), EntityUtils.toString(response.getEntity())); + }); + System.out.println(result); + } + } + + static class Result { + + final int status; + final String content; + + Result(final int status, final String content) { + this.status = status; + this.content = content; + } + + } + +} \ No newline at end of file diff --git a/src/test/java/net/altimate/app/AppTest.java b/src/test/java/net/altimate/app/AppTest.java new file mode 100644 index 0000000..8b60926 --- /dev/null +++ b/src/test/java/net/altimate/app/AppTest.java @@ -0,0 +1,19 @@ +package net.altimate.app; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() { + assertTrue(true); + } +} diff --git a/target/classes/org/apache/hc/client5/http/examples/App$Result.class b/target/classes/org/apache/hc/client5/http/examples/App$Result.class new file mode 100644 index 0000000..caa6020 Binary files /dev/null and b/target/classes/org/apache/hc/client5/http/examples/App$Result.class differ diff --git a/target/classes/org/apache/hc/client5/http/examples/App.class b/target/classes/org/apache/hc/client5/http/examples/App.class new file mode 100644 index 0000000..8576586 Binary files /dev/null and b/target/classes/org/apache/hc/client5/http/examples/App.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..21376ec --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=my-app +groupId=net.altimate.app +version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..fa8dbca --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +org/apache/hc/client5/http/examples/App$Result.class +org/apache/hc/client5/http/examples/App.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..61bd956 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/java/my-app/src/main/java/net/altimate/app/App.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..34236de --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +net/altimate/app/AppTest.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..3d8d8f3 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/java/my-app/src/test/java/net/altimate/app/AppTest.java diff --git a/target/my-app-1.0-SNAPSHOT.jar b/target/my-app-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..5cff7e0 Binary files /dev/null and b/target/my-app-1.0-SNAPSHOT.jar differ diff --git a/target/surefire-reports/TEST-net.altimate.app.AppTest.xml b/target/surefire-reports/TEST-net.altimate.app.AppTest.xml new file mode 100644 index 0000000..03f8b3a --- /dev/null +++ b/target/surefire-reports/TEST-net.altimate.app.AppTest.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/net.altimate.app.AppTest.txt b/target/surefire-reports/net.altimate.app.AppTest.txt new file mode 100644 index 0000000..b8de8d7 --- /dev/null +++ b/target/surefire-reports/net.altimate.app.AppTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: net.altimate.app.AppTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.040 s -- in net.altimate.app.AppTest diff --git a/target/test-classes/net/altimate/app/AppTest.class b/target/test-classes/net/altimate/app/AppTest.class new file mode 100644 index 0000000..c87398b Binary files /dev/null and b/target/test-classes/net/altimate/app/AppTest.class differ