From 532e08fdfed3c290f92fe4488572ddd1c9a87f31 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Tue, 7 Jun 2022 20:52:17 +0300 Subject: [PATCH] Fix struts latest dep tests (#6143) --- .../src/test/groovy/Struts2ActionSpanTest.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy b/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy index bda4006f3a0b..2446b712afed 100644 --- a/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy +++ b/instrumentation/struts-2.3/javaagent/src/test/groovy/Struts2ActionSpanTest.groovy @@ -13,6 +13,9 @@ import io.opentelemetry.sdk.trace.data.SpanData import io.opentelemetry.semconv.trace.attributes.SemanticAttributes import io.opentelemetry.struts.GreetingServlet import org.eclipse.jetty.server.Server +import org.eclipse.jetty.server.session.HashSessionIdManager +import org.eclipse.jetty.server.session.HashSessionManager +import org.eclipse.jetty.server.session.SessionHandler import org.eclipse.jetty.servlet.DefaultServlet import org.eclipse.jetty.servlet.ServletContextHandler import org.eclipse.jetty.util.resource.FileResource @@ -105,6 +108,14 @@ class Struts2ActionSpanTest extends HttpServerTest implements AgentTestT context.setBaseResource(resource) server.setHandler(context) + def sessionIdManager = new HashSessionIdManager() + server.setSessionIdManager(sessionIdManager) + def sessionManager = new HashSessionManager() + def sessionHandler = new SessionHandler(sessionManager) + context.setHandler(sessionHandler) + // disable adding jsessionid to url, affects redirect test + context.setInitParameter("org.eclipse.jetty.servlet.SessionIdPathParameterName", "none") + context.addServlet(DefaultServlet, "/") context.addServlet(GreetingServlet, "/greetingServlet") def strutsFilterClass = null