assertEquals(WAVELET_NAME, core.getWaveletName());
assertEquals(CONTENTS.length, core.getDocuments().size());
assertOpEquals(CONTENTS[0], core.getDocuments().get("b+0"));
assertEquals(CollectionUtils.newArrayList(BOB, JOE), core.getParticipants());
ObservableWaveletData obs =
DataUtil.fromCoreWaveletData(core, VERSION, SchemaCollection.empty());
assertEquals(BOB, obs.getCreator());
assertEquals(0L, obs.getCreationTime());
assertEquals(0L, obs.getLastModifiedTime());
assertEquals(VERSION, obs.getHashedVersion());
assertEquals(VERSION.getVersion(), obs.getVersion());
assertEquals(WAVELET_NAME.waveId, obs.getWaveId());
assertEquals(WAVELET_NAME.waveletId, obs.getWaveletId());
assertEquals(CollectionUtils.immutableSet(BOB, JOE), obs.getParticipants());
assertEquals(docs.keySet(), obs.getDocumentIds());
for (Map.Entry<String, DocOp> d : docs.entrySet()) {
BlipData blip = obs.getDocument(d.getKey());
WaveletData wavelet = blip.getWavelet();
assertEquals(WAVELET_NAME.waveId, wavelet.getWaveId());
assertEquals(WAVELET_NAME.waveletId, wavelet.getWaveletId());
assertEquals(d.getKey(), blip.getId());
assertNotNull(blip.getAuthor());
assertEquals(0L, blip.getLastModifiedTime());
assertEquals(-1, blip.getLastModifiedVersion());
assertTrue(blip.getContributors().isEmpty());
assertOpEquals(d.getValue(), blip.getContent().asOperation());
try {
blip.addContributor(JOE);
fail("blips from DataUtil.fromCoreWaveletData() are immutable");
} catch (UnsupportedOperationException expected) {
}
}
try {
obs.addParticipant(LIZ);
fail("wavelets from DataUtil.fromCoreWaveletData() are immutable");
} catch (UnsupportedOperationException expected) {
}
// test that changes to core are reflected in data
core.addParticipant(LIZ);
assertEquals(CollectionUtils.newArrayList(BOB, JOE, LIZ), core.getParticipants());
assertEquals(CollectionUtils.immutableSet(BOB, JOE, LIZ), obs.getParticipants());
}