fix tests

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
olivier lamy 2020-10-16 13:46:08 +10:00
parent 6726a50e09
commit 6f98b136cf
7 changed files with 31 additions and 10 deletions

View File

@ -18,6 +18,8 @@
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;
@ -33,7 +35,7 @@ public class ClusteredOrphanedSessionTest extends AbstractClusteredOrphanedSessi
public static void setup() throws Exception
{
__testSupport = new InfinispanTestSupport();
__testSupport.setup();
__testSupport.setup(Files.createTempDirectory(ClusteredOrphanedSessionTest.class.getName()));
}
@AfterAll

View File

@ -18,6 +18,8 @@
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;
@ -36,7 +38,7 @@ public class ClusteredSerializedSessionScavengingTest extends AbstractClusteredS
__testSupport = new InfinispanTestSupport();
__testSupport.setUseFileStore(true);
__testSupport.setSerializeSessionData(true);
__testSupport.setup();
__testSupport.setup(Files.createTempDirectory(ClusteredSerializedSessionScavengingTest.class.getName()));
}
@AfterAll

View File

@ -18,6 +18,8 @@
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;
@ -35,7 +37,7 @@ public class ClusteredSessionScavengingTest extends AbstractClusteredSessionScav
{
__testSupport = new InfinispanTestSupport();
__testSupport.setUseFileStore(true);
__testSupport.setup();
__testSupport.setup(Files.createTempDirectory(ClusteredSessionScavengingTest.class.getName()));
}
@AfterAll

View File

@ -18,20 +18,26 @@
package org.eclipse.jetty.server.session;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
/**
* HotInitInfinispanSessionDataStoreTest
*/
@ExtendWith(WorkDirExtension.class)
public class InfinispanFileSessionDataStoreTest extends InfinispanSessionDataStoreTest
{
public WorkDir workDir;
@BeforeEach
public void setup() throws Exception
{
_testSupport = new InfinispanTestSupport();
_testSupport.setUseFileStore(true);
_testSupport.setup();
_testSupport.setup(workDir.getEmptyPathDir());
}
}

View File

@ -22,12 +22,15 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.session.infinispan.InfinispanSessionData;
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStore;
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
import org.infinispan.query.Search;
import org.infinispan.query.dsl.Query;
import org.infinispan.query.dsl.QueryFactory;
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;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -35,16 +38,19 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* InfinispanSessionDataStoreTest
*/
@ExtendWith(WorkDirExtension.class)
public class InfinispanSessionDataStoreTest extends AbstractSessionDataStoreTest
{
public InfinispanTestSupport _testSupport;
public WorkDir workDir;
@BeforeEach
public void setup() throws Exception
{
_testSupport = new InfinispanTestSupport();
_testSupport.setup();
_testSupport.setup(workDir.getEmptyPathDir());
}
@AfterEach

View File

@ -45,10 +45,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* InfinispanTestSupport
*/
@ExtendWith(WorkDirExtension.class)
public class InfinispanTestSupport
{
public WorkDir workDir;
public static final String DEFAULT_CACHE_NAME = "session_test_cache";
public Cache _cache;
@ -100,9 +98,8 @@ public class InfinispanTestSupport
return _cache;
}
public void setup() throws Exception
public void setup(Path root) throws Exception
{
Path root = workDir.getEmptyPathDir();
Path indexesDir = root.resolve("indexes");
FS.ensureDirExists(indexesDir);

View File

@ -22,12 +22,15 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.session.infinispan.InfinispanSessionData;
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStore;
import org.eclipse.jetty.session.infinispan.InfinispanSessionDataStoreFactory;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
import org.infinispan.query.Search;
import org.infinispan.query.dsl.Query;
import org.infinispan.query.dsl.QueryFactory;
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;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -35,17 +38,20 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* SerializedInfinispanSessionDataStoreTest
*/
@ExtendWith(WorkDirExtension.class)
public class SerializedInfinispanSessionDataStoreTest extends AbstractSessionDataStoreTest
{
public InfinispanTestSupport _testSupport;
public WorkDir workDir;
@BeforeEach
public void setup() throws Exception
{
_testSupport = new InfinispanTestSupport();
_testSupport.setSerializeSessionData(true);
_testSupport.setup();
_testSupport.setup(workDir.getEmptyPathDir());
}
@AfterEach