This commit is contained in:
Michael Hayder 2024-12-26 17:40:06 +01:00
parent b25508b434
commit 82a161b7c5
16 changed files with 227 additions and 0 deletions

0
.mvn/jvm.config Normal file
View File

0
.mvn/maven.config Normal file
View File

99
pom.xml Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.altimate.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<name>my-app</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- Optionally: parameterized tests support -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -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;
}
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,3 @@
artifactId=my-app
groupId=net.altimate.app
version=1.0-SNAPSHOT

View File

@ -0,0 +1,2 @@
org/apache/hc/client5/http/examples/App$Result.class
org/apache/hc/client5/http/examples/App.class

View File

@ -0,0 +1 @@
/java/my-app/src/main/java/net/altimate/app/App.java

View File

@ -0,0 +1 @@
net/altimate/app/AppTest.class

View File

@ -0,0 +1 @@
/java/my-app/src/test/java/net/altimate/app/AppTest.java

Binary file not shown.

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.1" name="net.altimate.app.AppTest" time="0.04" tests="1" errors="0" skipped="0" failures="0">
<properties>
<property name="java.specification.version" value="21"/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.class.path" value="/java/my-app/target/test-classes:/java/my-app/target/classes:/root/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.11.0/junit-jupiter-api-5.11.0.jar:/root/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/root/.m2/repository/org/junit/platform/junit-platform-commons/1.11.0/junit-platform-commons-1.11.0.jar:/root/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.11.0/junit-jupiter-params-5.11.0.jar:/root/.m2/repository/org/apache/httpcomponents/client5/httpclient5/5.4/httpclient5-5.4.jar:/root/.m2/repository/org/apache/httpcomponents/core5/httpcore5/5.3/httpcore5-5.3.jar:/root/.m2/repository/org/apache/httpcomponents/core5/httpcore5-h2/5.3/httpcore5-h2-5.3.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:"/>
<property name="java.vm.vendor" value="Arch Linux"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.vendor.url" value="https://openjdk.org/"/>
<property name="os.name" value="Linux"/>
<property name="java.vm.specification.version" value="21"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="user.country" value="DE"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-21-openjdk/lib"/>
<property name="sun.java.command" value="/java/my-app/target/surefire/surefirebooter-20241225214340773_3.jar /java/my-app/target/surefire 2024-12-25T21-43-40_710-jvmRun1 surefire-20241225214340773_1tmp surefire_0-20241225214340773_2tmp"/>
<property name="jdk.debug" value="release"/>
<property name="surefire.test.class.path" value="/java/my-app/target/test-classes:/java/my-app/target/classes:/root/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.11.0/junit-jupiter-api-5.11.0.jar:/root/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/root/.m2/repository/org/junit/platform/junit-platform-commons/1.11.0/junit-platform-commons-1.11.0.jar:/root/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/root/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.11.0/junit-jupiter-params-5.11.0.jar:/root/.m2/repository/org/apache/httpcomponents/client5/httpclient5/5.4/httpclient5-5.4.jar:/root/.m2/repository/org/apache/httpcomponents/core5/httpcore5/5.3/httpcore5-5.3.jar:/root/.m2/repository/org/apache/httpcomponents/core5/httpcore5-h2/5.3/httpcore5-h2-5.3.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar:"/>
<property name="sun.cpu.endian" value="little"/>
<property name="user.home" value="/root"/>
<property name="user.language" value="de"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.version.date" value="2024-10-15"/>
<property name="java.home" value="/usr/lib/jvm/java-21-openjdk"/>
<property name="file.separator" value="/"/>
<property name="basedir" value="/java/my-app"/>
<property name="java.vm.compressedOopsMode" value="32-bit"/>
<property name="line.separator" value="&#10;"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="surefire.real.class.path" value="/java/my-app/target/surefire/surefirebooter-20241225214340773_3.jar"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="java.runtime.version" value="21.0.5+11"/>
<property name="user.name" value="root"/>
<property name="stdout.encoding" value="UTF-8"/>
<property name="path.separator" value=":"/>
<property name="os.version" value="6.11.6-arch1-1"/>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="localRepository" value="/root/.m2/repository"/>
<property name="java.vendor.url.bug" value="https://bugreport.java.com/bugreport/"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="java.version" value="21.0.5"/>
<property name="user.dir" value="/java/my-app"/>
<property name="os.arch" value="amd64"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="native.encoding" value="UTF-8"/>
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib"/>
<property name="java.vm.info" value="mixed mode, sharing"/>
<property name="stderr.encoding" value="UTF-8"/>
<property name="java.vendor" value="Arch Linux"/>
<property name="java.vm.version" value="21.0.5+11"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="java.class.version" value="65.0"/>
</properties>
<testcase name="shouldAnswerWithTrue" classname="net.altimate.app.AppTest" time="0.024"/>
</testsuite>

View File

@ -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

Binary file not shown.