Search in sources :

Example 1 with PaxosPromise

use of com.palantir.paxos.PaxosPromise in project atlasdb by palantir.

the class ProtobufTest method testPaxosPromisePersistence.

@Test
public void testPaxosPromisePersistence() throws Exception {
    PaxosPromise expected;
    PaxosPromiseProto persisted;
    PaxosPromise actual;
    expected = PaxosPromise.reject(new PaxosProposalId(3, "unique"));
    persisted = PaxosPromises.toProto(expected);
    actual = PaxosPromises.fromProto(persisted);
    assertEquals(expected, actual);
    expected = PaxosPromise.accept(new PaxosProposalId(20, "id"), new PaxosProposalId(6, "fire"), new PaxosValue("me", 5, new byte[] { 8, 8, 100 }));
    persisted = PaxosPromises.toProto(expected);
    actual = PaxosPromises.fromProto(persisted);
    assertEquals(expected, actual);
    expected = PaxosPromise.accept(new PaxosProposalId(20, "id"), null, new PaxosValue("me", 5, new byte[] { 8, 8, 100 }));
    persisted = PaxosPromises.toProto(expected);
    actual = PaxosPromises.fromProto(persisted);
    assertEquals(expected, actual);
    expected = PaxosPromise.accept(new PaxosProposalId(20, "id"), null, null);
    persisted = PaxosPromises.toProto(expected);
    actual = PaxosPromises.fromProto(persisted);
    assertEquals(expected, actual);
}
Also used : PaxosPromise(com.palantir.paxos.PaxosPromise) PaxosProposalId(com.palantir.paxos.PaxosProposalId) PaxosPromiseProto(com.palantir.paxos.persistence.generated.remoting.PaxosAcceptorPersistence.PaxosPromiseProto) PaxosValue(com.palantir.paxos.PaxosValue) Test(org.junit.Test)

Aggregations

PaxosPromise (com.palantir.paxos.PaxosPromise)1 PaxosProposalId (com.palantir.paxos.PaxosProposalId)1 PaxosValue (com.palantir.paxos.PaxosValue)1 PaxosPromiseProto (com.palantir.paxos.persistence.generated.remoting.PaxosAcceptorPersistence.PaxosPromiseProto)1 Test (org.junit.Test)1