Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions for CI #2367

Merged
merged 3 commits into from May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/maven.yml
@@ -0,0 +1,72 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
build:

runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest ]
java: ['1.8', '11']
wildfly-version: ['18.0.1.Final', '19.0.0.Final']

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build with Maven Java ${{ matrix.java }} on WildFly ${{ matrix.wildfly-version }}
run: mvn clean install -fae '-Dserver.version=${{ matrix.wildfly-version }}'
- uses: actions/upload-artifact@v2
if: always()
with:
name: surefire-reports-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.wildfly-version }}.zip
path: '**/surefire-reports/*.txt'
- uses: actions/upload-artifact@v2
if: always()
with:
name: server-logs-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.wildfly-version }}.zip
path: '**/server.log'

build-java-docs:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
java: ['1.8', '11']
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-javadoc
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build Java Docs with Java ${{ matrix.java }}
run: mvn clean install -DskipTests '-Dmaven.javadoc.skip=false' javadoc:javadoc

Expand Up @@ -90,7 +90,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
.get();

assertEquals(200, response.getStatus());
assertEquals("Success\n", response.readEntity(String.class));
assertEquals("Success" + System.lineSeparator(), response.readEntity(String.class));
}

@Test
Expand All @@ -117,7 +117,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques

Response response = cs.toCompletableFuture().get();
assertEquals(200, response.getStatus());
assertEquals("Success\n", response.readEntity(String.class));
assertEquals("Success" + System.lineSeparator(), response.readEntity(String.class));
}

@Test
Expand All @@ -143,7 +143,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
.get(String.class);

String response = cs.toCompletableFuture().get();
assertEquals("Success\n", response);
assertEquals("Success" + System.lineSeparator(), response);
}

@Test
Expand Down Expand Up @@ -242,7 +242,7 @@ public void write(OutputStream output) throws IOException, WebApplicationExcepti
@Test
public void testFilterBufferReplay() throws Exception {
final String greeting = "Success";
final byte[] expected = (greeting + '\n').getBytes(StandardCharsets.UTF_8);
final byte[] expected = (greeting + System.lineSeparator()).getBytes(StandardCharsets.UTF_8);
server.setHandler(new AbstractHandler() {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
Expand Down
17 changes: 0 additions & 17 deletions resteasy-core-spi/pom.xml
Expand Up @@ -99,23 +99,6 @@
<artifactId>clover-maven-plugin</artifactId>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalDependencies>
<additionalDependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-core</artifactId>
<version>${project.version}</version>
</additionalDependency>
</additionalDependencies>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
Expand Down
Expand Up @@ -63,7 +63,7 @@ public static void before() throws Exception {
public static void after() throws Exception {

contextBuilder.cleanup();
httpServer.stop(0);
httpServer.stop(1);
Thread.sleep(100);
}

Expand Down
Expand Up @@ -65,7 +65,8 @@ public SunHttpJaxrsServer start()
public void stop()
{
runtimePort = -1;
httpServer.stop(0);
// Stop with an arbitrary 10 second delay. This was taken from the VertxJaxrsServer.
httpServer.stop(10);
context.cleanup();

if (deployment != null) {
Expand Down
Expand Up @@ -56,7 +56,7 @@ public static void before() throws Exception
public static void after() throws Exception
{
contextBuilder.cleanup();
httpServer.stop(0);
httpServer.stop(1);
}

@Test
Expand Down
Expand Up @@ -8,6 +8,7 @@
import org.junit.Test;

import java.net.InetSocketAddress;
import java.util.regex.Pattern;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
Expand Down Expand Up @@ -44,7 +45,7 @@ public static void before() throws Exception
public static void after() throws Exception
{
contextBuilder.cleanup();
httpServer.stop(0);
httpServer.stop(1);
}

@Test
Expand Down Expand Up @@ -79,7 +80,9 @@ public void testNoDefaultsResource() throws Exception
{
Response response = client.target(generateURL("/request")).request().get();
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("127.0.0.1/localhost", response.readEntity(String.class));
final String val = response.readEntity(String.class);
final String pattern = "^127.0.0.1/.+";
Assert.assertTrue(String.format("Expected value '%s' to match pattern '%s'", val, pattern), Pattern.matches(pattern, val));
}
}

Expand Down
Expand Up @@ -2,6 +2,8 @@

import static org.jboss.resteasy.test.TestPortProvider.createProxy;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
import static org.jboss.resteasy.test.TestPortProvider.getHost;
import static org.jboss.resteasy.test.TestPortProvider.getPort;

import java.util.List;

Expand Down Expand Up @@ -289,7 +291,7 @@ public HttpContext getContext()
{
// Generate BASIC scheme object and add it to the local auth cache
BasicScheme basicAuth = new BasicScheme();
HttpHost targetHost = new HttpHost("localhost", 8081);
HttpHost targetHost = new HttpHost(getHost(), getPort());
authCache.put(targetHost, basicAuth);

// Add AuthCache to the execution context
Expand Down
Expand Up @@ -9,6 +9,7 @@
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Locale;
import java.util.regex.Pattern;

import javax.ws.rs.GET;
import javax.ws.rs.HttpMethod;
Expand Down Expand Up @@ -296,6 +297,7 @@ public void testRequest() throws Exception
{
WebTarget target = client.target(generateURL("/request"));
String val = target.request().get(String.class);
Assert.assertEquals("127.0.0.1/localhost", val);
final String pattern = "^127.0.0.1/.+";
Assert.assertTrue(String.format("Expected value '%s' to match pattern '%s'", val, pattern), Pattern.matches(pattern, val));
}
}
Expand Up @@ -101,7 +101,7 @@ private ResteasyClient createClientWithCertificate(SSLContext sslContext, String
}

private String callRestService(Client client) {
WebTarget target = client.target("https://localhost:8081/test");
WebTarget target = client.target(String.format("https://%s:%d/test", TestPortProvider.getHost(), TestPortProvider.getPort()));
return target.request().get(String.class);
}

Expand Down
Expand Up @@ -94,9 +94,10 @@ public void testEmbed() throws Exception
deployment.getRegistry().addPerInstanceResource(Resource.class);
Vertx vertx = Vertx.vertx();
Client client = ClientBuilder.newClient();
HttpServer server = null;
try
{
HttpServer server = vertx.createHttpServer();
server = vertx.createHttpServer();
server.requestHandler(new VertxRequestHandler(vertx, deployment));
CompletableFuture<Void> listenLatch = new CompletableFuture<>();
server.listen(TestPortProvider.getPort(), ar -> {
Expand All @@ -115,6 +116,9 @@ public void testEmbed() throws Exception
} finally
{
client.close();
if (server != null) {
server.close();
}
vertx.close();
deployment.stop();
}
Expand Down
Expand Up @@ -9,6 +9,7 @@
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Locale;
import java.util.regex.Pattern;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
Expand Down Expand Up @@ -314,6 +315,7 @@ public void testRequest() throws Exception
{
WebTarget target = client.target(generateURL("/request"));
String val = target.request().get(String.class);
Assert.assertEquals("127.0.0.1/127.0.0.1", val);
final String pattern = "^127.0.0.1/.+";
Assert.assertTrue(String.format("Expected value '%s' to match pattern '%s'", val, pattern), Pattern.matches(pattern, val));
}
}
6 changes: 6 additions & 0 deletions testsuite/arquillian-utils/pom.xml
Expand Up @@ -212,6 +212,12 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>8</source>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
Expand Down
Expand Up @@ -114,7 +114,9 @@ public void testAsync() throws Exception {
long end = System.currentTimeMillis() - start;
Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
Assert.assertEquals("Wrong content of response", "hello", response.readEntity(String.class));
Assert.assertTrue("Wrong time of request", end < 1000); // should take less than 1 second
// The time out is set to 2 seconds, this is a best guess test and if future failures are present this should be
// reconsidered with some sort of offset.
Assert.assertTrue("Wrong time of request", end < 2000);
response.close();
client.close();
}
Expand Down
@@ -1,5 +1,6 @@
package org.jboss.resteasy.test.resource.request;

import java.util.regex.Pattern;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
Expand Down Expand Up @@ -63,7 +64,9 @@ public void testRequest() {
try {
Response response = requestWebTarget.request().get();
Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus());
Assert.assertEquals("127.0.0.1/127.0.0.1", response.readEntity(String.class));
final String val = response.readEntity(String.class);
final String pattern = "^127.0.0.1/.+";
Assert.assertTrue(String.format("Expected value '%s' to match pattern '%s'", val, pattern), Pattern.matches(pattern, val));
response.close();
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
32 changes: 30 additions & 2 deletions testsuite/microprofile-tck/pom.xml
Expand Up @@ -14,6 +14,10 @@
<name>MicroProfile Rest Client TCK</name>
<packaging>jar</packaging>

<properties>
<skip.mp.tck>false</skip.mp.tck>
</properties>

<dependencies>

<!-- REST Client implementation-->
Expand Down Expand Up @@ -111,23 +115,33 @@
<plugin>
<groupId>uk.co.automatictester</groupId>
<artifactId>wiremock-maven-plugin</artifactId>
<version>4.1.0</version>
<version>6.0.0</version>
<executions>
<execution>
<phase>generate-test-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skip.mp.tck}</skip>
<dir>target/classes</dir>
<params>--port=8765</params>
</configuration>
</execution>
</executions>
</executions><dependencies>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock</artifactId>
<version>2.26.3</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${skip.mp.tck}</skip>
</configuration>
<executions>
<execution>
<id>default-test</id>
Expand All @@ -149,4 +163,18 @@

</plugins>
</build>

<profiles>
<profile>
<id>skip-mp-tck</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<properties>
<skip.mp.tck>true</skip.mp.tck>
</properties>
</profile>
</profiles>
</project>
Expand Up @@ -109,6 +109,6 @@ public interface ContextConfigurator {

@Override
protected void after() {
server.stop(0);
server.stop(1);
}
}