Search in sources :

Example 31 with VoltMessage

use of org.voltcore.messaging.VoltMessage in project voltdb by VoltDB.

the class TestRepairLog method testOffer.

@Test
public void testOffer() {
    final AtomicLong lastCommitted = new AtomicLong(Long.MIN_VALUE);
    final TransactionCommitInterest interest = lastCommitted::set;
    // offer some various messages to log and check
    // that it keeps the expected ones.
    RepairLog rl = new RepairLog();
    rl.registerTransactionCommitInterest(interest);
    VoltMessage m1 = nonTruncInitMsg();
    VoltMessage m2 = nonTruncInitMsg();
    rl.deliver(m1);
    rl.deliver(m2);
    List<Iv2RepairLogResponseMessage> contents = rl.contents(1l, false);
    assertEquals(3, contents.size());
    assertEquals(m1, contents.get(1).getPayload());
    assertEquals(m2, contents.get(2).getPayload());
    assertEquals(Long.MIN_VALUE, lastCommitted.get());
}
Also used : VoltMessage(org.voltcore.messaging.VoltMessage) Iv2RepairLogResponseMessage(org.voltdb.messaging.Iv2RepairLogResponseMessage) AtomicLong(java.util.concurrent.atomic.AtomicLong) Test(org.junit.Test)

Aggregations

VoltMessage (org.voltcore.messaging.VoltMessage)31 Test (org.junit.Test)8 AtomicLong (java.util.concurrent.atomic.AtomicLong)5 FaultMessage (org.voltcore.messaging.FaultMessage)4 SiteFailureMessage (org.voltcore.messaging.SiteFailureMessage)4 Subject (org.voltcore.messaging.Subject)4 ByteBuffer (java.nio.ByteBuffer)3 ArrayList (java.util.ArrayList)3 Iv2RepairLogResponseMessage (org.voltdb.messaging.Iv2RepairLogResponseMessage)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 Message (org.voltcore.agreement.FakeMesh.Message)2 SiteFailureForwardMessage (org.voltcore.messaging.SiteFailureForwardMessage)2 InitiateResponseMessage (org.voltdb.messaging.InitiateResponseMessage)2 LocalMailbox (org.voltdb.messaging.LocalMailbox)2 ImmutableList (com.google_voltpatches.common.collect.ImmutableList)1 ImmutableMap (com.google_voltpatches.common.collect.ImmutableMap)1 List (java.util.List)1