/** * @see #blindWavelet(WaveId, WaveletId, String, Map) * * @param threads a collection of threads that belong to this wavelet. */ public Wavelet blindWavelet(WaveId waveId, WaveletId waveletId, String proxyForId, Map<String, Blip> blips, Map<String, BlipThread> threads) { Util.checkIsValidProxyForId(proxyForId); Map<String, String> roles = new HashMap<String, String>(); return new Wavelet(waveId, waveletId, null, new BlipThread("", -1, new ArrayList<String>(), blips), Collections.<String>emptySet(), roles, blips, threads, new OperationQueue(proxyForId)); }
public void testSubmitWith() throws Exception { OperationQueue otherOpQueue = mock(OperationQueue.class); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); Wavelet other = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, new HashMap<String, String>(), Collections.<String>emptySet(), new HashMap<String, Blip>(), threads, otherOpQueue); wavelet.submitWith(other); verify(opQueue).submitWith(otherOpQueue); }
@Override protected void setUp() throws Exception { super.setUp(); rootBlip = mock(Blip.class); Map<String, String> dataDocument = new HashMap<String, String>(); Set<String> tags = Collections.emptySet(); Map<String, Blip> blips = new HashMap<String, Blip>(); blips.put("blip1", rootBlip); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); opQueue = mock(OperationQueue.class); wavelet = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, dataDocument, tags, blips, threads, opQueue); }
@Override protected void setUp() throws Exception { super.setUp(); rootBlip = mock(Blip.class); Map<String, String> dataDocument = new HashMap<String, String>(); Set<String> tags = Collections.emptySet(); Map<String, Blip> blips = new HashMap<String, Blip>(); blips.put("blip1", rootBlip); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); opQueue = mock(OperationQueue.class); wavelet = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, dataDocument, tags, blips, threads, opQueue); }
public void testSubmitWith() throws Exception { OperationQueue otherOpQueue = mock(OperationQueue.class); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); Wavelet other = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, new HashMap<String, String>(), Collections.<String>emptySet(), new HashMap<String, Blip>(), threads, otherOpQueue); wavelet.submitWith(other); verify(opQueue).submitWith(otherOpQueue); }
BlipThread rootThread = new BlipThread("", -1, blipIds, blips); Wavelet wavelet = new Wavelet(waveId, waveletId, rootBlipId, rootThread, participants, roles, blips, threads, opQueue);
/** * Returns a view of this wavelet that will proxy for the specified id. * * A shallow copy of the current wavelet is returned with the * {@code proxyingFor} field set. Any modifications made to this copy will be * done using the {@code proxyForId}, i.e. the * {@code robot+<proxyForId>@appspot.com} address will be used. * * If the wavelet was retrieved using the Active Robot API, that is * by {@code fetchWavelet}, then the address of the robot must be added to the * wavelet by calling {@code setRobotAddress} with the robot's address * before calling {@code proxy_for}. * * @param proxyForId the id to proxy. Please note that this parameter should * be properly encoded to ensure that the resulting participant id is * valid (see {@link Util#checkIsValidProxyForId(String)} for more * details). * @return a shallow copy of this wavelet with the proxying information set. */ public Wavelet proxyFor(String proxyForId) { Util.checkIsValidProxyForId(proxyForId); addProxyingParticipant(proxyForId); OperationQueue proxiedOperationQueue = operationQueue.proxyFor(proxyForId); return new Wavelet(this, proxiedOperationQueue); }
BlipThread rootThread = new BlipThread("", -1, blipIds, blips); newWavelet = new Wavelet(waveId, waveletId, rootBlipId, rootThread, participants, roles, blips, threads, opQueue); blips.put(rootBlipId, new Blip(rootBlipId, "", null, "", newWavelet));
public void testDeleteByBlip() throws Exception { Blip parentBlip = mock(Blip.class); when(parentBlip.getBlipId()).thenReturn("parentblipid"); Blip childBlip = mock(Blip.class); when(childBlip.getBlipId()).thenReturn("childblipid"); when(childBlip.getParentBlip()).thenReturn(parentBlip); Map<String, Blip> blips = new HashMap<String, Blip>(); blips.put("parentblipid", parentBlip); blips.put("childblipid", childBlip); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); wavelet = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "parentblipid", null, roles, participants, new HashMap<String, String>(), new LinkedHashSet<String>(), blips, threads, opQueue); assertEquals(2, wavelet.getBlips().size()); wavelet.delete(childBlip); assertEquals(1, wavelet.getBlips().size()); verify(parentBlip).deleteChildBlipId("childblipid"); verify(opQueue).deleteBlip(wavelet, "childblipid"); }
public void testDeleteByBlip() throws Exception { Blip parentBlip = mock(Blip.class); when(parentBlip.getBlipId()).thenReturn("parentblipid"); Blip childBlip = mock(Blip.class); when(childBlip.getBlipId()).thenReturn("childblipid"); when(childBlip.getParentBlip()).thenReturn(parentBlip); Map<String, Blip> blips = new HashMap<String, Blip>(); blips.put("parentblipid", parentBlip); blips.put("childblipid", childBlip); Set<String> participants = new LinkedHashSet<String>(); participants.add("foo@bar.com"); Map<String, String> roles = new HashMap<String, String>(); Map<String, BlipThread> threads = new HashMap<String, BlipThread>(); wavelet = new Wavelet(WAVE_ID, WAVELET_ID, "foo@bar.com", 1l, 1l, "Hello world", "parentblipid", null, roles, participants, new HashMap<String, String>(), new LinkedHashSet<String>(), blips, threads, opQueue); assertEquals(2, wavelet.getBlips().size()); wavelet.delete(childBlip); assertEquals(1, wavelet.getBlips().size()); verify(parentBlip).deleteChildBlipId("childblipid"); verify(opQueue).deleteBlip(wavelet, "childblipid"); }
Map<String, String> roles = waveletData.getParticipantRoles(); return new Wavelet(waveId, waveletId, creator, creationTime, lastModifiedTime, title, rootBlipId, rootThread, roles, participants, dataDocuments, tags, blips, threads, operationQueue);
Wavelet expectedWavelet = new Wavelet(WaveId.of("example.com", "wave1"), WaveletId.of("example.com", "wavelet1"), "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, dataDocument, tags, blips, threads, opQueue);
Wavelet expectedWavelet = new Wavelet(WaveId.of("example.com", "wave1"), WaveletId.of("example.com", "wavelet1"), "foo@bar.com", 1l, 1l, "Hello world", "blip1", null, roles, participants, dataDocument, tags, blips, threads, opQueue);