Search in sources :

Example 1 with MessageStoreRecovery

use of com.github.ambry.store.MessageStoreRecovery in project ambry by linkedin.

the class BlobStoreRecoveryTest method recoveryTest.

@Test
public void recoveryTest() throws MessageFormatException, IOException {
    MessageStoreRecovery recovery = new BlobStoreRecovery();
    // create log and write to it
    ReadImp readrecovery = new ReadImp();
    readrecovery.initialize();
    List<MessageInfo> recoveredMessages = recovery.recover(readrecovery, 0, readrecovery.getSize(), new MockIdFactory());
    Assert.assertEquals(recoveredMessages.size(), 6);
    verifyInfo(recoveredMessages.get(0), readrecovery.keys[0], readrecovery.sizes.get(0), readrecovery.expectedExpirationTimeMs, false, false);
    verifyInfo(recoveredMessages.get(1), readrecovery.keys[1], readrecovery.sizes.get(1), Utils.Infinite_Time, false, false);
    verifyInfo(recoveredMessages.get(2), readrecovery.keys[2], readrecovery.sizes.get(2), Utils.Infinite_Time, false, false);
    verifyInfo(recoveredMessages.get(4), readrecovery.keys[1], readrecovery.sizes.get(4), Utils.Infinite_Time, true, false);
    if (MessageFormatRecord.headerVersionToUse >= MessageFormatRecord.Message_Header_Version_V2) {
        verifyInfo(recoveredMessages.get(3), readrecovery.keys[1], readrecovery.sizes.get(3), Utils.Infinite_Time, false, true);
        verifyInfo(recoveredMessages.get(5), readrecovery.keys[0], readrecovery.sizes.get(5), Utils.Infinite_Time, false, true);
    } else {
        verifyInfo(recoveredMessages.get(3), readrecovery.keys[3], readrecovery.sizes.get(3), Utils.Infinite_Time, false, false);
        verifyInfo(recoveredMessages.get(5), readrecovery.keys[4], readrecovery.sizes.get(5), Utils.Infinite_Time, false, false);
    }
}
Also used : MessageStoreRecovery(com.github.ambry.store.MessageStoreRecovery) MockIdFactory(com.github.ambry.store.MockIdFactory) MessageInfo(com.github.ambry.store.MessageInfo) Test(org.junit.Test)

Aggregations

MessageInfo (com.github.ambry.store.MessageInfo)1 MessageStoreRecovery (com.github.ambry.store.MessageStoreRecovery)1 MockIdFactory (com.github.ambry.store.MockIdFactory)1 Test (org.junit.Test)1