@Override public void setUp() throws Exception { super.setUp(); WaveletNotificationSubscriber notifiee = mock(WaveletNotificationSubscriber.class); DeltaStore deltaStore = new MemoryDeltaStore(); AccessController localAccessController = mock(AccessController.class); AccessController remoteAccessController = mock(AccessController.class); WaveletState localWaveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(localWaveletName), PERSIST_EXECUTOR); localWavelet = new LocalWaveletContainerImpl(localWaveletName, notifiee, Futures.immediateFuture(localWaveletState), localDomain, STORAGE_CONTINUATION_EXECUTOR, localAccessController); localWavelet.awaitLoad(); WaveletState remoteWaveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(remoteWaveletName), PERSIST_EXECUTOR); remoteWavelet = new RemoteWaveletContainerImpl(remoteWaveletName, notifiee, Futures.immediateFuture(remoteWaveletState), STORAGE_CONTINUATION_EXECUTOR, remoteAccessController); remoteWavelet.awaitLoad(); }
@Override public void setUp() throws Exception { super.setUp(); WaveletNotificationSubscriber notifiee = mock(WaveletNotificationSubscriber.class); DeltaStore deltaStore = new MemoryDeltaStore(); WaveletState localWaveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(localWaveletName), PERSIST_EXECUTOR); localWavelet = new LocalWaveletContainerImpl(localWaveletName, notifiee, Futures.immediateFuture(localWaveletState), localDomain, STORAGE_CONTINUATION_EXECUTOR); localWavelet.awaitLoad(); WaveletState remoteWaveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(remoteWaveletName), PERSIST_EXECUTOR); remoteWavelet = new RemoteWaveletContainerImpl(remoteWaveletName, notifiee, Futures.immediateFuture(remoteWaveletState), STORAGE_CONTINUATION_EXECUTOR); remoteWavelet.awaitLoad(); }
@Override public WaveletDeltaRecord submitRequest(WaveletName waveletName, ProtocolSignedDelta signedDelta) throws OperationException, InvalidProtocolBufferException, InvalidHashException, PersistenceException, WaveletStateException { awaitLoad(); acquireWriteLock(); try { checkStateOk(); HashedVersion before = getCurrentVersion(); WaveletDeltaRecord result = transformAndApplyLocalDelta(signedDelta); HashedVersion after = getCurrentVersion(); // Only publish and persist the delta if it wasn't transformed away // (right now it never is since the current OT algorithm doesn't transform ops away) // and wasn't a duplicate of a previously applied delta. if (!after.equals(before)) { Preconditions.checkState(!result.isEmpty()); Preconditions.checkState(result.getAppliedAtVersion().equals(before)); ImmutableSet<String> domainsToNotify = domainsOf(Iterables.concat( accessSnapshot().getParticipants(), participantsRemovedBy(result.getTransformedDelta()))); notifyOfDeltas(ImmutableList.of(result), domainsToNotify); // We always persist a local delta immediately after it's applied // and after it's broadcast on the wave bus and to remote servers. persist(result.getResultingVersion(), domainsToNotify); } return result; } finally { releaseWriteLock(); } }
@Override protected void setUp() throws Exception { super.setUp(); addParticipantOp = ProtocolWaveletOperation.newBuilder() .setAddParticipant(AUTHOR) .build(); // An empty blip operation - creates a new document. addBlipOp = ProtocolWaveletOperation.newBuilder().setMutateDocument( MutateDocument.newBuilder().setDocumentId(BLIP_ID).setDocumentOperation( ProtocolDocumentOperation.newBuilder().build())).build(); WaveletNotificationSubscriber notifiee = mock(WaveletNotificationSubscriber.class); DeltaStore deltaStore = new MemoryDeltaStore(); WaveletState waveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(WAVELET_NAME), PERSIST_EXECUTOR); AccessController accessController = mock(AccessController.class); wavelet = new LocalWaveletContainerImpl(WAVELET_NAME, notifiee, Futures.immediateFuture(waveletState), null, STORAGE_CONTINUATION_EXECUTOR, accessController); wavelet.awaitLoad(); }
@Override protected void setUp() throws Exception { super.setUp(); addParticipantOp = ProtocolWaveletOperation.newBuilder() .setAddParticipant(AUTHOR) .build(); // An empty blip operation - creates a new document. addBlipOp = ProtocolWaveletOperation.newBuilder().setMutateDocument( MutateDocument.newBuilder().setDocumentId(BLIP_ID).setDocumentOperation( ProtocolDocumentOperation.newBuilder().build())).build(); WaveletNotificationSubscriber notifiee = mock(WaveletNotificationSubscriber.class); DeltaStore deltaStore = new MemoryDeltaStore(); WaveletState waveletState = DeltaStoreBasedWaveletState.create(deltaStore.open(WAVELET_NAME), PERSIST_EXECUTOR); wavelet = new LocalWaveletContainerImpl(WAVELET_NAME, notifiee, Futures.immediateFuture(waveletState), null, STORAGE_CONTINUATION_EXECUTOR); wavelet.awaitLoad(); }