@Override public ExceptionalIterator<WaveId, PersistenceException> getWaveIdIterator() throws PersistenceException { return deltaStore.getWaveIdIterator(); } }
public void testWaveIdIteratorReturnsWaveIds() throws Exception { Pair<DeltaStore,WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; ImmutableSet<WaveId> waveIds = setFromExceptionalIterator(store.getWaveIdIterator()); assertEquals(ImmutableSet.of(WAVE1_WAVELET1.waveId), waveIds); }
public void testWaveIdIteratorReturnsWaveIds() throws Exception { Pair<DeltaStore,WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; ImmutableSet<WaveId> waveIds = setFromExceptionalIterator(store.getWaveIdIterator()); assertEquals(ImmutableSet.of(WAVE1_WAVELET1.waveId), waveIds); }
ExceptionalIterator<WaveId, PersistenceException> srcItr = sourceStore.getWaveIdIterator();
public void testWaveIdIteratorDoesNotReturnDeletedWavelets() throws Exception { Pair<DeltaStore, WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; store.delete(WAVE1_WAVELET1); assertFalse(store.getWaveIdIterator().hasNext()); }
public void testWaveIdIteratorDoesNotReturnDeletedWavelets() throws Exception { Pair<DeltaStore, WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; store.delete(WAVE1_WAVELET1); assertFalse(store.getWaveIdIterator().hasNext()); }
public void testWaveIdIteratorDoesNotReturnEmptyWavelets() throws Exception { DeltaStore store = newDeltaStore(); DeltasAccess wavelet = store.open(WAVE1_WAVELET1); wavelet.close(); assertFalse(store.getWaveIdIterator().hasNext()); }
public void testWaveIdIteratorDoesNotReturnEmptyWavelets() throws Exception { DeltaStore store = newDeltaStore(); DeltasAccess wavelet = store.open(WAVE1_WAVELET1); wavelet.close(); assertFalse(store.getWaveIdIterator().hasNext()); }
public void testWaveIdIteratorLimits() throws Exception { Pair<DeltaStore,WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; DeltasAccess wavelet = store.open(WAVE2_WAVELET1); WaveletDeltaRecord record = createRecord(); wavelet.append(ImmutableList.of(record)); wavelet.close(); ExceptionalIterator<WaveId, PersistenceException> iterator = store.getWaveIdIterator(); assertTrue(iterator.hasNext()); WaveId waveId1 = iterator.next(); assertTrue(iterator.hasNext()); WaveId waveId2 = iterator.next(); // This is necessary because the order of waveIds is implementation specific. if (WAVE1_WAVELET1.waveId.equals(waveId1)) { assertEquals(WAVE2_WAVELET1.waveId, waveId2); } else { assertEquals(WAVE2_WAVELET1.waveId, waveId1); assertEquals(WAVE1_WAVELET1.waveId, waveId2); } assertFalse(iterator.hasNext()); try { waveId1 = iterator.next(); // Fail the test, it should have thrown an exception. fail(); } catch (NoSuchElementException e) { // Test passes. } }
public void testWaveIdIteratorLimits() throws Exception { Pair<DeltaStore,WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1); DeltaStore store = pair.first; DeltasAccess wavelet = store.open(WAVE2_WAVELET1); WaveletDeltaRecord record = createRecord(); wavelet.append(ImmutableList.of(record)); wavelet.close(); ExceptionalIterator<WaveId, PersistenceException> iterator = store.getWaveIdIterator(); assertTrue(iterator.hasNext()); WaveId waveId1 = iterator.next(); assertTrue(iterator.hasNext()); WaveId waveId2 = iterator.next(); // This is necessary because the order of waveIds is implementation specific. if (WAVE1_WAVELET1.waveId.equals(waveId1)) { assertEquals(WAVE2_WAVELET1.waveId, waveId2); } else { assertEquals(WAVE2_WAVELET1.waveId, waveId1); assertEquals(WAVE1_WAVELET1.waveId, waveId2); } assertFalse(iterator.hasNext()); try { waveId1 = iterator.next(); // Fail the test, it should have thrown an exception. fail(); } catch (NoSuchElementException e) { // Test passes. } }