| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.backends.pluggable.State.IndexFlag; |
| | | import org.opends.server.backends.pluggable.spi.AccessMode; |
| | | import org.opends.server.backends.pluggable.spi.Cursor; |
| | | import org.opends.server.backends.pluggable.spi.ReadableTransaction; |
| | | import org.opends.server.backends.pluggable.spi.StorageRuntimeException; |
| | |
| | | import org.testng.annotations.BeforeTest; |
| | | import org.testng.annotations.Test; |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | @Test(groups = { "precommit", "pluggablebackend" }, sequential = true) |
| | | public class DefaultIndexTest extends DirectoryServerTestCase |
| | | { |
| | |
| | | @BeforeTest |
| | | public void setUp() { |
| | | txn = new DummyWriteableTransaction(); |
| | | index = newIndex("test", 5, EnumSet.of(TRUSTED, COMPACTED));; |
| | | index = newIndex("test", 5, EnumSet.of(TRUSTED, COMPACTED)); |
| | | index.open(txn, true); |
| | | } |
| | | |
| | |
| | | return new DefaultIndex(new TreeName("dc=example,dc=com", name), state, indexLimit, mock(EntryContainer.class)); |
| | | } |
| | | |
| | | final static class DummyWriteableTransaction implements WriteableTransaction { |
| | | static final class DummyWriteableTransaction implements WriteableTransaction { |
| | | |
| | | private final Map<TreeName, TreeMap<ByteString, ByteString>> storage = new HashMap<>(); |
| | | |
| | |
| | | current = null; |
| | | |
| | | it = tree.tailMap(key.toByteString()).entrySet().iterator(); |
| | | if (it.hasNext() && it.next().getKey().equals(key.toByteString())) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | return it.hasNext() && it.next().getKey().equals(key.toByteString()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | { |
| | | return getTree(treeName).remove(key) != null; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |