|
20 | 20 |
|
21 | 21 | import static org.apache.bookkeeper.mledger.ManagedCursor.CURSOR_INTERNAL_PROPERTY_PREFIX; |
22 | 22 | import static org.apache.bookkeeper.mledger.util.Futures.executeWithRetry; |
| 23 | +import static org.apache.bookkeeper.mledger.util.ManagedLedgerTestUtil.rawEntryConfig; |
23 | 24 | import static org.testng.Assert.assertEquals; |
24 | 25 | import static org.testng.Assert.assertNull; |
25 | 26 | import static org.testng.Assert.assertTrue; |
|
33 | 34 | import java.util.concurrent.TimeUnit; |
34 | 35 | import org.apache.bookkeeper.mledger.ManagedCursor; |
35 | 36 | import org.apache.bookkeeper.mledger.ManagedLedger; |
36 | | -import org.apache.bookkeeper.mledger.ManagedLedgerConfig; |
37 | 37 | import org.apache.bookkeeper.mledger.ManagedLedgerException; |
38 | 38 | import org.apache.bookkeeper.mledger.ManagedLedgerFactory; |
39 | 39 | import org.apache.bookkeeper.mledger.Position; |
@@ -47,7 +47,7 @@ public class ManagedCursorPropertiesTest extends MockedBookKeeperTestCase { |
47 | 47 |
|
48 | 48 | @Test(timeOut = 20000) |
49 | 49 | void testPropertiesClose() throws Exception { |
50 | | - ManagedLedger ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 50 | + ManagedLedger ledger = factory.open("my_test_ledger", rawEntryConfig()); |
51 | 51 | ManagedCursor c1 = ledger.openCursor("c1"); |
52 | 52 |
|
53 | 53 | assertEquals(c1.getProperties(), Collections.emptyMap()); |
@@ -76,7 +76,7 @@ void testPropertiesClose() throws Exception { |
76 | 76 | ledger.close(); |
77 | 77 |
|
78 | 78 | // Reopen the managed ledger |
79 | | - ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 79 | + ledger = factory.open("my_test_ledger", rawEntryConfig()); |
80 | 80 | c1 = ledger.openCursor("c1"); |
81 | 81 |
|
82 | 82 | assertEquals(c1.getMarkDeletedPosition(), p3); |
@@ -85,7 +85,7 @@ void testPropertiesClose() throws Exception { |
85 | 85 |
|
86 | 86 | @Test(timeOut = 20000) |
87 | 87 | void testPropertiesRecoveryAfterCrash() throws Exception { |
88 | | - ManagedLedger ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 88 | + ManagedLedger ledger = factory.open("my_test_ledger", rawEntryConfig()); |
89 | 89 |
|
90 | 90 | Map<String, String> cursorProperties = new TreeMap<>(); |
91 | 91 | cursorProperties.put("custom1", "one"); |
@@ -111,7 +111,7 @@ void testPropertiesRecoveryAfterCrash() throws Exception { |
111 | 111 | ManagedLedgerFactory factory2 = new ManagedLedgerFactoryImpl(metadataStore, bkc); |
112 | 112 |
|
113 | 113 | // Reopen the managed ledger |
114 | | - ledger = factory2.open("my_test_ledger", new ManagedLedgerConfig()); |
| 114 | + ledger = factory2.open("my_test_ledger", rawEntryConfig()); |
115 | 115 | c1 = ledger.openCursor("c1"); |
116 | 116 |
|
117 | 117 | assertEquals(c1.getMarkDeletedPosition(), p3); |
@@ -123,7 +123,7 @@ void testPropertiesRecoveryAfterCrash() throws Exception { |
123 | 123 |
|
124 | 124 | @Test(timeOut = 20000) |
125 | 125 | void testPropertiesOnDelete() throws Exception { |
126 | | - ManagedLedger ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 126 | + ManagedLedger ledger = factory.open("my_test_ledger", rawEntryConfig()); |
127 | 127 | ManagedCursor c1 = ledger.openCursor("c1"); |
128 | 128 |
|
129 | 129 | assertEquals(c1.getProperties(), Collections.emptyMap()); |
@@ -149,7 +149,7 @@ void testPropertiesOnDelete() throws Exception { |
149 | 149 | ledger.close(); |
150 | 150 |
|
151 | 151 | // Reopen the managed ledger |
152 | | - ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 152 | + ledger = factory.open("my_test_ledger", rawEntryConfig()); |
153 | 153 | c1 = ledger.openCursor("c1"); |
154 | 154 |
|
155 | 155 | assertEquals(c1.getMarkDeletedPosition(), p3); |
@@ -158,7 +158,7 @@ void testPropertiesOnDelete() throws Exception { |
158 | 158 |
|
159 | 159 | @Test |
160 | 160 | void testPropertiesAtCreation() throws Exception { |
161 | | - ManagedLedger ledger = factory.open("my_test_ledger_at_creation", new ManagedLedgerConfig()); |
| 161 | + ManagedLedger ledger = factory.open("my_test_ledger_at_creation", rawEntryConfig()); |
162 | 162 |
|
163 | 163 |
|
164 | 164 | Map<String, Long> properties = new TreeMap<>(); |
@@ -179,7 +179,7 @@ void testPropertiesAtCreation() throws Exception { |
179 | 179 | ledger.close(); |
180 | 180 |
|
181 | 181 | // Reopen the managed ledger |
182 | | - ledger = factory.open("my_test_ledger_at_creation", new ManagedLedgerConfig()); |
| 182 | + ledger = factory.open("my_test_ledger_at_creation", rawEntryConfig()); |
183 | 183 | c1 = ledger.openCursor("c1"); |
184 | 184 |
|
185 | 185 | assertEquals(c1.getProperties(), properties); |
@@ -188,7 +188,7 @@ void testPropertiesAtCreation() throws Exception { |
188 | 188 |
|
189 | 189 | @Test |
190 | 190 | void testUpdateCursorProperties() throws Exception { |
191 | | - ManagedLedger ledger = factory.open("testUpdateCursorProperties", new ManagedLedgerConfig()); |
| 191 | + ManagedLedger ledger = factory.open("testUpdateCursorProperties", rawEntryConfig()); |
192 | 192 |
|
193 | 193 | Map<String, Long> properties = new TreeMap<>(); |
194 | 194 | properties.put("a", 1L); |
@@ -212,7 +212,7 @@ void testUpdateCursorProperties() throws Exception { |
212 | 212 | ledger.close(); |
213 | 213 |
|
214 | 214 | // Reopen the managed ledger |
215 | | - ledger = factory.open("testUpdateCursorProperties", new ManagedLedgerConfig()); |
| 215 | + ledger = factory.open("testUpdateCursorProperties", rawEntryConfig()); |
216 | 216 | c1 = ledger.openCursor("c1"); |
217 | 217 |
|
218 | 218 | assertEquals(c1.getProperties(), properties); |
@@ -227,7 +227,7 @@ void testUpdateCursorProperties() throws Exception { |
227 | 227 | // Create a new factory to force a managed ledger close and recovery |
228 | 228 | ManagedLedgerFactory factory2 = new ManagedLedgerFactoryImpl(metadataStore, bkc); |
229 | 229 | // Reopen the managed ledger |
230 | | - ledger = factory2.open("testUpdateCursorProperties", new ManagedLedgerConfig()); |
| 230 | + ledger = factory2.open("testUpdateCursorProperties", rawEntryConfig()); |
231 | 231 | c1 = ledger.openCursor("c1"); |
232 | 232 |
|
233 | 233 | assertEquals(c1.getProperties(), properties); |
@@ -240,7 +240,7 @@ void testUpdateCursorProperties() throws Exception { |
240 | 240 | // Create a new factory to force a managed ledger close and recovery |
241 | 241 | ManagedLedgerFactory factory3 = new ManagedLedgerFactoryImpl(metadataStore, bkc); |
242 | 242 | // Reopen the managed ledger |
243 | | - ledger = factory3.open("testUpdateCursorProperties", new ManagedLedgerConfig()); |
| 243 | + ledger = factory3.open("testUpdateCursorProperties", rawEntryConfig()); |
244 | 244 | c1 = ledger.openCursor("c1"); |
245 | 245 |
|
246 | 246 | c1.putCursorProperty(CURSOR_INTERNAL_PROPERTY_PREFIX + "test", "test").get(10, TimeUnit.SECONDS); |
@@ -266,7 +266,7 @@ void testUpdateCursorProperties() throws Exception { |
266 | 266 |
|
267 | 267 | @Test |
268 | 268 | public void testUpdateCursorPropertiesConcurrent() throws Exception { |
269 | | - ManagedLedger ledger = factory.open("my_test_ledger", new ManagedLedgerConfig()); |
| 269 | + ManagedLedger ledger = factory.open("my_test_ledger", rawEntryConfig()); |
270 | 270 | ManagedCursor c1 = ledger.openCursor("c1"); |
271 | 271 |
|
272 | 272 | List<CompletableFuture<Void>> futures = new ArrayList<>(); |
|