Using WorkDir properly
This commit is contained in:
parent
5148de7105
commit
a8e81ebb39
|
@ -14,12 +14,14 @@
|
||||||
package org.eclipse.jetty.ee10.plus.annotation;
|
package org.eclipse.jetty.ee10.plus.annotation;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServlet;
|
import jakarta.servlet.http.HttpServlet;
|
||||||
import org.eclipse.jetty.ee10.servlet.ServletHolder;
|
import org.eclipse.jetty.ee10.servlet.ServletHolder;
|
||||||
import org.eclipse.jetty.ee10.webapp.WebAppContext;
|
import org.eclipse.jetty.ee10.webapp.WebAppContext;
|
||||||
import org.eclipse.jetty.server.Server;
|
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.hamcrest.Matchers;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -170,11 +172,16 @@ public class LifeCycleCallbackCollectionTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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();
|
Server server = new Server();
|
||||||
WebAppContext context = new WebAppContext();
|
WebAppContext context = new WebAppContext();
|
||||||
context.setBaseResource(MavenTestingUtils.getTargetTestingDir("predestroy-test").toPath());
|
Path predestroyTestDir = testDir.resolve("predestroy-test");
|
||||||
|
FS.ensureDirExists(predestroyTestDir);
|
||||||
|
context.setBaseResource(predestroyTestDir);
|
||||||
context.setContextPath("/");
|
context.setContextPath("/");
|
||||||
server.setHandler(context);
|
server.setHandler(context);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue