Issue #5451 - Proper use of WorkDir
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
6f98b136cf
commit
369940c8b6
|
@ -28,6 +28,7 @@ import java.util.HashSet;
|
|||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpTester;
|
||||
|
@ -69,7 +70,7 @@ public class PutFilterTest
|
|||
tester.addServlet(org.eclipse.jetty.servlet.DefaultServlet.class, "/");
|
||||
FilterHolder holder = tester.addFilter(PutFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
|
||||
holder.setInitParameter("delAllowed", "true");
|
||||
tester.setAttribute("javax.servlet.context.tempdir", workDir.getPath().toFile());
|
||||
tester.setAttribute(ServletContext.TEMPDIR, workDir.getPath().toFile());
|
||||
// Bloody Windows does not allow file renaming
|
||||
if (!System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"))
|
||||
holder.setInitParameter("putAtomic", "true");
|
||||
|
|
|
@ -18,30 +18,33 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
/**
|
||||
* ClusteredOrphanedSessionTest
|
||||
*/
|
||||
@ExtendWith(WorkDirExtension.class)
|
||||
public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessionTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
public WorkDir workDir;
|
||||
public InfinispanTestSupport testSupport;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() throws Exception
|
||||
@BeforeEach
|
||||
public void setup() throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setup(Files.createTempDirectory(ClusteredOrphanedSessionTest.class.getName()));
|
||||
testSupport = new InfinispanTestSupport();
|
||||
testSupport.setup(workDir.getEmptyPathDir());
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void teardown() throws Exception
|
||||
@AfterEach
|
||||
public void teardown() throws Exception
|
||||
{
|
||||
__testSupport.teardown();
|
||||
testSupport.teardown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +54,7 @@ public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessi
|
|||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
factory.setCache(testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,34 +18,37 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
/**
|
||||
* ClusteredSerializedSessionScavengingTest
|
||||
*/
|
||||
@ExtendWith(WorkDirExtension.class)
|
||||
public class ClusteredSerializedSessionScavengingTest extends AbstractClusteredSessionScavengingTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
public WorkDir workDir;
|
||||
public static InfinispanTestSupport testSupport;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() throws Exception
|
||||
@BeforeEach
|
||||
public void setup() throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setUseFileStore(true);
|
||||
__testSupport.setSerializeSessionData(true);
|
||||
__testSupport.setup(Files.createTempDirectory(ClusteredSerializedSessionScavengingTest.class.getName()));
|
||||
testSupport = new InfinispanTestSupport();
|
||||
testSupport.setUseFileStore(true);
|
||||
testSupport.setSerializeSessionData(true);
|
||||
testSupport.setup(workDir.getEmptyPathDir());
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void teardown() throws Exception
|
||||
@AfterEach
|
||||
public void teardown() throws Exception
|
||||
{
|
||||
if (__testSupport != null)
|
||||
__testSupport.teardown();
|
||||
if (testSupport != null)
|
||||
testSupport.teardown();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +66,7 @@ public class ClusteredSerializedSessionScavengingTest extends AbstractClusteredS
|
|||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
factory.setCache(testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,33 +18,36 @@
|
|||
|
||||
package org.eclipse.jetty.server.session;
|
||||
|
||||
import java.nio.file.Files;
|
||||
|
||||
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
|
||||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
/**
|
||||
* ClusteredSessionScavengingTest
|
||||
*/
|
||||
@ExtendWith(WorkDirExtension.class)
|
||||
public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScavengingTest
|
||||
{
|
||||
public static InfinispanTestSupport __testSupport;
|
||||
public WorkDir workDir;
|
||||
public InfinispanTestSupport testSupport;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() throws Exception
|
||||
@BeforeEach
|
||||
public void setup() throws Exception
|
||||
{
|
||||
__testSupport = new InfinispanTestSupport();
|
||||
__testSupport.setUseFileStore(true);
|
||||
__testSupport.setup(Files.createTempDirectory(ClusteredSessionScavengingTest.class.getName()));
|
||||
testSupport = new InfinispanTestSupport();
|
||||
testSupport.setUseFileStore(true);
|
||||
testSupport.setup(workDir.getEmptyPathDir());
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void teardown() throws Exception
|
||||
@AfterEach
|
||||
public void teardown() throws Exception
|
||||
{
|
||||
if (__testSupport != null)
|
||||
__testSupport.teardown();
|
||||
if (testSupport != null)
|
||||
testSupport.teardown();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +65,7 @@ public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScav
|
|||
public SessionDataStoreFactory createSessionDataStoreFactory()
|
||||
{
|
||||
InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory();
|
||||
factory.setCache(__testSupport.getCache());
|
||||
factory.setCache(testSupport.getCache());
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue