|
29 | 29 | import static java.nio.ByteBuffer.allocateDirect; |
30 | 30 | import static java.nio.charset.StandardCharsets.UTF_8; |
31 | 31 | import static java.util.Collections.nCopies; |
| 32 | +import java.util.List; |
32 | 33 | import java.util.Random; |
33 | 34 | import org.agrona.concurrent.UnsafeBuffer; |
34 | 35 | import static org.hamcrest.CoreMatchers.is; |
@@ -121,6 +122,24 @@ public void getName() { |
121 | 122 | assertThat(db.getName(), is(DB_1.getBytes(UTF_8))); |
122 | 123 | } |
123 | 124 |
|
| 125 | + @Test |
| 126 | + public void getNamesWhenDbisPresent() { |
| 127 | + final byte[] dbHello = new byte[]{'h', 'e', 'l', 'l', 'o'}; |
| 128 | + final byte[] dbWorld = new byte[]{'w', 'o', 'r', 'l', 'd'}; |
| 129 | + env.openDbi(dbHello, MDB_CREATE); |
| 130 | + env.openDbi(dbWorld, MDB_CREATE); |
| 131 | + final List<byte[]> dbiNames = env.getDbiNames(); |
| 132 | + assertThat(dbiNames.size(), is(2)); |
| 133 | + assertThat(dbiNames.get(0), is(dbHello)); |
| 134 | + assertThat(dbiNames.get(1), is(dbWorld)); |
| 135 | + } |
| 136 | + |
| 137 | + @Test |
| 138 | + public void getNamesWhenEmpty() { |
| 139 | + final List<byte[]> dbiNames = env.getDbiNames(); |
| 140 | + assertThat(dbiNames, nullValue()); |
| 141 | + } |
| 142 | + |
124 | 143 | @Test |
125 | 144 | public void putAbortGet() { |
126 | 145 | final Dbi<ByteBuffer> db = env.openDbi(DB_1, MDB_CREATE); |
|
0 commit comments