Ejemplo n.º 1
0
 @Override
 public List<ParticipantId> getParticipants() {
   acquireReadLock();
   try {
     return (waveletData != null ? waveletData.getParticipants() : null);
   } finally {
     releaseReadLock();
   }
 }
Ejemplo n.º 2
0
 public void testBuildWaveletFromOneDelta() throws Exception {
   WaveletData wavelet = build(delta(addParticipant(CREATOR, 1093L, HashedVersion.unsigned(1))));
   assertEquals(WAVELET_NAME, WaveletDataUtil.waveletNameOf(wavelet));
   assertEquals(CREATOR, wavelet.getCreator());
   assertEquals(1093L, wavelet.getCreationTime());
   assertEquals(1093L, wavelet.getLastModifiedTime());
   assertEquals(HashedVersion.unsigned(1), wavelet.getHashedVersion());
   assertEquals(ImmutableSet.of(), wavelet.getDocumentIds());
   assertEquals(ImmutableSet.of(CREATOR), wavelet.getParticipants());
 }
 /**
  * @return The position of the removed participant in the wavelet participant list.
  * @throws OperationException if the removed participant is not in the participant list.
  */
 private int participantPosition(WaveletData target) throws OperationException {
   int position = 0;
   for (ParticipantId next : target.getParticipants()) {
     if (participant.equals(next)) {
       return position;
     }
     position++;
   }
   throw new OperationException("Attempt to remove non-existent participant " + participant);
 }
Ejemplo n.º 4
0
 @Override
 public boolean checkAccessPermission(ParticipantId participantId) throws WaveletStateException {
   acquireReadLock();
   try {
     assertStateOk();
     return waveletData.getParticipants().contains(participantId);
   } finally {
     releaseReadLock();
   }
 }
Ejemplo n.º 5
0
 public void testBuildWaveletFromThreeDeltas() throws Exception {
   WaveletData wavelet =
       build(
           delta(addParticipant(CREATOR, 1093L, HashedVersion.unsigned(1))),
           delta(addParticipant(JOE, 1492L, HashedVersion.unsigned(2))),
           delta(addBlip("blipid", 2010L, HashedVersion.unsigned(3))));
   assertEquals(WAVELET_NAME, WaveletDataUtil.waveletNameOf(wavelet));
   assertEquals(CREATOR, wavelet.getCreator());
   assertEquals(1093L, wavelet.getCreationTime());
   assertEquals(2010L, wavelet.getLastModifiedTime());
   assertEquals(HashedVersion.unsigned(3), wavelet.getHashedVersion());
   assertEquals(ImmutableSet.of("blipid"), wavelet.getDocumentIds());
   assertEquals(ImmutableSet.of(CREATOR, JOE), wavelet.getParticipants());
 }