This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# Testing with our container image | ||
|
||
See [Test with our container image](https://piranha.cloud/web-profile/guides/image) | ||
for the step by step guide. This repository contains the resulting project for | ||
your reference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?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>cloud.piranha.guides.webprofile</groupId> | ||
<artifactId>docker</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
<name>Testing with our container image</name> | ||
<properties> | ||
<!-- dependencies --> | ||
<jakartaee.version>10.0.0</jakartaee.version> | ||
<junit.version>5.10.0-M1</junit.version> | ||
<!-- plugins --> | ||
<docker-maven-plugin.version>0.43.4</docker-maven-plugin.version> | ||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> | ||
<maven-failsafe-plugin.version>3.0.0</maven-failsafe-plugin.version> | ||
<maven-war-plugin.version>3.3.2</maven-war-plugin.version> | ||
<!-- other --> | ||
<java.version>21</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.platform</groupId> | ||
<artifactId>jakarta.jakartaee-web-api</artifactId> | ||
<version>${jakartaee.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<finalName>image</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>${docker-maven-plugin.version}</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<alias>ocelot-azure-keyvault</alias> | ||
<name>ghcr.io/manorrock/ocelot-azure-keyvault:latest</name> | ||
<build> | ||
<buildx> | ||
<platforms> | ||
<platform>linux/amd64</platform> | ||
<platform>linux/arm64</platform> | ||
</platforms> | ||
</buildx> | ||
<contextDir>${basedir}</contextDir> | ||
<dockerFile>src/main/docker/Dockerfile</dockerFile> | ||
</build> | ||
<run> | ||
<ports> | ||
<port>8080:8080</port> | ||
</ports> | ||
<wait> | ||
<http> | ||
<url>http://localhost:8080/helloworld.html</url> | ||
</http> | ||
<time>20000</time> | ||
</wait> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>start</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>build</goal> | ||
<goal>start</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>stop</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${maven-compiler-plugin.version}</version> | ||
<configuration> | ||
<release>${java.version}</release> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven-failsafe-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>${maven-war-plugin.version}</version> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM ghcr.io/piranhacloud/webprofile:23.12.0 | ||
USER piranha | ||
COPY target/image.war /home/piranha/ROOT.war | ||
CMD ["java", "-jar", "piranha-dist-webprofile.jar", "--war-file", "ROOT.war"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<title>Hello World</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</head> | ||
<body> | ||
<div>Hello World!</div> | ||
</body> | ||
</html> |
22 changes: 22 additions & 0 deletions
22
webprofile/image/src/test/java/helloworld/HelloWorldIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package helloworld; | ||
|
||
import java.net.URI; | ||
import java.net.http.HttpClient; | ||
import java.net.http.HttpRequest; | ||
import java.net.http.HttpResponse; | ||
import java.net.http.HttpResponse.BodyHandlers; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class HelloWorldIT { | ||
|
||
@Test | ||
void testHelloWorldHtml() throws Exception { | ||
HttpClient client = HttpClient.newHttpClient(); | ||
HttpRequest request = HttpRequest | ||
.newBuilder(new URI("http://localhost:8080/helloworld.html")) | ||
.build(); | ||
HttpResponse<String> response = client.send(request, BodyHandlers.ofString()); | ||
assertTrue(response.body().contains("Hello World!")); | ||
} | ||
} |