MCPcopy Create free account
hub / github.com/cruppstahl/upscaledb / testBulkOperations

Method testBulkOperations

java/unittests/DatabaseTest.java:198–238  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

196 }
197
198 public void testBulkOperations() {
199 byte[] k1 = new byte[] {0x11};
200 byte[] r1 = new byte[] {0x11};
201
202 byte[] k2 = new byte[] {0x22};
203 byte[] r2 = new byte[] {0x22};
204
205 byte[] k3 = new byte[] {0x33};
206 byte[] r3 = new byte[] {0x33};
207
208 byte[] r4 = null;
209 byte[] r5 = null;
210
211 Operation[] operations = new Operation[] {
212 new Operation(Const.UPS_OP_INSERT, k1, r1, 0),
213 new Operation(Const.UPS_OP_INSERT, k2, r2, 0),
214 new Operation(Const.UPS_OP_INSERT, k3, r3, 0),
215 new Operation(Const.UPS_OP_FIND, k3, r4, 0),
216 new Operation(Const.UPS_OP_ERASE, k3, null, 0),
217 new Operation(Const.UPS_OP_FIND, k3, r5, 0)
218 };
219
220 Database db;
221 Environment env = new Environment();
222 try {
223 env.create("jtest.db");
224 db = env.createDatabase((short)1);
225 assertEquals(0, db.getCount());
226 db.bulkOperations(null, operations);
227 assertByteArrayEquals(operations[3].record, r3);
228 assertEquals(0, operations[3].result);
229 assertEquals(0, operations[4].result);
230 assertEquals(Const.UPS_KEY_NOT_FOUND, operations[5].result);
231 assertEquals(2, db.getCount());
232 db.close();
233 }
234 catch (DatabaseException err) {
235 fail("Exception "+err);
236 }
237 env.close();
238 }
239
240 public void testBulkApproxMatching() {
241 byte[] k1 = new byte[] {0x11};

Callers

nothing calls this directly

Calls 7

createMethod · 0.95
createDatabaseMethod · 0.95
getCountMethod · 0.95
bulkOperationsMethod · 0.95
assertByteArrayEqualsMethod · 0.95
closeMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected