/** * Creates a new {@link Robot}. * * @param robotName the name of the robot. * @param account the {@link RobotAccountData} belonging to the given * {@link RobotName}. */ private Robot createNewRobot(RobotName robotName, RobotAccountData account) { EventGenerator eventGenerator = new EventGenerator(robotName, conversationUtil); RobotOperationApplicator operationApplicator = new RobotOperationApplicator(converterManager, waveletProvider, new OperationServiceRegistryImpl(notifyOpService), conversationUtil); return new Robot(robotName, account, this, connector, converterManager, waveletProvider, eventGenerator, operationApplicator); }
@Override protected void setUp() throws Exception { conversationUtil = new ConversationUtil(FakeIdGenerator.create()); eventGenerator = new EventGenerator(ROBOT_NAME, conversationUtil); waveletData = WaveletDataImpl.Factory.create(DOCUMENT_FACTORY).create( new EmptyWaveletSnapshot(WAVELET_NAME.waveId, WAVELET_NAME.waveletId, ALEX, HASH_FACTORY.createVersionZero(WAVELET_NAME), 0L)); // Robot should be participant in snapshot before deltas // otherwise events will be filtered out. waveletData.addParticipant(ROBOT); waveletData.addParticipant(ALEX); waveletData.setVersion(1); SilentOperationSink<WaveletOperation> executor = SilentOperationSink.Executor.<WaveletOperation, WaveletData> build(waveletData); output = new CapturingOperationSink<WaveletOperation>(); wavelet = new OpBasedWavelet(waveletData.getWaveId(), waveletData, CONTEXT_FACTORY, ParticipationHelper.DEFAULT, executor, output); // Make a conversation and clear the sink WaveletBasedConversation.makeWaveletConversational(wavelet); conversationUtil.buildConversation(wavelet).getRoot().getRootThread().appendBlip(); output.clear(); }
@Override protected void setUp() throws Exception { conversationUtil = new ConversationUtil(FakeIdGenerator.create()); eventGenerator = new EventGenerator(ROBOT_NAME, conversationUtil); waveletData = WaveletDataImpl.Factory.create(DOCUMENT_FACTORY).create( new EmptyWaveletSnapshot(WAVELET_NAME.waveId, WAVELET_NAME.waveletId, ALEX, HASH_FACTORY.createVersionZero(WAVELET_NAME), 0L)); // Robot should be participant in snapshot before deltas // otherwise events will be filtered out. waveletData.addParticipant(ROBOT); waveletData.addParticipant(ALEX); waveletData.setVersion(1); SilentOperationSink<WaveletOperation> executor = SilentOperationSink.Executor.<WaveletOperation, WaveletData> build(waveletData); output = new CapturingOperationSink<WaveletOperation>(); wavelet = new OpBasedWavelet(waveletData.getWaveId(), waveletData, CONTEXT_FACTORY, ParticipationHelper.DEFAULT, executor, output); // Make a conversation and clear the sink WaveletBasedConversation.makeWaveletConversational(wavelet); conversationUtil.buildConversation(wavelet).getRoot().getRootThread().appendBlip(); output.clear(); }