diff --git a/instrumentation/grizzly-2.0/grizzly-2.0.gradle b/instrumentation/grizzly-2.0/grizzly-2.0.gradle index 4e3e1a4a34..cf47173ac2 100644 --- a/instrumentation/grizzly-2.0/grizzly-2.0.gradle +++ b/instrumentation/grizzly-2.0/grizzly-2.0.gradle @@ -4,12 +4,10 @@ apply plugin: 'org.unbroken-dome.test-sets' muzzle { pass { group = "org.glassfish.grizzly" - module = 'grizzly-http-server' + module = 'grizzly-http' versions = "[2.0,)" assertInverse = true } - // Not bothering to test against 1.x since it has a different package name. - // https://mvnrepository.com/artifact/com.sun.grizzly/grizzly-http } testSets { @@ -19,16 +17,13 @@ testSets { } dependencies { - compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.0' - compile project(':instrumentation:grizzly-http-2.0') + compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http', version: '2.0' testCompile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' testCompile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0' - testCompile group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.0' testCompile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.0' - latestDepTestCompile group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '+' latestDepTestCompile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.+' latestDepTestCompile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.+' } diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainAdvice.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/DefaultFilterChainInstrumentation.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/ExtractAdapter.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterAdvice.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/FilterInstrumentation.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/GrizzlyDecorator.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterAdvice.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterInstrumentation.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpCodecFilterOldAdvice.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterAdvice.java diff --git a/instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java b/instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java similarity index 100% rename from instrumentation/grizzly-http-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java rename to instrumentation/grizzly-2.0/src/main/java/io/opentelemetry/auto/instrumentation/grizzly/HttpServerFilterInstrumentation.java diff --git a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy b/instrumentation/grizzly-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy similarity index 100% rename from instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy rename to instrumentation/grizzly-2.0/src/test/groovy/GrizzlyFilterchainServerTest.groovy diff --git a/instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle b/instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle deleted file mode 100644 index cf47173ac2..0000000000 --- a/instrumentation/grizzly-http-2.0/grizzly-http-2.0.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply from: "$rootDir/gradle/instrumentation.gradle" -apply plugin: 'org.unbroken-dome.test-sets' - -muzzle { - pass { - group = "org.glassfish.grizzly" - module = 'grizzly-http' - versions = "[2.0,)" - assertInverse = true - } -} - -testSets { - latestDepTest { - dirName = 'test' - } -} - -dependencies { - - compileOnly group: 'org.glassfish.grizzly', name: 'grizzly-http', version: '2.0' - - testCompile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3' - testCompile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0' - testCompile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.0' - - latestDepTestCompile group: 'org.glassfish.jersey.containers', name: 'jersey-container-grizzly2-http', version: '2.+' - latestDepTestCompile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.+' -} diff --git a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyAsyncTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyAsyncTest.groovy deleted file mode 100644 index bff204903d..0000000000 --- a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyAsyncTest.groovy +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.glassfish.grizzly.http.server.HttpServer -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory -import org.glassfish.jersey.server.ResourceConfig - -import javax.ws.rs.GET -import javax.ws.rs.Path -import javax.ws.rs.QueryParam -import javax.ws.rs.container.AsyncResponse -import javax.ws.rs.container.Suspended -import javax.ws.rs.core.Response -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors - -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.ERROR -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.EXCEPTION -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.REDIRECT -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.SUCCESS - -class GrizzlyAsyncTest extends GrizzlyTest { - - @Override - HttpServer startServer(int port) { - ResourceConfig rc = new ResourceConfig() - rc.register(SimpleExceptionMapper) - rc.register(AsyncServiceResource) - GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:$port"), rc) - } - - @Path("/") - static class AsyncServiceResource { - private ExecutorService executor = Executors.newSingleThreadExecutor() - - @GET - @Path("success") - void success(@Suspended AsyncResponse ar) { - executor.execute { - controller(SUCCESS) { - ar.resume(Response.status(SUCCESS.status).entity(SUCCESS.body).build()) - } - } - } - - @GET - @Path("query") - Response query_param(@QueryParam("some") String param, @Suspended AsyncResponse ar) { - controller(QUERY_PARAM) { - ar.resume(Response.status(QUERY_PARAM.status).entity("some=$param".toString()).build()) - } - } - - @GET - @Path("redirect") - void redirect(@Suspended AsyncResponse ar) { - executor.execute { - controller(REDIRECT) { - ar.resume(Response.status(REDIRECT.status).location(new URI(REDIRECT.body)).build()) - } - } - } - - @GET - @Path("error-status") - void error(@Suspended AsyncResponse ar) { - executor.execute { - controller(ERROR) { - ar.resume(Response.status(ERROR.status).entity(ERROR.body).build()) - } - } - } - - @GET - @Path("exception") - void exception(@Suspended AsyncResponse ar) { - executor.execute { - try { - controller(EXCEPTION) { - throw new Exception(EXCEPTION.body) - } - } catch (Exception e) { - ar.resume(e) - } - } - } - } -} diff --git a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java deleted file mode 100644 index 70b203a92c..0000000000 --- a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyFilterchainServerTestInstrumentation.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static net.bytebuddy.matcher.ElementMatchers.named; -import static net.bytebuddy.matcher.ElementMatchers.takesArgument; - -import com.google.auto.service.AutoService; -import io.opentelemetry.auto.test.base.HttpServerTestAdvice; -import io.opentelemetry.auto.tooling.Instrumenter; -import net.bytebuddy.agent.builder.AgentBuilder; - -@AutoService(Instrumenter.class) -public class GrizzlyFilterchainServerTestInstrumentation implements Instrumenter { - - @Override - public AgentBuilder instrument(final AgentBuilder agentBuilder) { - return agentBuilder - .type(named("org.glassfish.grizzly.http.HttpCodecFilter")) - .transform( - new AgentBuilder.Transformer.ForAdvice() - .advice( - named("handleRead") - .and( - takesArgument( - 0, named("org.glassfish.grizzly.filterchain.FilterChainContext"))), - HttpServerTestAdvice.ServerEntryAdvice.class.getName())); - } -} diff --git a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyIOStrategyTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyIOStrategyTest.groovy deleted file mode 100644 index d83fa930c1..0000000000 --- a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyIOStrategyTest.groovy +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import org.glassfish.grizzly.IOStrategy -import org.glassfish.grizzly.http.server.HttpServer -import org.glassfish.grizzly.strategies.LeaderFollowerNIOStrategy -import org.glassfish.grizzly.strategies.SameThreadIOStrategy -import org.glassfish.grizzly.strategies.SimpleDynamicNIOStrategy -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory -import org.glassfish.jersey.server.ResourceConfig - -abstract class GrizzlyIOStrategyTest extends GrizzlyTest { - - static { - System.setProperty("ota.integration.grizzly-http.enabled", "true") - } - - @Override - HttpServer startServer(int port) { - ResourceConfig rc = new ResourceConfig() - rc.register(SimpleExceptionMapper) - rc.register(ServiceResource) - def server = GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:$port"), rc) - server.getListener("grizzly").getTransport().setIOStrategy(strategy()) - // Default in NIOTransportBuilder is WorkerThreadIOStrategy, so don't need to retest that.s - return server - } - - abstract IOStrategy strategy() -} - -class LeaderFollowerTest extends GrizzlyIOStrategyTest { - - @Override - IOStrategy strategy() { - return LeaderFollowerNIOStrategy.instance - } -} - -class SameThreadTest extends GrizzlyIOStrategyTest { - - @Override - IOStrategy strategy() { - return SameThreadIOStrategy.instance - } -} - -class SimpleDynamicTest extends GrizzlyIOStrategyTest { - - @Override - IOStrategy strategy() { - return SimpleDynamicNIOStrategy.instance - } -} diff --git a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy b/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy deleted file mode 100644 index 467d477dff..0000000000 --- a/instrumentation/grizzly-http-2.0/src/test/groovy/GrizzlyTest.groovy +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import io.opentelemetry.auto.test.base.HttpServerTest -import org.glassfish.grizzly.http.server.HttpServer -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory -import org.glassfish.jersey.server.ResourceConfig - -import javax.ws.rs.GET -import javax.ws.rs.NotFoundException -import javax.ws.rs.Path -import javax.ws.rs.QueryParam -import javax.ws.rs.core.Response -import javax.ws.rs.ext.ExceptionMapper - -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.ERROR -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.EXCEPTION -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.QUERY_PARAM -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.REDIRECT -import static io.opentelemetry.auto.test.base.HttpServerTest.ServerEndpoint.SUCCESS - -class GrizzlyTest extends HttpServerTest { - - static { - System.setProperty("ota.integration.grizzly.enabled", "true") - } - - @Override - HttpServer startServer(int port) { - ResourceConfig rc = new ResourceConfig() - rc.register(SimpleExceptionMapper) - rc.register(ServiceResource) - GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:$port"), rc) - } - - @Override - void stopServer(HttpServer server) { - server.stop() - } - - static class SimpleExceptionMapper implements ExceptionMapper { - - @Override - Response toResponse(Throwable exception) { - if (exception instanceof NotFoundException) { - return exception.getResponse() - } - Response.status(500).entity(exception.message).build() - } - } - - @Path("/") - static class ServiceResource { - - @GET - @Path("success") - Response success() { - controller(SUCCESS) { - Response.status(SUCCESS.status).entity(SUCCESS.body).build() - } - } - - @GET - @Path("query") - Response query_param(@QueryParam("some") String param) { - controller(QUERY_PARAM) { - Response.status(QUERY_PARAM.status).entity("some=$param".toString()).build() - } - } - - @GET - @Path("redirect") - Response redirect() { - controller(REDIRECT) { - Response.status(REDIRECT.status).location(new URI(REDIRECT.body)).build() - } - } - - @GET - @Path("error-status") - Response error() { - controller(ERROR) { - Response.status(ERROR.status).entity(ERROR.body).build() - } - } - - @GET - @Path("exception") - Response exception() { - controller(EXCEPTION) { - throw new Exception(EXCEPTION.body) - } - return null - } - } -} diff --git a/settings.gradle b/settings.gradle index ec635245cb..2c9a1f1ddb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -68,7 +68,6 @@ include ':instrumentation:geode-1.4' include ':instrumentation:google-http-client-1.19' include ':instrumentation:grizzly-2.0' include ':instrumentation:grizzly-client-1.9' -include ':instrumentation:grizzly-http-2.0' include ':instrumentation:grpc-1.5' include ':instrumentation:hibernate:hibernate-3.3' include ':instrumentation:hibernate:hibernate-4.0'