|
28 | 28 | import static java.nio.ByteBuffer.allocate; |
29 | 29 | import static java.nio.ByteBuffer.allocateDirect; |
30 | 30 | import jnr.ffi.Pointer; |
| 31 | +import jnr.ffi.provider.MemoryManager; |
31 | 32 | import static org.hamcrest.CoreMatchers.is; |
32 | 33 | import static org.hamcrest.CoreMatchers.not; |
33 | 34 | import static org.hamcrest.CoreMatchers.notNullValue; |
34 | 35 | import static org.hamcrest.CoreMatchers.startsWith; |
35 | 36 | import static org.hamcrest.MatcherAssert.assertThat; |
36 | | -import org.junit.Ignore; |
37 | 37 | import org.junit.Rule; |
38 | 38 | import org.junit.Test; |
39 | 39 | import org.junit.rules.TemporaryFolder; |
| 40 | +import static org.lmdbjava.BufferProxy.MDB_VAL_STRUCT_SIZE; |
40 | 41 | import static org.lmdbjava.ByteBufferProxy.AbstractByteBufferProxy.findField; |
41 | 42 | import org.lmdbjava.ByteBufferProxy.BufferMustBeDirectException; |
42 | 43 | import static org.lmdbjava.ByteBufferProxy.PROXY_OPTIMAL; |
|
53 | 54 | */ |
54 | 55 | public final class ByteBufferProxyTest { |
55 | 56 |
|
| 57 | + static final MemoryManager MEM_MGR = RUNTIME.getMemoryManager(); |
| 58 | + |
56 | 59 | @Rule |
57 | 60 | public final TemporaryFolder tmp = new TemporaryFolder(); |
58 | 61 |
|
@@ -91,7 +94,6 @@ public void inOutBuffersProxyOptimal() { |
91 | 94 | } |
92 | 95 |
|
93 | 96 | @Test |
94 | | - @Ignore("Fails; requires investigation") |
95 | 97 | public void inOutBuffersProxySafe() { |
96 | 98 | checkInOut(PROXY_SAFE); |
97 | 99 | } |
@@ -126,7 +128,7 @@ private void checkInOut(final BufferProxy<ByteBuffer> v) { |
126 | 128 | b.flip(); |
127 | 129 | b.position(BYTES); // skip 1 |
128 | 130 |
|
129 | | - final Pointer p = RUNTIME.getMemoryManager().allocateTemporary(1, false); |
| 131 | + final Pointer p = MEM_MGR.allocateTemporary(MDB_VAL_STRUCT_SIZE, false); |
130 | 132 | v.in(b, p, p.address()); |
131 | 133 |
|
132 | 134 | final ByteBuffer bb = allocateDirect(1); |
|
0 commit comments