Merge branch 'master' of
https://gitbox.apache.org/repos/asf/directory-server
# Conflicts:
# service/src/test/java/org/apache/directory/server/UberJarMainTest.java
diff --git a/core-annotations/pom.xml b/core-annotations/pom.xml
index da5150f..d61876c 100644
--- a/core-annotations/pom.xml
+++ b/core-annotations/pom.xml
@@ -37,6 +37,17 @@
<artifactId>junit-addons</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -90,11 +101,6 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.apache.directory.api</groupId>
<artifactId>api-ldap-codec-standalone</artifactId>
<scope>test</scope>
diff --git a/core-api/pom.xml b/core-api/pom.xml
index a138c95..6774718 100644
--- a/core-api/pom.xml
+++ b/core-api/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java b/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
index 7ab76aa..e4fd0aa 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
@@ -166,16 +166,6 @@
* {@inheritDoc}
*/
@Override
- public Throwable exceptionCaught()
- {
- return null;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public AddResponse add( AddRequest addRequest ) throws LdapException
{
if ( addRequest == null )
@@ -516,6 +506,16 @@
return false;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Throwable exceptionCaught()
+ {
+ return null;
+ }
+
/**
* {@inheritDoc}
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java b/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
index 8902ccb..c021785 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/MockCoreSession.java
@@ -54,10 +54,6 @@
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.util.Strings;
import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.api.CoreSession;
-import org.apache.directory.server.core.api.DirectoryService;
-import org.apache.directory.server.core.api.LdapPrincipal;
-import org.apache.directory.server.core.api.OperationManager;
import org.apache.directory.server.core.api.changelog.LogChange;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.context.AbstractOperationContext;
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java
index 32ac2f2..d7f552e 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/changelog/TagTest.java
@@ -20,16 +20,13 @@
package org.apache.directory.server.core.api.changelog;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
-import org.apache.directory.server.core.api.changelog.Tag;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -37,8 +34,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class TagTest
{
private static Tag tagA;
@@ -52,7 +48,7 @@
/**
* Initialize name instances
*/
- @BeforeClass
+ @BeforeAll
public static void initNames() throws Exception
{
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java
index 3e24a61..1b016b1 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/entry/ClonedServerEntryTest.java
@@ -25,13 +25,10 @@
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.server.core.api.entry.ClonedServerEntry;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -39,8 +36,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class ClonedServerEntryTest
{
private static Entry clonedServerEntryA;
@@ -55,7 +51,7 @@
/**
* Initialize name instances
*/
- @BeforeClass
+ @BeforeAll
public static void initNames() throws Exception
{
Entry eA = new DefaultEntry( "dc=example,dc=com" );
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
index 2f3d5a4..aee93f0 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
@@ -20,13 +20,13 @@
package org.apache.directory.server.core.api.entry;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.Arrays;
@@ -60,9 +60,9 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
@@ -100,7 +100,7 @@
/**
* Initialize the registries once for the whole test suite
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -129,7 +129,7 @@
}
- @Before
+ @BeforeEach
public void init() throws Exception
{
atObjectClass = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java
index f8325f5..38d0572 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareModificationTest.java
@@ -20,11 +20,11 @@
package org.apache.directory.server.core.api.entry;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -47,12 +47,8 @@
import org.apache.directory.api.ldap.schema.loader.LdifSchemaLoader;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
/**
@@ -60,8 +56,6 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
public class SchemaAwareModificationTest
{
private static LdifSchemaLoader loader;
@@ -136,7 +130,7 @@
/**
* Initialize the registries once for the whole test suite
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/normalization/FilterNormalizingVisitorTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/normalization/FilterNormalizingVisitorTest.java
index f24772e..5362dc5 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/normalization/FilterNormalizingVisitorTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/normalization/FilterNormalizingVisitorTest.java
@@ -21,7 +21,7 @@
package org.apache.directory.server.core.api.normalization;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.List;
@@ -36,11 +36,11 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.entry.SchemaAwareEntryTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* A test class for FilterNormalizingVisitor.
@@ -55,7 +55,7 @@
/**
* Initialize the registries once for the whole test suite
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java b/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java
index 0803747..b6867a6 100644
--- a/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java
+++ b/core-api/src/test/java/org/apache/directory/server/core/api/sp/StoredProcUtilsTest.java
@@ -21,16 +21,14 @@
package org.apache.directory.server.core.api.sp;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class StoredProcUtilsTest
{
@Test
diff --git a/core-avl/pom.xml b/core-avl/pom.xml
index fdda575..935d5d4 100644
--- a/core-avl/pom.xml
+++ b/core-avl/pom.xml
@@ -31,8 +31,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeCursorTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeCursorTest.java
index 4393fb1..9012212 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeCursorTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeCursorTest.java
@@ -20,20 +20,18 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Comparator;
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -41,8 +39,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class ArrayTreeCursorTest
{
@Test
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeTest.java
index 5ea7f50..e3caf23 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/ArrayTreeTest.java
@@ -20,32 +20,29 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Comparator;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
/**
* An AVL tree testcase.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class ArrayTreeTest
{
private static final Integer MINUS_ONE = Integer.valueOf( -1 );
@@ -349,7 +346,7 @@
for ( int key : expectedKeys )
{
- assertNotNull( "Should find " + key, tree.find( key ) );
+ assertNotNull( tree.find( key ), "Should find " + key );
}
}
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeCursorTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeCursorTest.java
index 6ed121b..ccc31d7 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeCursorTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeCursorTest.java
@@ -20,20 +20,18 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Comparator;
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -41,8 +39,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreeCursorTest
{
@Test
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsCursorTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsCursorTest.java
index d7adddc..0be1ea8 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsCursorTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsCursorTest.java
@@ -20,19 +20,22 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.Comparator;
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.api.ldap.model.cursor.Tuple;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -41,6 +44,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreeMapNoDupsCursorTest
{
AvlTreeMap<Integer, Integer> tree;
@@ -48,7 +52,7 @@
AvlSingletonOrOrderedSetCursor<Integer, Integer> cursor;
- @Before
+ @BeforeEach
public void createTree()
{
Comparator<Integer> comparator = new Comparator<Integer>()
@@ -67,7 +71,7 @@
}
- @After
+ @AfterEach
public void cleanup() throws Exception
{
cursor.close();
@@ -441,17 +445,17 @@
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testAfterValue() throws Exception
{
- cursor.afterValue( 0, null );
+ assertThrows( UnsupportedOperationException.class, () -> cursor.afterValue( 0, null ) );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testBeforeValue() throws Exception
{
- cursor.beforeValue( 0, null );
+ assertThrows( UnsupportedOperationException.class, () -> cursor.beforeValue( 0, null ) );
}
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
index 2adab2b..ff1f4f9 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
@@ -20,32 +20,29 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
/**
* An AVLTreeMap testcase.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreeMapTest
{
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
index da4ab62..f4338cd 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
@@ -20,10 +20,11 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileInputStream;
@@ -33,24 +34,21 @@
import java.io.Serializable;
import java.util.Comparator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
/**
* TestCase for AvlTreeMarshaller.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreeMarshallerTest
{
private static final long[] AVLTREE_KEYS_PRE_REMOVE =
@@ -101,7 +99,7 @@
private static final Logger LOG = LoggerFactory.getLogger( AvlTreeMarshallerTest.class );
- @BeforeClass
+ @BeforeAll
public static void createComparator()
{
comparator = new Comparator<Integer>()
@@ -126,7 +124,7 @@
}
- @AfterClass
+ @AfterAll
public static void deleteFiles()
{
treeFile.delete();
@@ -155,7 +153,7 @@
for ( long key : AVLTREE_KEYS_PRE_REMOVE )
{
- assertNotNull( "Should find " + key, tree.find( key ) );
+ assertNotNull( tree.find( key ), "Should find " + key );
}
/*
@@ -167,7 +165,7 @@
for ( long key : AVLTREE_EXPECTED_KEYS_POST_REMOVE )
{
- assertNotNull( "Should find " + key, tree.find( key ) );
+ assertNotNull( tree.find( key ), "Should find " + key );
}
}
@@ -476,11 +474,14 @@
}
- @Test(expected = IOException.class)
+ @Test
public void testDeserializeNullData() throws IOException
{
- AvlTreeMarshaller<Integer> treeMarshaller = createTreeMarshaller();
- treeMarshaller.deserialize( null );
+ assertThrows( IOException.class, () ->
+ {
+ AvlTreeMarshaller<Integer> treeMarshaller = createTreeMarshaller();
+ treeMarshaller.deserialize( null );
+ } );
}
public class LongMarshaller implements Marshaller<Long>
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
index e68d733..7f1cb67 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
@@ -29,10 +29,12 @@
import java.util.HashSet;
import java.util.Set;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -41,6 +43,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreePerfTest
{
AvlTree<Integer> tree;
@@ -68,7 +71,7 @@
AvlTreeMarshaller<Integer> treeMarshaller = new AvlTreeMarshaller<Integer>( comparator, new IntegerKeyMarshaller() );
- @Before
+ @BeforeEach
public void createTree()
{
tree = new AvlTreeImpl<Integer>( new Comparator<Integer>()
@@ -87,7 +90,7 @@
}
- @AfterClass
+ @AfterAll
public static void deleteFiles()
{
setSerialFile.delete();
@@ -114,7 +117,7 @@
@Test
- @Ignore
+ @Disabled
public void testRBTreeLookupPerf()
{
for ( int i = 0; i < numKeys; i++ )
@@ -137,7 +140,7 @@
@Test
- @Ignore
+ @Disabled
public void testRemoveFromRBTree()
{
for ( int i = 0; i < numKeys; i++ )
@@ -177,7 +180,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeLookupPerf()
{
@@ -201,7 +204,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeRemovePerf()
{
for ( int i = 0; i < numKeys; i++ )
@@ -224,7 +227,7 @@
@Test
- @Ignore
+ @Disabled
public void testRBTreeSerializationPerf() throws Exception
{
FileOutputStream fout = new FileOutputStream( setSerialFile );
@@ -251,7 +254,7 @@
@SuppressWarnings("unchecked")
@Test
- @Ignore
+ @Disabled
public void testRBTreeDeserializationPerf() throws Exception
{
// read test
@@ -270,7 +273,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeSerializationPerf() throws Exception
{
@@ -294,7 +297,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeDeserializationPerf() throws Exception
{
FileInputStream fin = new FileInputStream( treeSerialFile );
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
index 53cb4b0..8189d2f 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
@@ -20,32 +20,29 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
/**
* An AVL tree testcase.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreeTest
{
@@ -416,7 +413,7 @@
for ( int key : expectedKeys )
{
- assertNotNull( "Should find " + key, tree.find( key ) );
+ assertNotNull( tree.find( key ), "Should find " + key );
}
}
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/DefaultMarshallerTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/DefaultMarshallerTest.java
index 64f778a..920a198 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/DefaultMarshallerTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/DefaultMarshallerTest.java
@@ -20,18 +20,16 @@
package org.apache.directory.server.core.avltree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.Serializable;
import java.util.Objects;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -39,8 +37,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class DefaultMarshallerTest
{
DefaultMarshaller marshaller = DefaultMarshaller.INSTANCE;
diff --git a/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java b/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
index 13b28b6..06651c0 100644
--- a/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
+++ b/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
@@ -31,10 +31,12 @@
import org.apache.directory.server.core.avltree.AvlTreeMarshaller;
import org.apache.directory.server.core.avltree.IntegerKeyMarshaller;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -43,6 +45,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.CONCURRENT)
public class AvlTreePerfTest
{
AvlTreeSet<Integer> tree;
@@ -70,7 +73,7 @@
AvlTreeMarshaller<Integer> treeMarshaller = new AvlTreeMarshaller<Integer>( comparator, new IntegerKeyMarshaller() );
- @Before
+ @BeforeEach
public void createTree()
{
tree = new AvlTreeSet<Integer>();
@@ -81,7 +84,7 @@
}
- @AfterClass
+ @AfterAll
public static void deleteFiles()
{
setSerialFile.delete();
@@ -108,7 +111,7 @@
@Test
- @Ignore
+ @Disabled
public void testRBTreeLookupPerf()
{
for ( int i = 0; i < numKeys; i++ )
@@ -131,7 +134,7 @@
@Test
- @Ignore
+ @Disabled
public void testRemoveFromRBTree()
{
for ( int i = 0; i < numKeys; i++ )
@@ -171,7 +174,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeLookupPerf()
{
@@ -195,7 +198,7 @@
@Test
- @Ignore
+ @Disabled
public void testAVLTreeRemovePerf()
{
for ( int i = 0; i < numKeys; i++ )
@@ -218,7 +221,7 @@
@Test
- @Ignore
+ @Disabled
public void testRBTreeSerializationPerf() throws Exception
{
FileOutputStream fout = new FileOutputStream( setSerialFile );
@@ -245,7 +248,7 @@
@SuppressWarnings("unchecked")
@Test
- @Ignore
+ @Disabled
public void testRBTreeDeserializationPerf() throws Exception
{
// read test
diff --git a/interceptors/authn/pom.xml b/interceptors/authn/pom.xml
index d95ada6..87bf7e4 100644
--- a/interceptors/authn/pom.xml
+++ b/interceptors/authn/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/interceptors/authn/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java b/interceptors/authn/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
index 7089bdc..cff6694 100644
--- a/interceptors/authn/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
+++ b/interceptors/authn/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authn;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -33,13 +33,10 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.server.core.api.LdapPrincipal;
import org.apache.directory.server.core.api.LdapPrincipalSerializer;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
*
@@ -47,15 +44,14 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class LdapPrincipalTest
{
/** The schema manager instance */
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception
{
schemaManager = new DefaultSchemaManager();
diff --git a/interceptors/authz/pom.xml b/interceptors/authz/pom.xml
index 8704832..8377a93 100644
--- a/interceptors/authz/pom.xml
+++ b/interceptors/authz/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
index 1d55f61..e490bba 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/HighestPrecedenceFilterTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList;
import java.util.Collection;
@@ -29,16 +29,14 @@
import java.util.HashSet;
import java.util.Set;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
import org.apache.directory.api.ldap.aci.ACITuple;
import org.apache.directory.api.ldap.aci.MicroOperation;
import org.apache.directory.api.ldap.aci.ProtectedItem;
import org.apache.directory.api.ldap.aci.UserClass;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -47,8 +45,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class HighestPrecedenceFilterTest
{
private static final Collection<ProtectedItem> PI_EMPTY_COLLECTION = Collections
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
index 29e6678..947167a 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
@@ -41,12 +41,10 @@
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -54,8 +52,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class MaxValueCountFilterTest
{
private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION = Collections
@@ -79,7 +76,7 @@
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
schemaManager = new DefaultSchemaManager();
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
index 166d258..2c283ee 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MicroOperationFilterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
@@ -28,16 +28,14 @@
import java.util.HashSet;
import java.util.Set;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
import org.apache.directory.api.ldap.aci.ACITuple;
import org.apache.directory.api.ldap.aci.MicroOperation;
import org.apache.directory.api.ldap.aci.ProtectedItem;
import org.apache.directory.api.ldap.aci.UserClass;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -45,8 +43,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class MicroOperationFilterTest
{
private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION = Collections
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
index 1477b2c..f82da80 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
@@ -30,9 +30,6 @@
import java.util.List;
import java.util.Set;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
import org.apache.directory.api.ldap.aci.ACITuple;
import org.apache.directory.api.ldap.aci.MicroOperation;
import org.apache.directory.api.ldap.aci.ProtectedItem;
@@ -46,9 +43,10 @@
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.filter.PresenceNode;
import org.apache.directory.api.ldap.model.schema.AttributeType;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -56,8 +54,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class MostSpecificProtectedItemFilterTest
{
private static final Set<AttributeType> EMPTY_STRING_COLLECTION = Collections
@@ -85,7 +82,7 @@
private static final List<ACITuple> TUPLES_E = new ArrayList<ACITuple>();
- @BeforeClass
+ @BeforeAll
public static void init()
{
Collection<ProtectedItem> attributeType = new ArrayList<ProtectedItem>();
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
index d9f3766..ed3b22e 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificUserClassFilterTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.ArrayList;
import java.util.Collection;
@@ -30,17 +30,15 @@
import java.util.List;
import java.util.Set;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
import org.apache.directory.api.ldap.aci.ACITuple;
import org.apache.directory.api.ldap.aci.MicroOperation;
import org.apache.directory.api.ldap.aci.ProtectedItem;
import org.apache.directory.api.ldap.aci.UserClass;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.api.ldap.model.subtree.SubtreeSpecification;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -48,8 +46,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class MostSpecificUserClassFilterTest
{
private static final Set<String> EMPTY_NAME_SET = Collections.unmodifiableSet( new HashSet<String>() );
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
index 9578365..61e2690 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/OperationScopeTest.java
@@ -20,12 +20,11 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -34,8 +33,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class OperationScopeTest
{
@Test
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
index 2342c1e..130f1d9 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
@@ -54,12 +54,10 @@
import org.apache.directory.server.core.api.event.ExpressionEvaluator;
import org.apache.directory.server.core.api.subtree.RefinementEvaluator;
import org.apache.directory.server.core.api.subtree.RefinementLeafEvaluator;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -67,8 +65,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class RelatedProtectedItemFilterTest
{
private static final Collection<UserClass> EMPTY_USER_CLASS_COLLECTION = Collections
@@ -98,7 +95,7 @@
private static AttributeType SN_AT;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
schemaManager = new DefaultSchemaManager();
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
index b5cd763..8e5dbd7 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,12 +38,10 @@
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -51,8 +49,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class RelatedUserClassFilterTest
{
private static final Collection<ACITuple> EMPTY_ACI_TUPLE_COLLECTION = Collections
@@ -74,7 +71,7 @@
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
schemaManager = new DefaultSchemaManager();
diff --git a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
index b236ed2..1615c9b 100644
--- a/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
+++ b/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.server.core.authz.support;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,12 +43,10 @@
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -56,8 +54,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class RestrictedByFilterTest
{
private static final Collection<UserClass> UC_EMPTY_COLLECTION = Collections
@@ -81,7 +78,7 @@
private static AttributeType SN_AT;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
schemaManager = new DefaultSchemaManager();
diff --git a/interceptors/normalization/pom.xml b/interceptors/normalization/pom.xml
index 523f8b0..b542192 100644
--- a/interceptors/normalization/pom.xml
+++ b/interceptors/normalization/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java b/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
index ab336f2..e9291a7 100644
--- a/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
+++ b/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.server.core.normalization;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.text.ParseException;
@@ -39,13 +39,10 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* A class to test the normalizing Visitor
@@ -53,8 +50,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class NormalizationVisitorTest
{
/** a filter node value normalizer and undefined node remover */
@@ -64,7 +60,7 @@
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
diff --git a/interceptors/schema/pom.xml b/interceptors/schema/pom.xml
index 42bead0..3a471c7 100644
--- a/interceptors/schema/pom.xml
+++ b/interceptors/schema/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/interceptors/schema/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java b/interceptors/schema/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
index 61c878f..9426df4 100644
--- a/interceptors/schema/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
+++ b/interceptors/schema/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.server.core.schema;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashSet;
@@ -35,25 +35,22 @@
import org.apache.directory.api.ldap.schema.loader.LdifSchemaLoader;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* Tests methods in SchemaInterceptor.
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class SchemaServiceTest
{
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/interceptors/subtree/pom.xml b/interceptors/subtree/pom.xml
index d63ebbb..3447718 100644
--- a/interceptors/subtree/pom.xml
+++ b/interceptors/subtree/pom.xml
@@ -37,8 +37,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
index df2b18f..9e57a88 100644
--- a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
+++ b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.subtree;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -38,22 +38,18 @@
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.subtree.RefinementEvaluator;
import org.apache.directory.server.core.api.subtree.RefinementLeafEvaluator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* Unit test cases for testing the evaluator for refinements.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.CONCURRENT)
public class RefinementEvaluatorTest
{
/** the SchemaManager instance */
@@ -73,7 +69,7 @@
* Initializes the global registries.
* @throws javax.naming.NamingException if there is a failure loading the schema
*/
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
@@ -98,7 +94,7 @@
/**
* Sets evaluator and registries to null.
*/
- @AfterClass
+ @AfterAll
public static void tearDown()
{
evaluator = null;
diff --git a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
index a433174..0cc0e0a 100644
--- a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
+++ b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.subtree;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
@@ -37,13 +37,11 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.subtree.RefinementLeafEvaluator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -51,8 +49,6 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
public class RefinementLeafEvaluatorTest
{
/** the SchemaManager instance */
@@ -72,7 +68,7 @@
* Initializes the global registries.
* @throws javax.naming.NamingException if there is a failure loading the schema
*/
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
@@ -96,7 +92,7 @@
/**
* Sets evaluator and registries to null.
*/
- @AfterClass
+ @AfterAll
public static void tearDown()
{
evaluator = null;
diff --git a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
index 698f8bf..ae69e08 100644
--- a/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
+++ b/interceptors/subtree/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.subtree;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashSet;
@@ -46,24 +46,17 @@
import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
import org.apache.directory.server.core.api.subtree.SubtreeEvaluator;
import org.apache.directory.server.core.shared.DefaultDnFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.github.benmanes.caffeine.cache.Cache;
-import com.github.benmanes.caffeine.cache.Caffeine;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* Unit test cases for the SubtreeEvaluator.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
public class SubtreeEvaluatorTest
{
private static DnFactory dnFactory;
@@ -73,7 +66,7 @@
private static ConcreteNameComponentNormalizer ncn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -107,7 +100,7 @@
}
- @AfterClass
+ @AfterAll
public static void destroyTest()
{
visitor = null;
@@ -115,7 +108,7 @@
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception
{
schemaManager = null;
diff --git a/jdbm-partition/pom.xml b/jdbm-partition/pom.xml
index 31012fe..57ab4ec 100644
--- a/jdbm-partition/pom.xml
+++ b/jdbm-partition/pom.xml
@@ -35,12 +35,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>apacheds-core-api</artifactId>
</dependency>
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java
index 0a68c01..bd1709c 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java
@@ -20,22 +20,20 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.Objects;
import java.util.Random;
import org.apache.directory.api.util.Strings;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -43,8 +41,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class BTreeRedirectMarshallerTest
{
BTreeRedirectMarshaller marshaller = new BTreeRedirectMarshaller();
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
index 1832045..ff92c00 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
@@ -19,11 +19,12 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -44,10 +45,12 @@
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,6 +60,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class DupsContainerCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( NoDupsCursorTest.class );
@@ -70,7 +74,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -97,7 +101,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
File tmpDir = null;
@@ -122,7 +126,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
table.close( partitionTxn );
@@ -137,21 +141,27 @@
}
- @Test(expected = IllegalStateException.class)
+ @Test
public void testUsingNoDuplicates() throws Exception
{
- recman = new BaseRecordManager( dbFile.getAbsolutePath() );
-
- // gosh this is a terrible use of a global static variable
- //SerializableComparator.setRegistry(
- // new MockComparatorRegistry(
- // new OidRegistry() ) );
- SerializableComparator<String> comparator = new SerializableComparator<String>(
- SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
- comparator.setSchemaManager( schemaManager );
- table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
-
- new DupsContainerCursor<String, String>( table );
+ assertThrows( IllegalStateException.class, () ->
+ {
+ recman = new BaseRecordManager( dbFile.getAbsolutePath() );
+
+ // gosh this is a terrible use of a global static variable
+ //SerializableComparator.setRegistry(
+ // new MockComparatorRegistry(
+ // new OidRegistry() ) );
+ SerializableComparator<String> comparator = new SerializableComparator<String>(
+ SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+ comparator.setSchemaManager( schemaManager );
+ table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
+
+ try ( Cursor<Tuple<String, DupsContainer<String>>> cursor =
+ new DupsContainerCursor<String, String>( table ) )
+ {
+ }
+ } );
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
index 5665f62..f80bff6 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
@@ -19,10 +19,10 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -44,10 +44,12 @@
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.Table;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +60,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class DupsCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( DupsCursorTest.class );
@@ -71,7 +74,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -98,7 +101,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
File tmpDir = null;
@@ -124,7 +127,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
table.close( partitionTxn );
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java
index 15e92b9..1c9cd9d 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmBrowserBugTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -35,9 +35,11 @@
import jdbm.helper.TupleBrowser;
import jdbm.recman.BaseRecordManager;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,6 +49,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmBrowserBugTest
{
Comparator<Integer> comparator;
@@ -57,7 +60,7 @@
private RecordManager recman = null;
- @Before
+ @BeforeEach
public void createTree() throws Exception
{
comparator = new Comparator<Integer>()
@@ -83,7 +86,7 @@
}
- @After
+ @AfterEach
public void cleanup() throws IOException
{
recman.close();
@@ -127,7 +130,8 @@
assertTrue( browser.getNext( tuple ) );
//noinspection AssertEqualsBetweenInconvertibleTypes
- assertEquals( "If this works the jdbm bug is gone: will start to return " +
- "30 instead as expected for correct operation", Integer.valueOf( 25 ), tuple.getKey() );
+ assertEquals( tuple.getKey(),Integer.valueOf( 25 ),
+ "If this works the jdbm bug is gone: will start to return " +
+ "30 instead as expected for correct operation");
}
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
index d1b7c1d..66119f5 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
@@ -20,11 +20,11 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
@@ -46,11 +46,13 @@
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import jdbm.recman.BaseRecordManager;
import jdbm.recman.TransactionManager;
@@ -61,6 +63,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmIndexTest
{
private Index<String, String> idx;
@@ -80,7 +83,7 @@
private Path tempFile;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
tempDir = Files.createTempDirectory( JdbmIndexTest.class.getSimpleName() );
@@ -100,7 +103,7 @@
}
- @Before
+ @BeforeEach
public void setup() throws IOException
{
tempFile = Files.createTempFile( tempDir, "data", null );
@@ -114,7 +117,7 @@
}
- @After
+ @AfterEach
public void teardown() throws Exception
{
recMan.close();
@@ -122,7 +125,7 @@
}
- @AfterClass
+ @AfterAll
public static void cleanup() throws Exception
{
FileUtils.deleteDirectory( tempDir.toFile() );
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
index a31b64c..034023b 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -38,9 +38,11 @@
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,6 +52,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmMasterTableTest
{
private static final Logger LOG = LoggerFactory.getLogger( JdbmMasterTableTest.class );
@@ -88,7 +91,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
destroyTable();
@@ -112,7 +115,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
if ( table != null )
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
index 0811707..7b7f60d 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
@@ -45,11 +45,13 @@
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import jdbm.recman.BaseRecordManager;
import jdbm.recman.TransactionManager;
@@ -60,6 +62,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmRdnIndexTest
{
private static File dbFileDir;
@@ -80,7 +83,7 @@
private BaseRecordManager recMan;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
tempDir = Files.createTempDirectory( JdbmIndexTest.class.getSimpleName() );
@@ -100,7 +103,7 @@
}
- @Before
+ @BeforeEach
public void setup() throws IOException
{
tempFile = Files.createTempFile( tempDir, "data", null );
@@ -114,7 +117,7 @@
}
- @After
+ @AfterEach
public void teardown() throws Exception
{
recMan.close();
@@ -123,7 +126,7 @@
- @AfterClass
+ @AfterAll
public static void cleanup() throws Exception
{
FileUtils.deleteDirectory( tempDir.toFile() );
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
index 8256edb..9ab1226 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
@@ -20,12 +20,13 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.nio.file.Files;
@@ -75,11 +76,13 @@
import org.apache.directory.server.xdbm.IndexNotFoundException;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.StoreUtils;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -92,6 +95,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@SuppressWarnings("unchecked")
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmStoreTest
{
private static final Logger LOG = LoggerFactory.getLogger( JdbmStoreTest.class );
@@ -125,7 +129,7 @@
private static Path tempDir;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
tempDir = Files.createTempDirectory( JdbmIndexTest.class.getSimpleName() );
@@ -154,7 +158,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -192,7 +196,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( partition != null )
@@ -215,7 +219,7 @@
}
- @AfterClass
+ @AfterAll
public static void cleanup() throws Exception
{
FileUtils.deleteDirectory( tempDir.toFile() );
@@ -575,61 +579,67 @@
}
*/
- @Test(expected = LdapNoSuchObjectException.class)
+ @Test
public void testAddWithoutParentId() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
- Entry entry = new DefaultEntry( schemaManager, dn,
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "ou: Not Present",
- "cn: Martin King" );
-
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( partition );
- PartitionTxn partitionTxn = null;
-
- try
+ assertThrows( LdapNoSuchObjectException.class, () ->
{
- partitionTxn = partition.beginWriteTransaction();
- addContext.setTransaction( partitionTxn );
-
- partition.add( addContext );
- partitionTxn.commit();
- }
- catch ( Exception e )
- {
- partitionTxn.abort();
- throw e;
- }
+ Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
+ Entry entry = new DefaultEntry( schemaManager, dn,
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "ou: Not Present",
+ "cn: Martin King" );
+
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( partition );
+ PartitionTxn partitionTxn = null;
+
+ try
+ {
+ partitionTxn = partition.beginWriteTransaction();
+ addContext.setTransaction( partitionTxn );
+
+ partition.add( addContext );
+ partitionTxn.commit();
+ }
+ catch ( Exception e )
+ {
+ partitionTxn.abort();
+ throw e;
+ }
+ } );
}
- @Test(expected = LdapSchemaViolationException.class)
+ @Test
public void testAddWithoutObjectClass() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
- Entry entry = new DefaultEntry( schemaManager, dn,
- "ou: Sales",
- "cn: Martin King" );
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( partition );
- PartitionTxn partitionTxn = null;
-
- try
+ assertThrows( LdapSchemaViolationException.class, () ->
{
- partitionTxn = partition.beginWriteTransaction();
- addContext.setTransaction( partitionTxn );
-
- partition.add( addContext );
- partitionTxn.commit();
- }
- catch ( Exception e )
- {
- partitionTxn.abort();
- throw e;
- }
+ Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
+ Entry entry = new DefaultEntry( schemaManager, dn,
+ "ou: Sales",
+ "cn: Martin King" );
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( partition );
+ PartitionTxn partitionTxn = null;
+
+ try
+ {
+ partitionTxn = partition.beginWriteTransaction();
+ addContext.setTransaction( partitionTxn );
+
+ partition.add( addContext );
+ partitionTxn.commit();
+ }
+ catch ( Exception e )
+ {
+ partitionTxn.abort();
+ throw e;
+ }
+ } );
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
index d03915a..54304a6 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
@@ -19,12 +19,12 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -42,10 +42,12 @@
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.Table;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,6 +57,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmTableNoDuplicatesTest
{
private static final Logger LOG = LoggerFactory.getLogger( JdbmTableNoDuplicatesTest.class );
@@ -67,7 +70,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -94,7 +97,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
destroyTable();
@@ -118,7 +121,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
if ( table != null )
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
index 2d0c8a9..de3db02 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
@@ -19,12 +19,13 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -45,10 +46,12 @@
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +61,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class JdbmTableWithDuplicatesTest
{
private static final Logger LOG = LoggerFactory.getLogger( JdbmTableWithDuplicatesTest.class );
@@ -80,7 +84,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -107,7 +111,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
destroyTable();
@@ -133,7 +137,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
if ( table != null )
@@ -171,31 +175,37 @@
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testNullKeyComparator() throws Exception
{
- assertNotNull( table.getKeyComparator() );
-
- SerializableComparator<String> comparator = new SerializableComparator<String>(
- SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
- comparator.setSchemaManager( schemaManager );
-
- new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
- null, comparator, null, new IntegerSerializer() );
+ assertThrows( IllegalArgumentException.class, () ->
+ {
+ assertNotNull( table.getKeyComparator() );
+
+ SerializableComparator<String> comparator = new SerializableComparator<String>(
+ SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+ comparator.setSchemaManager( schemaManager );
+
+ new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+ null, comparator, null, new IntegerSerializer() );
+ } );
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testNullValueComparator() throws Exception
{
- assertNotNull( table.getValueComparator() );
-
- SerializableComparator<String> comparator = new SerializableComparator<String>(
- SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
- comparator.setSchemaManager( schemaManager );
-
- new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
- comparator, null, null, new IntegerSerializer() );
+ assertThrows( IllegalArgumentException.class, () ->
+ {
+ assertNotNull( table.getValueComparator() );
+
+ SerializableComparator<String> comparator = new SerializableComparator<String>(
+ SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+ comparator.setSchemaManager( schemaManager );
+
+ new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+ comparator, null, null, new IntegerSerializer() );
+ } );
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java
index 2822ec2..836e3c9 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursorTest.java
@@ -19,12 +19,12 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.Comparator;
@@ -37,9 +37,11 @@
import jdbm.recman.BaseRecordManager;
import org.apache.directory.api.util.Strings;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,6 +51,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class KeyBTreeCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( KeyBTreeCursorTest.class );
@@ -62,7 +65,7 @@
KeyBTreeCursor<String> cursor;
- @Before
+ @BeforeEach
public void createCursor() throws Exception
{
File tmpDir = null;
@@ -94,7 +97,7 @@
}
- @After
+ @AfterEach
public void destroyCursor() throws Exception
{
recman.close();
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
index 8a94ac8..539a7ff 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyCursorTest.java
@@ -19,12 +19,12 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.Comparator;
@@ -37,9 +37,11 @@
import jdbm.recman.BaseRecordManager;
import org.apache.directory.api.util.Strings;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,6 +51,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class KeyCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( KeyCursorTest.class );
@@ -62,7 +65,7 @@
KeyBTreeCursor<String> cursor;
- @Before
+ @BeforeEach
public void createCursor() throws Exception
{
File tmpDir = null;
@@ -94,7 +97,7 @@
}
- @After
+ @AfterEach
public void destroyCursor() throws Exception
{
recman.close();
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java
index 994b962..296ba0a 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursorTest.java
@@ -19,9 +19,10 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Comparator;
@@ -29,13 +30,11 @@
import org.apache.directory.api.ldap.model.cursor.Tuple;
import org.apache.directory.server.core.avltree.ArrayTree;
import org.apache.directory.server.xdbm.KeyTupleArrayCursor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -44,8 +43,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class KeyTupleArrayCursorTest
{
@@ -55,7 +53,7 @@
private static final Integer KEY = Integer.valueOf( 1 );
- @Before
+ @BeforeEach
public void createTree()
{
Comparator<Integer> comparator = new Comparator<Integer>()
@@ -74,25 +72,28 @@
}
- @After
+ @AfterEach
public void cleanup() throws Exception
{
cursor.close();
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testEmptyCursor() throws Exception
{
- assertFalse( cursor.next() );
- assertFalse( cursor.available() );
-
- assertFalse( cursor.isClosed() );
-
- assertFalse( cursor.first() );
- assertFalse( cursor.last() );
-
- cursor.get(); // should throw InvalidCursorPositionException
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ assertFalse( cursor.next() );
+ assertFalse( cursor.available() );
+
+ assertFalse( cursor.isClosed() );
+
+ assertFalse( cursor.first() );
+ assertFalse( cursor.last() );
+
+ cursor.get(); // should throw InvalidCursorPositionException
+ } );
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
index 18495e2..30e2bef 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
@@ -19,10 +19,11 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.util.Comparator;
@@ -44,10 +45,12 @@
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -55,6 +58,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class KeyTupleBTreeCursorTest
{
JdbmTable<String, String> table;
@@ -69,7 +73,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -96,7 +100,7 @@
}
- @Before
+ @BeforeEach
public void createTree() throws Exception
{
comparator = new Comparator<String>()
@@ -129,7 +133,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
recman.close();
@@ -145,18 +149,21 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testEmptyCursor() throws Exception
{
- assertFalse( cursor.next() );
- assertFalse( cursor.available() );
-
- assertFalse( cursor.isClosed() );
-
- assertFalse( cursor.first() );
- assertFalse( cursor.last() );
-
- cursor.get(); // should throw InvalidCursorPositionException
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ assertFalse( cursor.next() );
+ assertFalse( cursor.available() );
+
+ assertFalse( cursor.isClosed() );
+
+ assertFalse( cursor.first() );
+ assertFalse( cursor.last() );
+
+ cursor.get(); // should throw InvalidCursorPositionException
+ } );
}
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
index 251398e..336836d 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
@@ -19,11 +19,11 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -44,10 +44,12 @@
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.Table;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +60,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class NoDupsCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( NoDupsCursorTest.class );
@@ -70,7 +73,7 @@
private PartitionTxn partitionTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -97,7 +100,7 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
File tmpDir = null;
@@ -122,7 +125,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
table.close( partitionTxn );
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
index 4780c49..9f5984c 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashMap;
@@ -42,12 +42,10 @@
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -55,8 +53,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class ServerEntrySerializerTest
{
private static LdifSchemaLoader loader;
@@ -68,7 +65,7 @@
/**
* Initialize the registries once for the whole test suite
*/
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializerTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializerTest.java
index 5b8448d..172b654 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializerTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializerTest.java
@@ -20,24 +20,21 @@
package org.apache.directory.server.core.partition.impl.btree.jdbm;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import org.apache.commons.lang3.RandomStringUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class StringSerializerTest
{
@Test
diff --git a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
index 9e959d6..e2381bd 100644
--- a/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
+++ b/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/tree/PartitionTreeTest.java
@@ -21,10 +21,10 @@
package org.apache.directory.server.core.partition.tree;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -43,8 +43,10 @@
import org.apache.directory.server.core.partition.impl.btree.jdbm.DupsContainerCursorTest;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.server.core.shared.DefaultDnFactory;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -52,13 +54,14 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class PartitionTreeTest
{
private static SchemaManager schemaManager;
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
index bf81940..4a4176d 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
@@ -21,13 +21,15 @@
package org.apache.directory.server.core.partition.ldif;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -75,11 +77,10 @@
import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.core.shared.DefaultDnFactory;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,11 +100,11 @@
private static DnFactory dnFactory;
private static CsnFactory defaultCSNFactory;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
+ @TempDir
+ public Path folder;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -134,12 +135,11 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
- wkdir = folder.newFile( "db" );
- wkdir = folder.getRoot();
+ wkdir = Files.createDirectory( folder.resolve( "db" ) ).toFile();
// initialize the store
// initialize the partition
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
index 3503975..f11e495 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
@@ -21,16 +21,18 @@
package org.apache.directory.server.core.partition.ldif;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -88,12 +90,11 @@
import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.core.shared.DefaultDnFactory;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
/**
@@ -121,11 +122,11 @@
/** the file in use during the current test method's execution */
private File ldifFileInUse;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
+ @TempDir
+ public Path folder;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -177,10 +178,10 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
- ldifFileInUse = folder.newFile( "partition.ldif" );
+ ldifFileInUse = Files.createFile( folder.resolve( "partition.ldif" ) ).toFile();
}
@@ -1147,7 +1148,7 @@
* @throws Exception
*/
@Test
- @Ignore("Taking way too much time and very timing dependent")
+ @Disabled("Taking way too much time and very timing dependent")
public void testConcurrentOperations() throws Exception
{
SingleFileLdifPartition partition = injectEntries();
diff --git a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
index 779252f..2437f4e 100644
--- a/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
+++ b/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
@@ -21,16 +21,18 @@
package org.apache.directory.server.core.partition.ldif;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -88,12 +90,11 @@
import org.apache.directory.server.core.api.normalization.FilterNormalizingVisitor;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.core.shared.DefaultDnFactory;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
/**
@@ -119,11 +120,11 @@
/** the file in use during the current test method's execution */
private File ldifFileInUse;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
+ @TempDir
+ public Path folder;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -175,10 +176,10 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
- ldifFileInUse = folder.newFile( "partition.ldif" );
+ ldifFileInUse = Files.createFile( folder.resolve( "partition.ldif" ) ).toFile();
}
@@ -1135,7 +1136,7 @@
* @throws Exception
*/
@Test
- @Ignore("Taking way too much time and very timing dependent")
+ @Disabled("Taking way too much time and very timing dependent")
public void testConcurrentOperations() throws Exception
{
SingleFileLdifPartition partition = injectEntries();
diff --git a/mavibot-partition/pom.xml b/mavibot-partition/pom.xml
index f508979..2b73ade 100644
--- a/mavibot-partition/pom.xml
+++ b/mavibot-partition/pom.xml
@@ -28,12 +28,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.apache.directory.mavibot</groupId>
<artifactId>mavibot</artifactId>
</dependency>
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/LdifBulkLoaderTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/LdifBulkLoaderTest.java
index 55310e9..8a4e9cc 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/LdifBulkLoaderTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/LdifBulkLoaderTest.java
@@ -20,7 +20,6 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
import java.io.File;
-import java.io.FileWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -30,14 +29,14 @@
import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.mavibot.btree.Tuple;
import org.apache.directory.mavibot.btree.persisted.BulkDataSorter;
-import org.junit.Ignore;
+import org.junit.jupiter.api.Disabled;
/**
* TODO LdifBulkLoaderTest.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@Ignore
+@Disabled
public class LdifBulkLoaderTest
{
String personTemplate = "# just a comment\n"+
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializationTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializationTest.java
index b1573bd..17d1870 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializationTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotEntrySerializationTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -41,12 +41,10 @@
import org.apache.directory.api.ldap.schema.loader.LdifSchemaLoader;
import org.apache.directory.api.ldap.schema.manager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.exception.Exceptions;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -54,8 +52,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class MavibotEntrySerializationTest
{
@@ -64,7 +61,7 @@
private static SchemaManager schemaManager;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
index 150a9e9..c66faf2 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
@@ -20,14 +20,16 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
import org.apache.directory.api.util.FileUtils;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -45,12 +47,13 @@
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -58,6 +61,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class MavibotIndexTest
{
private static File dbFileDir;
@@ -74,11 +78,11 @@
private PartitionTxn partitionTxn;
- @Rule
- public TemporaryFolder tempFolder = new TemporaryFolder();
+ @TempDir
+ public Path tempFolder;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -105,10 +109,10 @@
}
- @Before
+ @BeforeEach
public void setup() throws IOException
{
- dbFileDir = tempFolder.newFolder( MavibotIndexTest.class.getSimpleName() );
+ dbFileDir = Files.createDirectory( tempFolder.resolve( MavibotIndexTest.class.getSimpleName() ) ).toFile();
recordMan = new RecordManager( dbFileDir.getAbsolutePath() );
@@ -116,7 +120,7 @@
}
- @After
+ @AfterEach
public void teardown() throws Exception
{
destroyIndex();
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java
index d93efaf..15d12d1 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java
@@ -20,11 +20,12 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
+import java.nio.file.Path;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.schema.extractor.SchemaLdifExtractor;
@@ -36,12 +37,13 @@
import org.apache.directory.mavibot.btree.RecordManager;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,6 +53,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class MavibotMasterTableTest
{
private static final Logger LOG = LoggerFactory.getLogger( MavibotMasterTableTest.class );
@@ -63,11 +66,11 @@
private PartitionTxn partitionTxn;
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
+ @TempDir
+ public Path tmpDir;
- @BeforeClass
+ @BeforeAll
public static void loadSchema() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -97,12 +100,12 @@
}
- @Before
+ @BeforeEach
public void createTable() throws Exception
{
destroyTable();
- recordMan = new RecordManager( tmpDir.getRoot().getAbsolutePath() );
+ recordMan = new RecordManager( tmpDir.toFile().getAbsolutePath() );
table = new MavibotMasterTable( recordMan, schemaManager, "master" );
LOG.debug( "Created new table and populated it with data" );
@@ -111,7 +114,7 @@
}
- @After
+ @AfterEach
public void destroyTable() throws Exception
{
if ( table == null )
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
index f6fb839..946994f 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
@@ -20,14 +20,15 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Path;
import org.apache.directory.api.ldap.model.cursor.Cursor;
import org.apache.directory.api.ldap.model.name.Rdn;
@@ -45,12 +46,13 @@
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -58,6 +60,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class MavibotRdnIndexTest
{
private Index<ParentIdAndRdn, String> idx;
@@ -68,11 +71,11 @@
private PartitionTxn partitionTxn;
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
+ @TempDir
+ public Path tmpDir;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -99,16 +102,16 @@
}
- @Before
+ @BeforeEach
public void setup() throws IOException
{
- recordMan = new RecordManager( tmpDir.getRoot().getAbsolutePath() );
+ recordMan = new RecordManager( tmpDir.toFile().getAbsolutePath() );
partitionTxn = new MockPartitionReadTxn();
}
- @After
+ @AfterEach
public void teardown() throws Exception
{
destroyIndex( partitionTxn );
@@ -130,7 +133,7 @@
void initIndex() throws Exception
{
MavibotRdnIndex index = new MavibotRdnIndex();
- index.setWkDirPath( tmpDir.getRoot().toURI() );
+ index.setWkDirPath( tmpDir.getRoot().toUri() );
initIndex( index );
}
diff --git a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
index 26984d4..b3b2c3c 100644
--- a/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
+++ b/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
@@ -20,14 +20,17 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -74,13 +77,12 @@
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.StoreUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -122,11 +124,11 @@
private PartitionTxn partitionTxn;
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
+ @TempDir
+ public Path tmpDir;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -162,13 +164,13 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
StoreUtils.createdExtraAttributes( schemaManager );
// setup the working directory for the store
- wkdir = tmpDir.newFolder( getClass().getSimpleName() );
+ wkdir = Files.createDirectory( tmpDir.resolve( getClass().getSimpleName() ) ).toFile();
// initialize the store
store = new MavibotPartition( schemaManager, dnFactory );
@@ -204,7 +206,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -227,7 +229,7 @@
public void testTwoComponentSuffix() throws Exception
{
// setup the working directory for the 2nd store
- File wkdir2 = tmpDir.newFolder( getClass().getSimpleName() + "-store2" );
+ File wkdir2 = Files.createDirectory( tmpDir.resolve( getClass().getSimpleName() + "-store2" ) ).toFile();
// initialize the 2nd store
MavibotPartition store2 = new MavibotPartition( schemaManager, dnFactory );
@@ -558,36 +560,42 @@
}
*/
- @Test(expected = LdapNoSuchObjectException.class)
+ @Test
public void testAddWithoutParentId() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
- Entry entry = new DefaultEntry( schemaManager, dn,
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "ou: Not Present",
- "cn: Martin King" );
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( store );
- addContext.setTransaction( store.beginWriteTransaction() );
-
- store.add( addContext );
+ assertThrows( LdapNoSuchObjectException.class, () ->
+ {
+ Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
+ Entry entry = new DefaultEntry( schemaManager, dn,
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "ou: Not Present",
+ "cn: Martin King" );
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( store );
+ addContext.setTransaction( store.beginWriteTransaction() );
+
+ store.add( addContext );
+ } );
}
- @Test(expected = LdapSchemaViolationException.class)
+ @Test
public void testAddWithoutObjectClass() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
- Entry entry = new DefaultEntry( schemaManager, dn,
- "ou: Sales",
- "cn: Martin King" );
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( store );
- addContext.setTransaction( store.beginWriteTransaction() );
-
- store.add( addContext );
+ assertThrows( LdapSchemaViolationException.class, () ->
+ {
+ Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
+ Entry entry = new DefaultEntry( schemaManager, dn,
+ "ou: Sales",
+ "cn: Martin King" );
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( store );
+ addContext.setTransaction( store.beginWriteTransaction() );
+
+ store.add( addContext );
+ } );
}
@@ -837,7 +845,7 @@
@Test
- @Ignore("Ignore till mavibot file nam extensions are frozen")
+ @Disabled("Ignore till mavibot file nam extensions are frozen")
public void testDeleteUnusedIndexFiles() throws Exception
{
File ouIndexDbFile = new File( wkdir, SchemaConstants.OU_AT_OID + ".db" );
diff --git a/osgi-integ/pom.xml b/osgi-integ/pom.xml
index eab9142..3f364db 100644
--- a/osgi-integ/pom.xml
+++ b/osgi-integ/pom.xml
@@ -34,166 +34,207 @@
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-i18n</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-api</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-annotations</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-avl</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-constants</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-jndi</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-shared</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-http-directory-bridge</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-http-integration</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-admin</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-authn</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-authz</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-changelog</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-collective</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-event</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-exception</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-hash</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-journal</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-logger</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-normalization</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-number</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-operational</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-referral</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-schema</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-subtree</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-interceptors-trigger</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-ldap</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-kerberos</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-dhcp</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-dns</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-ntp</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-protocol-shared</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-xdbm-partition</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-jdbm-partition</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-mavibot-partition</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-ldif-partition</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-annotations</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-config</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-server-jndi</artifactId>
</dependency>
+
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-service-builder</artifactId>
</dependency>
+
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
@@ -211,41 +252,49 @@
<version>1_3</version>
<scope>test</scope>
</dependency>
+
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
+
<!--dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency-->
+
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<scope>test</scope>
</dependency>
+
<!-- <dependency> -->
<!-- <groupId>org.eclipse</groupId> -->
<!-- <artifactId>osgi</artifactId> -->
diff --git a/pom.xml b/pom.xml
index e5cd0d9..dbf7a16 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,9 @@
<!-- The Jetty bundle exports are using version 9.4.5, not 9.4.5.v20170502... -->
<jetty.bundle.version>9.4.19</jetty.bundle.version>
<junit.version>4.12</junit.version>
+ <junit.engine.version>5.7.0</junit.engine.version>
+ <junit.api.version>5.7.0</junit.api.version>
+ <junit.platform.version>1.7.0-RC1</junit.platform.version>
<ldapsdk.version>4.1</ldapsdk.version>
<log4j.version>1.2.17</log4j.version>
<logback.version>1.2.3</logback.version>
@@ -474,6 +477,13 @@
<systemPropertyVariables>
<java.io.tmpdir>${basedir}/target</java.io.tmpdir>
</systemPropertyVariables>
+ <parallel>all</parallel>
+ <threadCount>10</threadCount>
+ <properties>
+ <configurationParameters>
+ junit.jupiter.execution.parallel.enabled=true
+ </configurationParameters>
+ </properties>
</configuration>
</plugin>
</plugins>
@@ -1138,6 +1148,33 @@
</dependency>
<dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.api.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.engine.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <version>${junit.platform.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<version>${pax-exam.version}</version>
@@ -1202,12 +1239,6 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
-
- <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
@@ -1307,8 +1338,16 @@
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.engine.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/server-annotations/pom.xml b/server-annotations/pom.xml
index c14d2ff..fb4bc97 100644
--- a/server-annotations/pom.xml
+++ b/server-annotations/pom.xml
@@ -87,6 +87,12 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/server-integ/pom.xml b/server-integ/pom.xml
index 62c3d99..8a95214 100644
--- a/server-integ/pom.xml
+++ b/server-integ/pom.xml
@@ -153,6 +153,12 @@
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<scope>test</scope>
diff --git a/service/src/test/java/org/apache/directory/server/UberJarMainTest.java b/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
index f6e19d1..0cb2210 100644
--- a/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
+++ b/service/src/test/java/org/apache/directory/server/UberJarMainTest.java
@@ -261,6 +261,7 @@
}
catch ( Exception e )
{
+ e.printStackTrace();
verified = false;
}
finally
diff --git a/test-framework/pom.xml b/test-framework/pom.xml
index 479d872..d129053 100644
--- a/test-framework/pom.xml
+++ b/test-framework/pom.xml
@@ -82,6 +82,18 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/xdbm-partition/pom.xml b/xdbm-partition/pom.xml
index 31702ec..d1da694 100644
--- a/xdbm-partition/pom.xml
+++ b/xdbm-partition/pom.xml
@@ -32,8 +32,8 @@
<dependencies>
<dependency>
- <groupId>org.apache.directory.junit</groupId>
- <artifactId>junit-addons</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java
index dab05a0..e82319d 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractIndexCursorTest.java
@@ -20,17 +20,20 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.Iterator;
import org.apache.directory.api.ldap.model.cursor.CursorClosedException;
import org.apache.directory.api.ldap.model.cursor.DefaultClosureMonitor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -38,20 +41,21 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class AbstractIndexCursorTest
{
private AbstractIndexCursor<String> indexCursor;
- @Before
+ @BeforeEach
public void setUp()
{
indexCursor = new EmptyIndexCursor<String>( new MockPartitionReadTxn() );
}
- @After
+ @AfterEach
public void cleanup() throws Exception
{
if ( !indexCursor.isClosed() )
@@ -61,10 +65,13 @@
}
- @Test(expected = IllegalArgumentException.class)
+ @Test
public void testSetClosureMonitorNull()
{
- indexCursor.setClosureMonitor( null );
+ assertThrows( IllegalArgumentException.class, () ->
+ {
+ indexCursor.setClosureMonitor( null );
+ } );
}
@@ -82,19 +89,25 @@
}
- @Test(expected = CursorClosedException.class)
+ @Test
public void testCheckNotClosedIfClosed() throws Exception
{
- indexCursor.close();
- indexCursor.checkNotClosed();
+ assertThrows( CursorClosedException.class, () ->
+ {
+ indexCursor.close();
+ indexCursor.checkNotClosed();
+ } );
}
- @Test(expected = CursorClosedException.class)
+ @Test
public void testCheckNotClosedIfClosedWithCustomException() throws Exception
{
- indexCursor.close( new IllegalArgumentException() );
- indexCursor.checkNotClosed();
+ assertThrows( CursorClosedException.class, () ->
+ {
+ indexCursor.close( new IllegalArgumentException() );
+ indexCursor.checkNotClosed();
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java
index 944d8a0..b7662df 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/EmptyIndexCursorTest.java
@@ -20,13 +20,16 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.server.core.api.partition.Partition;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -34,20 +37,21 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class EmptyIndexCursorTest
{
private EmptyIndexCursor<String> indexCursor;
- @Before
+ @BeforeEach
public void setUp()
{
indexCursor = new EmptyIndexCursor<String>( new MockPartitionReadTxn() );
}
- @After
+ @AfterEach
public void cleanup() throws Exception
{
if ( !indexCursor.isClosed() )
@@ -66,26 +70,35 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGet() throws Exception
{
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.get();
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGetBeforeFirst() throws Exception
{
- indexCursor.beforeFirst();
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.beforeFirst();
+ indexCursor.get();
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGetAfterLast() throws Exception
{
- indexCursor.afterLast();
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.afterLast();
+ indexCursor.get();
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexEntryTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexEntryTest.java
index 5964859..aaebe8e 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexEntryTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexEntryTest.java
@@ -22,26 +22,29 @@
import org.apache.directory.api.ldap.model.cursor.Tuple;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests the {@link IndexEntry} class.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class IndexEntryTest
{
private IndexEntry<String, Long> indexEntry;
- @Before
+ @BeforeEach
public void setUp()
{
indexEntry = new IndexEntry<String, Long>();
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexNotFoundExceptionTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexNotFoundExceptionTest.java
index cabdc89..f5dbcfe 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexNotFoundExceptionTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/IndexNotFoundExceptionTest.java
@@ -20,11 +20,14 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
@@ -32,9 +35,9 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class IndexNotFoundExceptionTest
{
-
@Test
public void testConstructor1()
{
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ParentIdAndRdnTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ParentIdAndRdnTest.java
index 933f50e..cafa663 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ParentIdAndRdnTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ParentIdAndRdnTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -36,8 +36,10 @@
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
import org.apache.directory.server.xdbm.impl.avl.AvlPartitionTest;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,6 +49,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class ParentIdAndRdnTest
{
private static final Logger LOG = LoggerFactory.getLogger( ParentIdAndRdnTest.class );
@@ -54,7 +57,7 @@
private static SchemaManager schemaManager = null;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
index ac23382..db6a6a7 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
@@ -60,10 +60,12 @@
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.impl.avl.AvlPartitionTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,6 +75,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class PartitionTest
{
private static final Logger LOG = LoggerFactory.getLogger( PartitionTest.class );
@@ -90,7 +93,7 @@
/** The CN AttributType instance */
private static AttributeType CN_AT;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -122,7 +125,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
StoreUtils.createdExtraAttributes( schemaManager );
@@ -144,7 +147,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
partition.destroy( null );
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java
index 5786df2..8063f8a 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java
@@ -20,17 +20,20 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import org.apache.directory.api.ldap.model.cursor.Cursor;
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.server.core.api.partition.Partition;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -38,6 +41,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class SingletonIndexCursorTest
{
@@ -45,7 +49,7 @@
private SingletonIndexCursor<String> indexCursor;
- @Before
+ @BeforeEach
public void setUp()
{
indexEntry = new IndexEntry<String, String>();
@@ -56,7 +60,7 @@
}
- @After
+ @AfterEach
public void cleanup() throws Exception
{
indexCursor.close();
@@ -72,26 +76,35 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGetNotPositioned() throws Exception
{
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.get();
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGetBeforeFirst() throws Exception
{
- indexCursor.beforeFirst();
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.beforeFirst();
+ indexCursor.get();
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testGetAfterLast() throws Exception
{
- indexCursor.afterLast();
- indexCursor.get();
+ assertThrows( InvalidCursorPositionException.class, () ->
+ {
+ indexCursor.afterLast();
+ indexCursor.get();
+ } );
}
@@ -234,16 +247,22 @@
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testBefore() throws Exception
{
- indexCursor.before( null );
+ assertThrows( UnsupportedOperationException.class, () ->
+ {
+ indexCursor.before( null );
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testAfter() throws Exception
{
- indexCursor.after( null );
+ assertThrows( UnsupportedOperationException.class, () ->
+ {
+ indexCursor.after( null );
+ } );
}
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/TupleTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/TupleTest.java
index 62186e7..ed6cd51 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/TupleTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/TupleTest.java
@@ -20,17 +20,19 @@
package org.apache.directory.server.xdbm;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import java.util.HashSet;
import java.util.Set;
import org.apache.directory.api.ldap.model.cursor.Tuple;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -38,6 +40,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.CONCURRENT)
public class TupleTest
{
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
index 6ca7718..292bc91 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
@@ -20,12 +20,13 @@
package org.apache.directory.server.xdbm.impl.avl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -66,10 +67,12 @@
import org.apache.directory.server.core.shared.DefaultDnFactory;
import org.apache.directory.server.xdbm.IndexNotFoundException;
import org.apache.directory.server.xdbm.StoreUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,6 +82,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class AvlPartitionTest
{
private static final Logger LOG = LoggerFactory.getLogger( AvlPartitionTest.class );
@@ -103,7 +107,7 @@
private PartitionTxn txn;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -139,7 +143,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
StoreUtils.createdExtraAttributes( schemaManager );
@@ -161,7 +165,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
partition.destroy( txn );
@@ -390,36 +394,42 @@
}
- @Test(expected = LdapNoSuchObjectException.class)
+ @Test
public void testAddWithoutParentId() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
- DefaultEntry entry = new DefaultEntry( schemaManager, dn );
- entry.add( "objectClass", "top", "person", "organizationalPerson" );
- entry.add( "ou", "Not Present" );
- entry.add( "cn", "Martin King" );
-
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( partition );
- addContext.setTransaction( partition.beginWriteTransaction() );
-
- partition.add( addContext );
+ assertThrows( LdapNoSuchObjectException.class, () ->
+ {
+ Dn dn = new Dn( schemaManager, "cn=Marting King,ou=Not Present,o=Good Times Co." );
+ DefaultEntry entry = new DefaultEntry( schemaManager, dn );
+ entry.add( "objectClass", "top", "person", "organizationalPerson" );
+ entry.add( "ou", "Not Present" );
+ entry.add( "cn", "Martin King" );
+
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( partition );
+ addContext.setTransaction( partition.beginWriteTransaction() );
+
+ partition.add( addContext );
+ } );
}
- @Test(expected = LdapSchemaViolationException.class)
+ @Test
public void testAddWithoutObjectClass() throws Exception
{
- Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
- DefaultEntry entry = new DefaultEntry( schemaManager, dn );
- entry.add( "ou", "Sales" );
- entry.add( "cn", "Martin King" );
-
- AddOperationContext addContext = new AddOperationContext( null, entry );
- addContext.setPartition( partition );
- addContext.setTransaction( partition.beginWriteTransaction() );
-
- partition.add( addContext );
+ assertThrows( LdapSchemaViolationException.class, () ->
+ {
+ Dn dn = new Dn( schemaManager, "cn=Martin King,ou=Sales,o=Good Times Co." );
+ DefaultEntry entry = new DefaultEntry( schemaManager, dn );
+ entry.add( "ou", "Sales" );
+ entry.add( "cn", "Martin King" );
+
+ AddOperationContext addContext = new AddOperationContext( null, entry );
+ addContext.setPartition( partition );
+ addContext.setTransaction( partition.beginWriteTransaction() );
+
+ partition.add( addContext );
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
index 9ec486f..badae20 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
@@ -20,9 +20,10 @@
package org.apache.directory.server.xdbm.impl.avl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.io.IOException;
@@ -42,11 +43,13 @@
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -54,6 +57,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class AvlRdnIndexTest
{
private static File dbFileDir;
@@ -62,7 +66,7 @@
private MockPartitionReadTxn mockTxn;
- @BeforeClass
+ @BeforeAll
public static void init() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -89,7 +93,7 @@
}
- @Before
+ @BeforeEach
public void setup() throws IOException
{
@@ -102,7 +106,7 @@
}
- @After
+ @AfterEach
public void teardown() throws Exception
{
destroyIndex();
@@ -148,22 +152,28 @@
// Property Test Methods
// -----------------------------------------------------------------------
- @Test(expected = UnsupportedOperationException.class)
- @Ignore
+ @Test
+ @Disabled
public void testCacheSize() throws Exception
{
- // uninitialized index
- AvlRdnIndex AvlRdnIndex = new AvlRdnIndex();
- AvlRdnIndex.setCacheSize( 337 );
+ assertThrows( UnsupportedOperationException.class, () ->
+ {
+ // uninitialized index
+ AvlRdnIndex AvlRdnIndex = new AvlRdnIndex();
+ AvlRdnIndex.setCacheSize( 337 );
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testWkDirPath() throws Exception
{
- // uninitialized index
- AvlRdnIndex AvlRdnIndex = new AvlRdnIndex();
- AvlRdnIndex.setWkDirPath( new File( dbFileDir, "foo" ).toURI() );
+ assertThrows( UnsupportedOperationException.class, () ->
+ {
+ // uninitialized index
+ AvlRdnIndex AvlRdnIndex = new AvlRdnIndex();
+ AvlRdnIndex.setWkDirPath( new File( dbFileDir, "foo" ).toURI() );
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlTableTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlTableTest.java
index d627b2b..25eaeb4 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlTableTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlTableTest.java
@@ -22,23 +22,21 @@
import static org.apache.directory.server.xdbm.impl.avl.TableData.injectDupsData;
import static org.apache.directory.server.xdbm.impl.avl.TableData.injectNoDupsData;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Comparator;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
import org.apache.directory.api.ldap.model.cursor.Cursor;
import org.apache.directory.api.ldap.model.cursor.Tuple;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.xdbm.MockPartitionReadTxn;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
@@ -46,8 +44,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(ConcurrentJunitRunner.class)
-@Concurrency()
+@Execution(ExecutionMode.SAME_THREAD)
public class AvlTableTest
{
private AvlTable<Integer, Integer> dups;
@@ -56,7 +53,7 @@
PartitionTxn txn;
- @Before
+ @BeforeEach
public void setUp()
{
txn = new MockPartitionReadTxn();
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
index c230925..192eff2 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AbstractCursorTest.java
@@ -33,7 +33,6 @@
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursorImpl;
import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.api.partition.PartitionTxn;
import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition;
import org.apache.directory.server.core.partition.impl.btree.EntryCursorAdaptor;
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
index 1c501d7..19ccec5 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
@@ -20,9 +20,9 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashSet;
@@ -50,10 +50,12 @@
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
import org.apache.directory.server.xdbm.StoreUtils;
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,6 +66,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class AndCursorTest extends AbstractCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( AndCursorTest.class );
@@ -71,7 +74,7 @@
File wkdir;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
// setup the standard registries
@@ -106,7 +109,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
directoryService = new MockDirectoryService();
@@ -142,7 +145,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
index 45c03a0..f659a38 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/EqualityTest.java
@@ -20,10 +20,11 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -59,10 +60,12 @@
import org.apache.directory.server.xdbm.search.cursor.PresenceCursor;
import org.apache.directory.server.xdbm.search.evaluator.EqualityEvaluator;
import org.apache.directory.server.xdbm.search.evaluator.PresenceEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,6 +75,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class EqualityTest
{
private static final Logger LOG = LoggerFactory.getLogger( EqualityTest.class );
@@ -82,7 +86,7 @@
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -118,7 +122,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -147,7 +151,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -473,90 +477,102 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException2() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportBeforeWithoutIndex() throws Exception
{
- PresenceCursor cursor = null;
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.before( entry );
- }
- finally
- {
- cursor.close();
- }
+ PresenceCursor cursor = null;
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.before( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportAfterWithoutIndex() throws Exception
{
- PresenceCursor cursor = null;
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.after( entry );
- }
- finally
- {
- cursor.close();
- }
+ PresenceCursor cursor = null;
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.after( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
index 646f445..9993a3c 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqNotIndexedTest.java
@@ -20,11 +20,12 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -68,10 +69,12 @@
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.cursor.GreaterEqCursor;
import org.apache.directory.server.xdbm.search.evaluator.GreaterEqEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,6 +84,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class GreaterEqNotIndexedTest
{
public static final Logger LOG = LoggerFactory.getLogger( GreaterEqNotIndexedTest.class );
@@ -91,7 +95,7 @@
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
// setup the standard registries
@@ -128,7 +132,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -156,7 +160,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -433,28 +437,31 @@
}
- @Test(expected = LdapSchemaException.class)
+ @Test
public void testEvaluatorAttributeNoMatchingRule() throws Exception
{
- LdapSyntax syntax = new BogusSyntax( 1 );
- AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
- at.addName( "bogus" );
- at.setSchemaName( "other" );
- at.setSyntax( syntax );
-
- schemaManager.add( syntax );
- schemaManager.add( at );
-
- try
+ assertThrows( LdapSchemaException.class, () ->
{
- GreaterEqNode<String> node = new GreaterEqNode<String>( at, new Value( at, "3" ) );
- new GreaterEqEvaluator<String>( node, store, schemaManager );
- }
- finally
- {
- schemaManager.delete( at );
- schemaManager.delete( syntax );
- }
+ LdapSyntax syntax = new BogusSyntax( 1 );
+ AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
+ at.addName( "bogus" );
+ at.setSchemaName( "other" );
+ at.setSyntax( syntax );
+
+ schemaManager.add( syntax );
+ schemaManager.add( at );
+
+ try
+ {
+ GreaterEqNode<String> node = new GreaterEqNode<String>( at, new Value( at, "3" ) );
+ new GreaterEqEvaluator<String>( node, store, schemaManager );
+ }
+ finally
+ {
+ schemaManager.delete( at );
+ schemaManager.delete( syntax );
+ }
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
index 067cace..32364f0 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
@@ -20,11 +20,12 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -68,10 +69,12 @@
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.cursor.GreaterEqCursor;
import org.apache.directory.server.xdbm.search.evaluator.GreaterEqEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,6 +84,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class GreaterEqTest
{
public static final Logger LOG = LoggerFactory.getLogger( GreaterEqTest.class );
@@ -90,7 +94,7 @@
static SchemaManager schemaManager = null;
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
// setup the standard registries
@@ -127,7 +131,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -156,7 +160,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -716,28 +720,31 @@
}
- @Test(expected = LdapSchemaException.class)
+ @Test
public void testEvaluatorAttributeNoMatchingRule() throws Exception
{
- LdapSyntax syntax = new BogusSyntax( 1 );
- AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
- at.addName( "bogus" );
- at.setSchemaName( "other" );
- at.setSyntax( syntax );
-
- schemaManager.add( syntax );
- schemaManager.add( at );
-
- try
+ assertThrows( LdapSchemaException.class, () ->
{
- GreaterEqNode<String> node = new GreaterEqNode<String>( at, new Value( at, "3" ) );
- new GreaterEqEvaluator<String>( node, store, schemaManager );
- }
- finally
- {
- schemaManager.delete( at );
- schemaManager.delete( syntax );
- }
+ LdapSyntax syntax = new BogusSyntax( 1 );
+ AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
+ at.addName( "bogus" );
+ at.setSchemaName( "other" );
+ at.setSyntax( syntax );
+
+ schemaManager.add( syntax );
+ schemaManager.add( at );
+
+ try
+ {
+ GreaterEqNode<String> node = new GreaterEqNode<String>( at, new Value( at, "3" ) );
+ new GreaterEqEvaluator<String>( node, store, schemaManager );
+ }
+ finally
+ {
+ schemaManager.delete( at );
+ schemaManager.delete( syntax );
+ }
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
index 25d6bd5..4b4b8bf 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
@@ -20,11 +20,12 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -68,10 +69,12 @@
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.cursor.LessEqCursor;
import org.apache.directory.server.xdbm.search.evaluator.LessEqEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,6 +84,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class LessEqTest
{
public static final Logger LOG = LoggerFactory.getLogger( LessEqTest.class );
@@ -91,7 +95,7 @@
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
// setup the standard registries
@@ -128,7 +132,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -157,7 +161,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -743,29 +747,32 @@
}
- @Test(expected = LdapSchemaException.class)
+ @Test
public void testEvaluatorAttributeNoMatchingRule() throws Exception
{
- LdapSyntax syntax = new BogusSyntax( 10 );
- AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
- at.addName( "bogus" );
- at.setSchemaName( "other" );
- at.setSyntax( syntax );
-
- assertTrue( schemaManager.add( syntax ) );
- assertTrue( schemaManager.add( at ) );
-
- try
+ assertThrows( LdapSchemaException.class, () ->
{
- LessEqNode<String> node = new LessEqNode<String>( at, new Value( at, "3" ) );
-
- new LessEqEvaluator<String>( node, store, schemaManager );
- }
- finally
- {
- assertTrue( schemaManager.delete( at ) );
- assertTrue( schemaManager.delete( syntax ) );
- }
+ LdapSyntax syntax = new BogusSyntax( 10 );
+ AttributeType at = new AttributeType( SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000" );
+ at.addName( "bogus" );
+ at.setSchemaName( "other" );
+ at.setSyntax( syntax );
+
+ assertTrue( schemaManager.add( syntax ) );
+ assertTrue( schemaManager.add( at ) );
+
+ try
+ {
+ LessEqNode<String> node = new LessEqNode<String>( at, new Value( at, "3" ) );
+
+ new LessEqEvaluator<String>( node, store, schemaManager );
+ }
+ finally
+ {
+ assertTrue( schemaManager.delete( at ) );
+ assertTrue( schemaManager.delete( syntax ) );
+ }
+ } );
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
index 8550662..9b73897 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashSet;
@@ -55,10 +55,12 @@
import org.apache.directory.server.xdbm.StoreUtils;
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.Optimizer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,6 +71,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class NestedFilterTest extends AbstractCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( NestedFilterTest.class );
@@ -79,7 +82,7 @@
static FilterNormalizingVisitor visitor;
- @BeforeClass
+ @BeforeAll
static public void setup() throws Exception
{
// setup the standard registries
@@ -118,7 +121,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
directoryService = new MockDirectoryService();
@@ -156,7 +159,7 @@
}
- @After
+ @AfterEach
public void destryStore() throws Exception
{
if ( store != null )
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
index 5555d6d..f178522 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.HashSet;
@@ -60,10 +60,12 @@
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.server.xdbm.search.cursor.NotCursor;
import org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -74,6 +76,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class NotCursorTest extends AbstractCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( NotCursorTest.class );
@@ -84,7 +87,7 @@
static SchemaManager schemaManager = null;
- @BeforeClass
+ @BeforeAll
static public void setup() throws Exception
{
// setup the standard registries
@@ -120,7 +123,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
directoryService = new MockDirectoryService();
@@ -156,7 +159,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
index 4a73ace..92ef32e 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
@@ -20,9 +20,10 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -61,10 +62,12 @@
import org.apache.directory.server.xdbm.search.cursor.OrCursor;
import org.apache.directory.server.xdbm.search.cursor.SubstringCursor;
import org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,6 +82,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class OrCursorTest extends AbstractCursorTest
{
private static final Logger LOG = LoggerFactory.getLogger( OrCursorTest.class );
@@ -87,7 +91,7 @@
static SchemaManager schemaManager = null;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -122,7 +126,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
directoryService = new MockDirectoryService();
@@ -158,7 +162,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -301,169 +305,172 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
@SuppressWarnings("unchecked")
public void testOrCursor() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- List<Evaluator<? extends ExprNode>> evaluators = new ArrayList<Evaluator<? extends ExprNode>>();
- List<Cursor<IndexEntry<?, String>>> cursors = new ArrayList<Cursor<IndexEntry<?, String>>>();
- Evaluator<? extends ExprNode> eval;
- Cursor<IndexEntry<?, String>> cursor;
-
- OrNode orNode = new OrNode();
-
- ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
- Cursor subStrCursor1 = new SubstringCursor( txn, store, ( SubstringEvaluator ) eval );
- cursors.add( subStrCursor1 );
- evaluators.add( eval );
- orNode.addNode( exprNode );
-
- // try
- // {
- // new OrCursor( cursors, evaluators );
- // fail( "should throw IllegalArgumentException" );
- // }
- // catch( IllegalArgumentException ie ){ }
-
- exprNode = new SubstringNode( schemaManager.getAttributeType( "sn" ), "W", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
- evaluators.add( eval );
- Cursor subStrCursor2 = new SubstringCursor( txn, store, ( SubstringEvaluator ) eval );
- cursors.add( subStrCursor2 );
-
- orNode.addNode( exprNode );
-
- Set<String> expectedUuid = new HashSet<String>();
- expectedUuid.add( Strings.getUUID( 5 ) );
- expectedUuid.add( Strings.getUUID( 6 ) );
- expectedUuid.add( Strings.getUUID( 8 ) );
- expectedUuid.add( Strings.getUUID( 9 ) );
- expectedUuid.add( Strings.getUUID( 10 ) );
- expectedUuid.add( Strings.getUUID( 11 ) );
-
- Set<String> foundUuid = new HashSet<String>();
-
- cursor = new OrCursor( txn, cursors, evaluators );
-
- cursor.beforeFirst();
- assertFalse( cursor.available() );
-
- // from first
- assertTrue( cursor.first() );
- assertTrue( cursor.available() );
- String uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertTrue( cursor.next() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertTrue( cursor.next() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertTrue( cursor.next() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertTrue( cursor.next() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertTrue( cursor.next() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( expectedUuid.contains( uuid ) );
- foundUuid.add( uuid );
- expectedUuid.remove( uuid );
-
- assertFalse( cursor.next() );
- assertFalse( cursor.available() );
-
- // from last
- cursor.afterLast();
- assertFalse( cursor.available() );
-
- assertTrue( cursor.last() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertTrue( cursor.previous() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertTrue( cursor.previous() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertTrue( cursor.previous() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertTrue( cursor.previous() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertTrue( cursor.previous() );
- assertTrue( cursor.available() );
- uuid = cursor.get().getId();
- assertTrue( foundUuid.contains( uuid ) );
- foundUuid.remove( uuid );
-
- assertFalse( cursor.previous() );
- assertFalse( cursor.available() );
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- cursor.after( new IndexEntry<String, String>() );
- fail( "should fail with UnsupportedOperationException " );
- }
- catch ( UnsupportedOperationException uoe )
- {
- }
-
- try
- {
- cursor.before( new IndexEntry<String, String>() );
- fail( "should fail with UnsupportedOperationException " );
- }
- catch ( UnsupportedOperationException uoe )
- {
- }
-
- try
- {
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ List<Evaluator<? extends ExprNode>> evaluators = new ArrayList<Evaluator<? extends ExprNode>>();
+ List<Cursor<IndexEntry<?, String>>> cursors = new ArrayList<Cursor<IndexEntry<?, String>>>();
+ Evaluator<? extends ExprNode> eval;
+ Cursor<IndexEntry<?, String>> cursor;
+
+ OrNode orNode = new OrNode();
+
+ ExprNode exprNode = new SubstringNode( schemaManager.getAttributeType( "cn" ), "J", null );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
+ Cursor subStrCursor1 = new SubstringCursor( txn, store, ( SubstringEvaluator ) eval );
+ cursors.add( subStrCursor1 );
+ evaluators.add( eval );
+ orNode.addNode( exprNode );
+
+ // try
+ // {
+ // new OrCursor( cursors, evaluators );
+ // fail( "should throw IllegalArgumentException" );
+ // }
+ // catch( IllegalArgumentException ie ){ }
+
+ exprNode = new SubstringNode( schemaManager.getAttributeType( "sn" ), "W", null );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
+ evaluators.add( eval );
+ Cursor subStrCursor2 = new SubstringCursor( txn, store, ( SubstringEvaluator ) eval );
+ cursors.add( subStrCursor2 );
+
+ orNode.addNode( exprNode );
+
+ Set<String> expectedUuid = new HashSet<String>();
+ expectedUuid.add( Strings.getUUID( 5 ) );
+ expectedUuid.add( Strings.getUUID( 6 ) );
+ expectedUuid.add( Strings.getUUID( 8 ) );
+ expectedUuid.add( Strings.getUUID( 9 ) );
+ expectedUuid.add( Strings.getUUID( 10 ) );
+ expectedUuid.add( Strings.getUUID( 11 ) );
+
+ Set<String> foundUuid = new HashSet<String>();
+
+ cursor = new OrCursor( txn, cursors, evaluators );
+
+ cursor.beforeFirst();
+ assertFalse( cursor.available() );
+
+ // from first
+ assertTrue( cursor.first() );
+ assertTrue( cursor.available() );
+ String uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertTrue( cursor.next() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertTrue( cursor.next() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertTrue( cursor.next() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertTrue( cursor.next() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertTrue( cursor.next() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( expectedUuid.contains( uuid ) );
+ foundUuid.add( uuid );
+ expectedUuid.remove( uuid );
+
+ assertFalse( cursor.next() );
+ assertFalse( cursor.available() );
+
+ // from last
+ cursor.afterLast();
+ assertFalse( cursor.available() );
+
+ assertTrue( cursor.last() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertTrue( cursor.previous() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertTrue( cursor.previous() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertTrue( cursor.previous() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertTrue( cursor.previous() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertTrue( cursor.previous() );
+ assertTrue( cursor.available() );
+ uuid = cursor.get().getId();
+ assertTrue( foundUuid.contains( uuid ) );
+ foundUuid.remove( uuid );
+
+ assertFalse( cursor.previous() );
+ assertFalse( cursor.available() );
+
+ try
+ {
+ cursor.after( new IndexEntry<String, String>() );
+ fail( "should fail with UnsupportedOperationException " );
+ }
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
+ try
+ {
+ cursor.before( new IndexEntry<String, String>() );
+ fail( "should fail with UnsupportedOperationException " );
+ }
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
+ try
+ {
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
index 76bd447..375974d 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
@@ -20,10 +20,11 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
import java.util.ArrayList;
@@ -55,10 +56,12 @@
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.cursor.PresenceCursor;
import org.apache.directory.server.xdbm.search.evaluator.PresenceEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,6 +71,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class PresenceTest
{
private static final Logger LOG = LoggerFactory.getLogger( PresenceTest.class );
@@ -79,7 +83,7 @@
private static String NORMALIZED_CN_OID;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -118,7 +122,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -149,7 +153,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -488,90 +492,102 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException2() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "cn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportBeforeWithoutIndex() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.before( entry );
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.before( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportAfterWithoutIndex() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- PresenceCursor cursor = null;
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- cursor = new PresenceCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.after( entry );
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ PresenceCursor cursor = null;
+
+ try
+ {
+ PresenceNode node = new PresenceNode( schemaManager.getAttributeType( "sn" ) );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
+ cursor = new PresenceCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.after( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
}
diff --git a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
index aed33e6..a7e5678 100644
--- a/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
+++ b/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
@@ -20,10 +20,11 @@
package org.apache.directory.server.xdbm.search.impl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.File;
@@ -50,10 +51,12 @@
import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
import org.apache.directory.server.xdbm.search.cursor.SubstringCursor;
import org.apache.directory.server.xdbm.search.evaluator.SubstringEvaluator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,6 +66,7 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
+@Execution(ExecutionMode.SAME_THREAD)
public class SubstringTest
{
private static final Logger LOG = LoggerFactory.getLogger( SubstringTest.class );
@@ -73,7 +77,7 @@
private static DnFactory dnFactory;
- @BeforeClass
+ @BeforeAll
public static void setup() throws Exception
{
String workingDirectory = System.getProperty( "workingDirectory" );
@@ -109,7 +113,7 @@
}
- @Before
+ @BeforeEach
public void createStore() throws Exception
{
// setup the working directory for the store
@@ -141,7 +145,7 @@
}
- @After
+ @AfterEach
public void destroyStore() throws Exception
{
if ( store != null )
@@ -732,90 +736,102 @@
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- SubstringCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "b", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- cursor = new SubstringCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ SubstringCursor cursor = null;
+
+ try
+ {
+ SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "b", null );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
+ cursor = new SubstringCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = InvalidCursorPositionException.class)
+ @Test
public void testInvalidCursorPositionException2() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- SubstringCursor cursor = null;
-
- try
+ assertThrows( InvalidCursorPositionException.class, () ->
{
- SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- cursor = new SubstringCursor( txn, store, evaluator );
- cursor.get();
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ SubstringCursor cursor = null;
+
+ try
+ {
+ SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "j", null );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
+ cursor = new SubstringCursor( txn, store, evaluator );
+ cursor.get();
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportBeforeWithoutIndex() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- SubstringCursor cursor = null;
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- cursor = new SubstringCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.before( entry );
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ SubstringCursor cursor = null;
+
+ try
+ {
+ SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j", null );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
+ cursor = new SubstringCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.before( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
- @Test(expected = UnsupportedOperationException.class)
+ @Test
public void testUnsupportAfterWithoutIndex() throws Exception
{
- PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
- SubstringCursor cursor = null;
-
- try
+ assertThrows( UnsupportedOperationException.class, () ->
{
- SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- cursor = new SubstringCursor( txn, store, evaluator );
-
- // test before()
- IndexEntry<String, String> entry = new IndexEntry<String, String>();
- entry.setKey( SchemaConstants.SN_AT_OID );
- cursor.after( entry );
- }
- finally
- {
- cursor.close();
- }
+ PartitionTxn txn = ( ( Partition ) store ).beginReadTransaction();
+ SubstringCursor cursor = null;
+
+ try
+ {
+ SubstringNode node = new SubstringNode( schemaManager.getAttributeType( "sn" ), "j", null );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
+ cursor = new SubstringCursor( txn, store, evaluator );
+
+ // test before()
+ IndexEntry<String, String> entry = new IndexEntry<String, String>();
+ entry.setKey( SchemaConstants.SN_AT_OID );
+ cursor.after( entry );
+ }
+ finally
+ {
+ cursor.close();
+ }
+ } );
}
}