use of com.palantir.paxos.PaxosProposalId 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);
}
use of com.palantir.paxos.PaxosProposalId in project atlasdb by palantir.
the class ProtobufTest method testPaxosProposalIdPersistence.
@Test
public void testPaxosProposalIdPersistence() throws Exception {
PaxosProposalId expected;
PaxosPersistence.PaxosProposalId persisted;
PaxosProposalId actual;
expected = new PaxosProposalId(10, "string");
persisted = expected.persistToProto();
actual = PaxosProposalId.hydrateFromProto(persisted);
assertEquals(expected, actual);
expected = new PaxosProposalId(10, "");
persisted = expected.persistToProto();
actual = PaxosProposalId.hydrateFromProto(persisted);
assertEquals(expected, actual);
}
use of com.palantir.paxos.PaxosProposalId 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);
}
use of com.palantir.paxos.PaxosProposalId 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);
}
Aggregations