From 5ae363d4e1d9f904e5cf895cf5ebba941ee69fa4 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 13 Oct 2022 09:54:27 -0500 Subject: [PATCH] Increasing reliability of test on ee9/ee8 --- .../annotation/LifeCycleCallbackCollectionTest.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/jetty-ee9/jetty-ee9-plus/src/test/java/org/eclipse/jetty/ee9/plus/annotation/LifeCycleCallbackCollectionTest.java b/jetty-ee9/jetty-ee9-plus/src/test/java/org/eclipse/jetty/ee9/plus/annotation/LifeCycleCallbackCollectionTest.java index 277f8fa03be..72d3981cf11 100644 --- a/jetty-ee9/jetty-ee9-plus/src/test/java/org/eclipse/jetty/ee9/plus/annotation/LifeCycleCallbackCollectionTest.java +++ b/jetty-ee9/jetty-ee9-plus/src/test/java/org/eclipse/jetty/ee9/plus/annotation/LifeCycleCallbackCollectionTest.java @@ -14,12 +14,14 @@ package org.eclipse.jetty.ee9.plus.annotation; import java.lang.reflect.Method; +import java.nio.file.Path; import jakarta.servlet.http.HttpServlet; import org.eclipse.jetty.ee9.servlet.ServletHolder; import org.eclipse.jetty.ee9.webapp.WebAppContext; import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; +import org.eclipse.jetty.toolchain.test.FS; +import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -170,11 +172,16 @@ public class LifeCycleCallbackCollectionTest } @Test - public void testServletPostConstructPreDestroy() throws Exception + public void testServletPostConstructPreDestroy(WorkDir workDir) throws Exception { + // Start with an empty dir + Path testDir = workDir.getEmptyPathDir(); + Server server = new Server(); WebAppContext context = new WebAppContext(); - context.setResourceBase(MavenTestingUtils.getTargetTestingDir("predestroy-test").toURI().toURL().toString()); + Path predestroyTestDir = testDir.resolve("predestroy-test"); + FS.ensureDirExists(predestroyTestDir); + context.setBaseResource(predestroyTestDir); context.setContextPath("/"); server.setHandler(context);