/** * Check that a container succeeds when adding non-existent participants and removing existing * participants. */ private void assertSuccessfulApplyWaveletOperations(WaveletContainerImpl with) throws Exception { WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); assertEquals(with.accessSnapshot().getParticipants(), participants); WaveServerTestUtil.applyDeltaToWavelet(with, removeParticipantDelta(with), 0L); assertEquals(with.accessSnapshot().getParticipants(), Collections.emptySet()); }
/** * Check that a container succeeds when adding non-existent participants and removing existing * participants. */ private void assertSuccessfulApplyWaveletOperations(WaveletContainerImpl with) throws Exception { WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); assertEquals(with.accessSnapshot().getParticipants(), participants); WaveServerTestUtil.applyDeltaToWavelet(with, removeParticipantDelta(with), 0L); assertEquals(with.accessSnapshot().getParticipants(), Collections.emptySet()); }
public void testOperationsOfDifferentSizes() throws Exception { String docId = "b+somedoc"; DocOp docOp1 = new DocOpBuilder().characters("hi").build(); WaveletDelta delta1 = createDelta(docId, docOp1, localVersion0); WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta1, 0L); try { DocOp docOp2 = new DocOpBuilder().characters("bye").build(); WaveletDelta delta2 = createDelta(docId, docOp2, localWavelet.getCurrentVersion()); WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta2, 0L); fail("Composition of \"hi\" and \"bye\" did not throw OperationException"); } catch (OperationException expected) { // Correct } }
/** * Check that a container fails when removing non-existent participants and adding duplicate * participants, and that the partipant list is preserved correctly. */ private void assertFailedWaveletOperations(WaveletContainerImpl with) throws Exception { try { WaveServerTestUtil.applyDeltaToWavelet(with, removeParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertNull(localWavelet.accessSnapshot()); WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); try { WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertEquals(with.accessSnapshot().getParticipants(), participants); try { WaveServerTestUtil.applyDeltaToWavelet(with, doubleRemoveParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertEquals(with.accessSnapshot().getParticipants(), participants); }
public void testOperationsOfDifferentSizes() throws Exception { String docId = "b+somedoc"; DocOp docOp1 = new DocOpBuilder().characters("hi").build(); WaveletDelta delta1 = createDelta(docId, docOp1, localVersion0); WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta1, 0L); try { DocOp docOp2 = new DocOpBuilder().characters("bye").build(); WaveletDelta delta2 = createDelta(docId, docOp2, localWavelet.getCurrentVersion()); WaveServerTestUtil.applyDeltaToWavelet(localWavelet, delta2, 0L); fail("Composition of \"hi\" and \"bye\" did not throw OperationException"); } catch (OperationException expected) { // Correct } }
/** * Check that a container fails when removing non-existent participants and adding duplicate * participants, and that the partipant list is preserved correctly. */ private void assertFailedWaveletOperations(WaveletContainerImpl with) throws Exception { try { WaveServerTestUtil.applyDeltaToWavelet(with, removeParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertNull(localWavelet.accessSnapshot()); WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); try { WaveServerTestUtil.applyDeltaToWavelet(with, addParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertEquals(with.accessSnapshot().getParticipants(), participants); try { WaveServerTestUtil.applyDeltaToWavelet(with, doubleRemoveParticipantDelta(with), 0L); fail("Should fail"); } catch (OperationException e) { // Correct } assertEquals(with.accessSnapshot().getParticipants(), participants); }