Package org.waveprotocol.box.server.waveserver

Examples of org.waveprotocol.box.server.waveserver.DeltaStore.open()



    long toRemove = 1;
    while (true) {
      // This generates the full file.
      DeltasAccess wavelet = store.open(WAVE1_WAVELET1);
      wavelet.append(ImmutableList.of(written));
      wavelet.close();

      RandomAccessFile file = new RandomAccessFile(deltaFile, "rw");
      if (toRemove > file.length()) {
View Full Code Here


      // eat the planned number of bytes
      LOG.info("trying to remove " + toRemove + " bytes");
      file.setLength(file.length() - toRemove);
      file.close();

      wavelet = store.open(WAVE1_WAVELET1);
      WaveletDeltaRecord read = wavelet.getDelta(0);
      assertNull("got an unexpected record " + read, read);
      wavelet.close();
      toRemove++;
    }
View Full Code Here

  /** Create and return a new delta store instance of the type being tested. */
  protected abstract DeltaStore newDeltaStore() throws Exception;

  public void testOpenNonexistantWavelet() throws Exception {
    DeltaStore store = newDeltaStore();
    DeltasAccess wavelet = store.open(WAVE1_WAVELET1);

    // Sanity check a bunch of values in the wavelet.
    assertTrue(wavelet.isEmpty());
    assertEquals(WAVE1_WAVELET1, wavelet.getWaveletName());
    assertNull(wavelet.getEndVersion());
View Full Code Here

  public void testWriteToNewWavelet() throws Exception {
    Pair<DeltaStore,WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1);
    DeltaStore store = pair.first;
    WaveletDeltaRecord record = pair.second;

    DeltasAccess wavelet = store.open(WAVE1_WAVELET1);

    assertFalse(wavelet.isEmpty());
    assertEquals(WAVE1_WAVELET1, wavelet.getWaveletName());
    assertEquals(record.getResultingVersion(), wavelet.getEndVersion());
    assertEquals(record, wavelet.getDelta(0));
View Full Code Here

  public void testDeleteWaveletRemovesDeltas() throws Exception {
    Pair<DeltaStore, WaveletDeltaRecord> pair = newDeltaStoreWithRecord(WAVE1_WAVELET1);
    DeltaStore store = pair.first;

    store.delete(WAVE1_WAVELET1);
    DeltasAccess wavelet = store.open(WAVE1_WAVELET1);
    assertTrue(wavelet.isEmpty());
    wavelet.close();
  }

  public void testLookupReturnsWavelets() throws Exception {
View Full Code Here

    assertEquals(ImmutableSet.of(WAVE1_WAVELET1.waveletId), store.lookup(WAVE1_WAVELET1.waveId));
  }

  public void testLookupDoesNotReturnEmptyWavelets() throws Exception {
    DeltaStore store = newDeltaStore();
    DeltasAccess wavelet = store.open(WAVE1_WAVELET1);
    wavelet.close();

    assertTrue(store.lookup(WAVE1_WAVELET1.waveId).isEmpty());
  }
View Full Code Here

    assertEquals(ImmutableSet.of(WAVE1_WAVELET1.waveId), waveIds);
  }

  public void testWaveIdIteratorDoesNotReturnEmptyWavelets() throws Exception {
    DeltaStore store = newDeltaStore();
    DeltasAccess wavelet = store.open(WAVE1_WAVELET1);
    wavelet.close();

    assertFalse(store.getWaveIdIterator().hasNext());
  }
View Full Code Here

  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();
View Full Code Here

  }

  private Pair<DeltaStore, WaveletDeltaRecord> newDeltaStoreWithRecord(WaveletName waveletName)
      throws Exception {
    DeltaStore store = newDeltaStore();
    DeltasAccess wavelet = store.open(waveletName);

    WaveletDeltaRecord record = createRecord();
    wavelet.append(ImmutableList.of(record));
    wavelet.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.