journal.write(JournalEntryType.REDO, cid1, L.stringToByteBuffer(str1)) ; journal.write(JournalEntryType.REDO, cid2, L.stringToByteBuffer(str2)) ; journal.writeJournal(JournalEntry.COMMIT) ; journal.close();
journal.write(JournalEntryType.REDO, cid1, L.stringToByteBuffer(str1)) ; journal.write(JournalEntryType.REDO, cid2, L.stringToByteBuffer(str2)) ; journal.writeJournal(JournalEntry.COMMIT) ; journal.close();
@Test public void recoverBlobFile_1() throws Exception { String str = "Hello Journal" ; ComponentId cid = ComponentId.allocLocal() ; // ComponentIdRegistry registry = new ComponentIdRegistry() ; // registry.register(cid, "Blob", 1) ; // Write out a journal. { Journal journal = Journal.create(Location.create(dir.getRoot().getAbsolutePath())) ; journal.write(JournalEntryType.REDO, cid, L.stringToByteBuffer(str)) ; journal.writeJournal(JournalEntry.COMMIT) ; journal.close(); } TransactionCoordinator coord = new TransactionCoordinator(Location.create(dir.getRoot().getAbsolutePath())) ; BufferChannel chan = BufferChannelFile.create(data) ; TransBlob tBlob = new TransBlob(cid, chan) ; coord.add(tBlob) ; coord.start(); ByteBuffer blob = tBlob.getBlob() ; assertNotNull(blob); String s = L.byteBufferToString(blob) ; assertEquals(str,s) ; coord.shutdown(); }
@Test public void recoverBlobFile_1() throws Exception { String str = "Hello Journal" ; ComponentId cid = ComponentId.allocLocal() ; // ComponentIdRegistry registry = new ComponentIdRegistry() ; // registry.register(cid, "Blob", 1) ; // Write out a journal. { Journal journal = Journal.create(Location.create(dir.getRoot().getAbsolutePath())) ; journal.write(JournalEntryType.REDO, cid, L.stringToByteBuffer(str)) ; journal.writeJournal(JournalEntry.COMMIT) ; journal.close(); } TransactionCoordinator coord = new TransactionCoordinator(Location.create(dir.getRoot().getAbsolutePath())) ; BufferChannel chan = BufferChannelFile.create(data) ; TransBlob tBlob = new TransBlob(cid, chan) ; coord.add(tBlob) ; coord.start(); ByteBuffer blob = tBlob.getBlob() ; assertNotNull(blob); String s = L.byteBufferToString(blob) ; assertEquals(str,s) ; coord.shutdown(); }