public void testWaveletRoundtrip() throws Exception { WaveletData expected = TestDataUtil.createSimpleWaveletData(); WaveletName name = WaveletName.of(expected.getWaveId(), expected.getWaveletId()); HashedVersion version = HASH_FACTORY.createVersionZero(name); WaveletSnapshot snapshot = SnapshotSerializer.serializeWavelet(expected, version); WaveletData actual = SnapshotSerializer.deserializeWavelet(snapshot, expected.getWaveId()); TestDataUtil.checkSerializedWavelet(expected, actual); } }
public WaveletProviderStub() { wavelet = TestDataUtil.createSimpleWaveletData(); setCommittedVersion(HashedVersion.unsigned(0)); }
/** * Round-trip a wavelet and make sure all the fields match. * We only check the fields that WaveletSnapshot serializes. * @throws Exception */ public void testGetWavelet() throws Exception { WaveletData wavelet = waveletProvider.getHostedWavelet(); WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId()); WaveletSnapshot snapshot = fetchWaverRefAndParse(waveref, WaveletSnapshot.class); WaveletData roundtripped = SnapshotSerializer.deserializeWavelet(snapshot, waveref.getWaveId()); // We have just round-tripped wavelet through the servlet. wavelet and // roundtripped should be identical in all the fields that get serialized. TestDataUtil.checkSerializedWavelet(wavelet, roundtripped); // TODO(josephg): Enable this test when the persistence store is in place. // assertEquals(snapshot.getVersion(), waveletProvider.getCommittedVersion()); }
/** * Check that the serialized fields of two wavelets are equal. */ public static void checkSerializedWavelet(WaveletData expected, WaveletData actual) { assertNotNull(expected); assertNotNull(actual); assertEquals(expected.getWaveId(), actual.getWaveId()); assertEquals(expected.getParticipants(), actual.getParticipants()); assertEquals(expected.getVersion(), actual.getVersion()); assertEquals(expected.getLastModifiedTime(), actual.getLastModifiedTime()); assertEquals(expected.getCreator(), actual.getCreator()); assertEquals(expected.getCreationTime(), actual.getCreationTime()); // & check that the documents the wavelets contain are also the same. assertEquals(expected.getDocumentIds(), actual.getDocumentIds()); for (String docId : expected.getDocumentIds()) { checkSerializedDocument(expected.getDocument(docId), actual.getDocument(docId)); } } }
public WaveletProviderStub() { wavelet = TestDataUtil.createSimpleWaveletData(); setCommittedVersion(HashedVersion.unsigned(0)); }
/** * Round-trip a wavelet and make sure all the fields match. * We only check the fields that WaveletSnapshot serializes. * @throws Exception */ public void testGetWavelet() throws Exception { WaveletData wavelet = waveletProvider.getHostedWavelet(); WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId()); WaveletSnapshot snapshot = fetchWaverRefAndParse(waveref, WaveletSnapshot.class); WaveletData roundtripped = SnapshotSerializer.deserializeWavelet(snapshot, waveref.getWaveId()); // We have just round-tripped wavelet through the servlet. wavelet and // roundtripped should be identical in all the fields that get serialized. TestDataUtil.checkSerializedWavelet(wavelet, roundtripped); // TODO(josephg): Enable this test when the persistence store is in place. // assertEquals(snapshot.getVersion(), waveletProvider.getCommittedVersion()); }
/** * Check that the serialized fields of two wavelets are equal. */ public static void checkSerializedWavelet(WaveletData expected, WaveletData actual) { assertNotNull(expected); assertNotNull(actual); assertEquals(expected.getWaveId(), actual.getWaveId()); assertEquals(expected.getParticipants(), actual.getParticipants()); assertEquals(expected.getVersion(), actual.getVersion()); assertEquals(expected.getLastModifiedTime(), actual.getLastModifiedTime()); assertEquals(expected.getCreator(), actual.getCreator()); assertEquals(expected.getCreationTime(), actual.getCreationTime()); // & check that the documents the wavelets contain are also the same. assertEquals(expected.getDocumentIds(), actual.getDocumentIds()); for (String docId : expected.getDocumentIds()) { checkSerializedDocument(expected.getDocument(docId), actual.getDocument(docId)); } } }
public void testWaveletRoundtrip() throws Exception { WaveletData expected = TestDataUtil.createSimpleWaveletData(); WaveletName name = WaveletName.of(expected.getWaveId(), expected.getWaveletId()); HashedVersion version = HASH_FACTORY.createVersionZero(name); WaveletSnapshot snapshot = SnapshotSerializer.serializeWavelet(expected, version); WaveletData actual = SnapshotSerializer.deserializeWavelet(snapshot, expected.getWaveId()); TestDataUtil.checkSerializedWavelet(expected, actual); } }