Search in sources :

Example 1 with PaxosProposal

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

the class LeaderRemotingTest method testAccept.

@Test
public void testAccept() throws IOException {
    PaxosProposalId id = new PaxosProposalId(123123, UUID.randomUUID().toString());
    PaxosProposal paxosProposal = new PaxosProposal(id, new PaxosValue(id.getProposerUUID(), 0, new byte[] { 0, 1, 2, 4, 1 }));
    PaxosAcceptor accept = AtlasDbFeignTargetFactory.createProxy(Optional.empty(), acceptor.baseUri().toString(), PaxosAcceptor.class, UserAgents.DEFAULT_USER_AGENT);
    accept.accept(0, paxosProposal);
    accept.getLatestSequencePreparedOrAccepted();
    accept.prepare(0, id);
    accept.prepare(1, id);
}
Also used : PaxosAcceptor(com.palantir.paxos.PaxosAcceptor) PaxosProposal(com.palantir.paxos.PaxosProposal) PaxosProposalId(com.palantir.paxos.PaxosProposalId) PaxosValue(com.palantir.paxos.PaxosValue) Test(org.junit.Test)

Example 2 with PaxosProposal

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

the class ProtobufTest method testPaxosProposalPersistence.

@Test
public void testPaxosProposalPersistence() throws Exception {
    PaxosProposal expected;
    PaxosAcceptorPersistence.PaxosProposal persisted;
    PaxosProposal actual;
    expected = new PaxosProposal(new PaxosProposalId(55, "nonce"), new PaxosValue("red leader", 93, null));
    persisted = expected.persistToProto();
    actual = PaxosProposal.hydrateFromProto(persisted);
    assertEquals(expected, actual);
    expected = new PaxosProposal(new PaxosProposalId(0, "noice"), new PaxosValue("", 93, new byte[] {}));
    persisted = expected.persistToProto();
    actual = PaxosProposal.hydrateFromProto(persisted);
    assertEquals(expected, actual);
}
Also used : PaxosProposal(com.palantir.paxos.PaxosProposal) PaxosProposalId(com.palantir.paxos.PaxosProposalId) PaxosAcceptorPersistence(com.palantir.paxos.persistence.generated.remoting.PaxosAcceptorPersistence) PaxosValue(com.palantir.paxos.PaxosValue) Test(org.junit.Test)

Aggregations

PaxosProposal (com.palantir.paxos.PaxosProposal)2 PaxosProposalId (com.palantir.paxos.PaxosProposalId)2 PaxosValue (com.palantir.paxos.PaxosValue)2 Test (org.junit.Test)2 PaxosAcceptor (com.palantir.paxos.PaxosAcceptor)1 PaxosAcceptorPersistence (com.palantir.paxos.persistence.generated.remoting.PaxosAcceptorPersistence)1