Skip to content

Commit

Permalink
Merge branch 'current' into issue-4262
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Nov 24, 2024
2 parents b1b972d + ecbe5af commit 3bda93c
Show file tree
Hide file tree
Showing 22 changed files with 93 additions and 13 deletions.
5 changes: 1 addition & 4 deletions dist/micro/src/site/site.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<project
xmlns="http://maven.apache.org/DECORATION/1.8.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.8.0 https://maven.apache.org/xsd/decoration-1.8.0.xsd">
<project>
<body>
<menu name="Overview">
<item name="Introduction" href="index.html"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -46,12 +47,18 @@ class MicroPiranhaIT {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testCommandLine() throws Exception {
//
// TODO - test is disabled because it does not reliable run on Windows.
// We need to hardening it so it does. It is apparently not
// sufficient to wait 120 seconds.
//
ProcessBuilder builder = new ProcessBuilder();
builder.command("java", "-jar", "target/piranha-dist-micro.jar", "--http-port", System.getProperty("httpPort"));
Process process = builder.start();
Thread.sleep(60000);
Thread.sleep(120000);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(new URI("http://localhost:" + System.getProperty("httpPort") + "/")).build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Expand Down
2 changes: 2 additions & 0 deletions test/micro/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<build>
<finalName>helloworld</finalName>
<plugins>
<!--
<plugin>
<groupId>cloud.piranha.maven</groupId>
<artifactId>piranha-maven-plugin</artifactId>
Expand All @@ -71,6 +72,7 @@
<httpPort>${httpPort}</httpPort>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

class HelloWorldServletIT {

@Disabled
@Test
void testHelloWorld() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand Down
9 changes: 5 additions & 4 deletions test/micro/snoop/src/test/java/snoop/SnoopIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@
*/
package snoop;

import cloud.piranha.test.common.PiranhaStartup;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import java.io.File;
import me.alexpanov.net.FreePortFinder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand Down Expand Up @@ -66,7 +64,7 @@ public class SnoopIT {
*/
@AfterAll
public static void afterAll() {
process.destroyForcibly();
// process.destroyForcibly();
}

/**
Expand All @@ -84,6 +82,7 @@ public void afterEach() {
*/
@BeforeAll
public static void beforeAll() throws Exception {
/*
port = FreePortFinder.findFreeLocalPort();
process = new ProcessBuilder()
.directory(new File("target"))
Expand All @@ -97,6 +96,7 @@ public static void beforeAll() throws Exception {
.start();
PiranhaStartup.waitUntilPiranhaReady(process, port);
*/
}

/**
Expand All @@ -112,6 +112,7 @@ public void beforeEach() {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
public void testSnoop() throws Exception {
HtmlPage page = webClient.getPage("http://localhost:" + port + "/Snoop");
Expand Down
33 changes: 30 additions & 3 deletions test/server/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<properties>
<!-- other -->
<piranha.distribution>server</piranha.distribution>
<piranha.version>${project.version}</piranha.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand All @@ -39,10 +38,28 @@
<build>
<finalName>helloworld</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-network-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<portNames>
<portName>httpPort</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>cloud.piranha.maven</groupId>
<artifactId>piranha-maven-plugin</artifactId>
<version>${piranha.version}</version>
<version>${project.version}</version>
<executions>
<execution>
<id>pre-integration-test</id>
Expand All @@ -60,7 +77,9 @@
</execution>
</executions>
<configuration>
<distribution>${piranha.distribution}</distribution>
<distribution>server</distribution>
<httpPort>${httpPort}</httpPort>
<startTimeout>60</startTimeout>
</configuration>
</plugin>
<plugin>
Expand All @@ -83,6 +102,14 @@
</goals>
</execution>
</executions>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<rerunFailingTestsCount>50</rerunFailingTestsCount>
<systemPropertyVariables>
<httpPort>${httpPort}</httpPort>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,23 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

class HelloWorldIT {

/*
* TODO - local runs on Windows do have some measure of success. However
* because the test is a flake we have disabled it pending
* hardening of the Piranha Maven plugin.
*/
@Disabled
@Test
void testHelloWorldHtml() throws Exception {
Thread.sleep(3000);
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest
.newBuilder(new URI("http://localhost:8080/helloworld/helloworld.html"))
.newBuilder(new URI("http://localhost:" + System.getProperty("httpPort") + "/helloworld/helloworld.html"))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
assertTrue(response.body().contains("Hello World!"));
Expand Down
2 changes: 2 additions & 0 deletions test/server/wasp/src/test/java/wasp/HelloTagJspIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -47,6 +48,7 @@ class HelloTagJspIT {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testHelloTagJsp() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand Down
2 changes: 2 additions & 0 deletions test/server/wasp/src/test/java/wasp/HelloTld2JspIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -47,6 +48,7 @@ class HelloTld2JspIT {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testHelloTld2Jsp() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand Down
2 changes: 2 additions & 0 deletions test/server/wasp/src/test/java/wasp/HelloTldJspIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -47,6 +48,7 @@ class HelloTldJspIT {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testHelloTldJsp() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand Down
3 changes: 3 additions & 0 deletions test/server/wasp/src/test/java/wasp/IndexJspIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.net.http.HttpResponse.BodyHandlers;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -48,6 +49,7 @@ class IndexJspIT {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testIndexJsp() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand All @@ -64,6 +66,7 @@ void testIndexJsp() throws Exception {
*
* @throws Exception when a serious error occurs.
*/
@Disabled
@Test
void testIndexJsp2() throws Exception {
HttpClient client = HttpClient.newHttpClient();
Expand Down
3 changes: 3 additions & 0 deletions test/servlet/crac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<build>
<finalName>crac</finalName>
<plugins>
<!--
<plugin>
<groupId>cloud.piranha.maven</groupId>
<artifactId>piranha-maven-plugin</artifactId>
Expand All @@ -90,8 +91,10 @@
<configuration>
<distribution>servlet</distribution>
<httpPort>${httpPort}</httpPort>
<startTimeout>60</startTimeout>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions test/servlet/crac/src/test/java/hello/HelloIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class HelloIT {

private String portNumber = System.getProperty("httpPort");

@Disabled
@Test
public void testHelloXhtml() throws Exception {
HttpClient client = HttpClient
Expand Down
2 changes: 2 additions & 0 deletions test/servlet/faces/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<build>
<finalName>faces</finalName>
<plugins>
<!--
<plugin>
<groupId>cloud.piranha.maven</groupId>
<artifactId>piranha-maven-plugin</artifactId>
Expand All @@ -84,6 +85,7 @@
<httpPort>${httpPort}</httpPort>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions test/servlet/faces/src/test/java/hello/HelloIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class HelloIT {

private String portNumber = System.getProperty("httpPort");

@Disabled
@Test
public void testHelloFacesXhtml() throws Exception {
HttpClient client = HttpClient
Expand Down
2 changes: 2 additions & 0 deletions test/servlet/hello/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<build>
<finalName>piranha-test-servlet-hello</finalName>
<plugins>
<!--
<plugin>
<groupId>cloud.piranha.maven</groupId>
<artifactId>piranha-maven-plugin</artifactId>
Expand All @@ -72,6 +73,7 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
Expand Down
Loading

0 comments on commit 3bda93c

Please sign in to comment.