Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Refactor TCK to use Jetty and RESTEasy 4.x.
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Oct 14, 2020
1 parent 5cfd3f4 commit a541b44
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 412 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ hs_err_pid*
# Intellij Idea
*.iml
.idea/

# formatter cache directories
.cache
61 changes: 33 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
<version.microprofile.opentracing>2.0-RC2</version.microprofile.opentracing>
<version.microprofile.config>2.0-M1</version.microprofile.config>
<version.microprofile.restclient>2.0-RC2</version.microprofile.restclient>
<version.smallrye.config>1.8.6</version.smallrye.config>

<version.opentracing>0.33.0</version.opentracing>
<version.opentracing.jaxrs>1.0.0</version.opentracing.jaxrs>
<version.opentracing.interceptors>0.0.5</version.opentracing.interceptors>
<version.resteasy>3.12.0.Final</version.resteasy>

<version.arquillian.jetty>1.0.0.CR3</version.arquillian.jetty>
<version.jetty>9.4.32.v20200930</version.jetty>
<version.resteasy>4.6.0-SNAPSHOT</version.resteasy>

<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/tck/target/site/jacoco-aggregate/jacoco.xml,${project.basedir}/../tck/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>
Expand Down Expand Up @@ -49,23 +52,23 @@
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-opentracing</artifactId>
<version>1.3.5-SNAPSHOT</version>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-opentracing-tck</artifactId>
<version>1.3.5-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
<version>${version.smallrye.config}</version>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<version>${version.opentracing}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client-microprofile</artifactId>
<version>${version.resteasy}</version>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-interceptors</artifactId>
<version>${version.opentracing.interceptors}</version>
<exclusions>
<exclusion>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -90,36 +93,38 @@
</exclusions>
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.eclipse.microprofile.opentracing</groupId>
<artifactId>microprofile-opentracing-tck</artifactId>
<version>${version.microprofile.opentracing}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.opentracing</groupId>
<artifactId>microprofile-opentracing-tck-rest-client</artifactId>
<version>${version.microprofile.opentracing}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId>
<artifactId>opentracing-mock</artifactId>
<version>${version.opentracing}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentracing</groupId>
<artifactId>opentracing-mock</artifactId>
<version>${version.opentracing}</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>${version.jetty}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-interceptors</artifactId>
<version>${version.opentracing.interceptors}</version>
<exclusions>
<exclusion>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
</exclusion>
</exclusions>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-bom</artifactId>
<version>${version.resteasy}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
123 changes: 32 additions & 91 deletions tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
<groupId>io.smallrye</groupId>
<artifactId>smallrye-opentracing</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client-microprofile</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.microprofile.opentracing</groupId>
<artifactId>microprofile-opentracing-tck</artifactId>
Expand All @@ -38,47 +29,51 @@
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${version.resteasy}</version>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jetty-embedded-9</artifactId>
<version>${version.arquillian.jetty}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>${version.resteasy}</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cdi</artifactId>
<version>${version.resteasy}</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<version>${version.resteasy}</version>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-core</artifactId>
<version>${version.weld.core}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
<scope>provided</scope>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-servlet-initializer</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-cdi</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-core</artifactId>
<version>${version.weld.core}</version>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client-microprofile</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -105,6 +100,7 @@
<skip>true</skip>
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand All @@ -116,61 +112,6 @@
</build>

<profiles>
<profile>
<id>wildfly-servlet</id>
<activation>
<property>
<!-- use property rather than activeByDefault, see https://issues.apache.org/jira/browse/MNG-4917 -->
<name>!noWildflyServlet</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<JBOSS_HOME>${project.build.directory}/wildfly-servlet-${version.wildfly}</JBOSS_HOME>
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-servlet-dist</artifactId>
<version>${version.wildfly}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>coverage</id>
<properties>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package io.smallrye.opentracing;

import java.util.concurrent.ExecutorService;
Expand All @@ -8,7 +7,6 @@
import javax.ws.rs.client.ClientBuilder;

import org.eclipse.microprofile.opentracing.ClientTracingRegistrarProvider;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;

import io.opentracing.Tracer;
import io.opentracing.contrib.concurrent.TracedExecutorService;
Expand All @@ -19,14 +17,12 @@
public class ResteasyClientTracingRegistrarProvider implements ClientTracingRegistrarProvider {

public ClientBuilder configure(ClientBuilder clientBuilder) {
// Make sure executor is the same as a default in resteasy ClientBuilder
return configure(clientBuilder, Executors.newFixedThreadPool(10));
}

public ClientBuilder configure(ClientBuilder clientBuilder, ExecutorService executorService) {
ResteasyClientBuilder resteasyClientBuilder = (ResteasyClientBuilder) clientBuilder;
Tracer tracer = CDI.current().select(Tracer.class).get();
return resteasyClientBuilder.asyncExecutor(new TracedExecutorService(executorService, tracer))
return clientBuilder.executorService(new TracedExecutorService(executorService, tracer))
.register(new SmallRyeClientTracingFeature(tracer));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import java.util.EnumSet;

import javax.enterprise.inject.spi.CDI;
import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration.Dynamic;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import io.opentracing.Tracer;
import io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter;

/**
Expand All @@ -22,14 +20,13 @@ public class ServletContextTracingInstaller implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
ServletContext servletContext = servletContextEvent.getServletContext();
servletContext.setInitParameter("resteasy.providers", SmallRyeTracingDynamicFeature.class.getName());
servletContext.setInitParameter("resteasy.providers",
SmallRyeTracingDynamicFeature.class.getName() + "," + ExceptionMapper.class.getName());

// Span finishing filter
Tracer tracer = CDI.current().select(Tracer.class).get();
Dynamic filterRegistration = servletContext.addFilter("tracingFilter", new SpanFinishingFilter());
filterRegistration.setAsyncSupported(true);
filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class),
true, "*");
filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "*");
}

@Override
Expand Down
Loading

0 comments on commit a541b44

Please # to comment.