1 package org.apache.directmemory.memory;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collection;
23 import java.util.HashSet;
24
25 import org.apache.directmemory.memory.allocator.Allocator;
26 import org.apache.directmemory.memory.allocator.FixedSizeByteBufferAllocatorImpl;
27 import org.apache.directmemory.memory.allocator.SlabByteBufferAllocator;
28 import org.junit.Test;
29
30 public class SlabMemoryManagerServiceTest
31 extends AbstractMemoryManagerServiceTest
32 {
33
34 @Override
35 protected MemoryManagerService<Object> instanciateMemoryManagerService( int bufferSize )
36 {
37 final MemoryManagerService<Object> mms = new MemoryManagerServiceImpl<Object>()
38 {
39
40 @Override
41 protected Allocator instanciateByteBufferAllocator( int allocatorNumber, int size )
42 {
43 Collection<FixedSizeByteBufferAllocatorImpl> slabs = new HashSet<FixedSizeByteBufferAllocatorImpl>();
44
45 slabs.add( new FixedSizeByteBufferAllocatorImpl( 0, size, SMALL_PAYLOAD_LENGTH / 2, 1 ) );
46 slabs.add( new FixedSizeByteBufferAllocatorImpl( 1, size, SMALL_PAYLOAD_LENGTH, 1 ) );
47 slabs.add( new FixedSizeByteBufferAllocatorImpl( 2, size, SMALL_PAYLOAD_LENGTH * 2, 1 ) );
48
49 final SlabByteBufferAllocator allocator =
50 new SlabByteBufferAllocator( allocatorNumber, slabs, false );
51
52 return allocator;
53 }
54
55 };
56 mms.init( 1, bufferSize );
57 return mms;
58 }
59
60 @Override
61 @Test
62 public void testFullFillAndFreeAndClearBuffer()
63 {
64
65 }
66
67 @Override
68 @Test
69 public void testStoreAllocAndFree()
70 {
71
72 }
73
74 @Override
75 @Test
76 public void testAllocate()
77 {
78
79 }
80
81 }