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