assertFalse(localWavelet.isDeltaSigner(
localWavelet.getCurrentVersion(), fakeSigner1));
}
public void testFailedLocalWaveletRequest() throws Exception {
ProtocolSignedDelta removeDelta = ProtocolSignedDelta.newBuilder()
.addSignature(fakeSignature1)
.setDelta(removeParticipantProtoDelta(localWavelet).toByteString())
.build();
try {
localWavelet.submitRequest(localWaveletName, removeDelta);
fail("Should fail");
} catch (OperationException e) {
// Correct
}
assertEquals(localWavelet.getCurrentVersion(), localVersion0);
ProtocolSignedDelta addDelta = ProtocolSignedDelta.newBuilder()
.addSignature(fakeSignature1)
.setDelta(addParticipantProtoDelta(localWavelet).toByteString())
.build();
localWavelet.submitRequest(localWaveletName, addDelta);
try {
ProtocolSignedDelta addAgainDelta = ProtocolSignedDelta.newBuilder()
.addSignature(fakeSignature2)
.setDelta(ProtocolWaveletDelta.newBuilder(addParticipantProtoDelta(localWavelet))
.setHashedVersion(serialize(localWavelet.getCurrentVersion()))
.build().toByteString())
.build();
localWavelet.submitRequest(localWaveletName, addAgainDelta);
fail("Should fail");
} catch (OperationException e) {
// Correct
}
assertEquals(localWavelet.getCurrentVersion().getVersion(), 2);
assertTrue(localWavelet.isDeltaSigner(
localWavelet.getCurrentVersion(), fakeSigner1));
assertFalse(localWavelet.isDeltaSigner(
localWavelet.getCurrentVersion(), fakeSigner2));
HashedVersion oldVersion = localWavelet.getCurrentVersion();
ProtocolSignedDelta rollbackDelta = ProtocolSignedDelta.newBuilder()
.addSignature(fakeSignature1)
.setDelta(ProtocolWaveletDelta.newBuilder(doubleRemoveParticipantProtoDelta(localWavelet))
.setHashedVersion(serialize(localWavelet.getCurrentVersion()))
.build().toByteString())
.build();