public static ParticipantServices create() { return new ParticipantServices(); } }
@Override protected void setUp() { service = ParticipantServices.create(); helper = new OperationServiceHelper(WAVELET_NAME, ROBOT); // BlipData constructor is broken, it doesn't set the blipId passed in the // constructor blipData = new BlipData(s(WAVE_ID), s(WAVELET_ID), TEMP_BLIP_ID, NEW_BLIP_CONTENT); blipData.setBlipId(TEMP_BLIP_ID); }
public void testInvalidParticipantAddress() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, MALFORMED_ADDRESS)); try { service.execute(operation, context, ROBOT); fail("Addition of invalid particpant address should have generated error in service " + "execution."); } catch(InvalidRequestException e) { // Good. } } }
@Override protected void setUp() { service = ParticipantServices.create(); helper = new OperationServiceHelper(WAVELET_NAME, ROBOT); // BlipData constructor is broken, it doesn't set the blipId passed in the // constructor blipData = new BlipData(s(WAVE_ID), s(WAVELET_ID), TEMP_BLIP_ID, NEW_BLIP_CONTENT); blipData.setBlipId(TEMP_BLIP_ID); }
public void testAddThrowsOnDuplicateParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm robot is on wave prior to operation to re-add it. Set<ParticipantId> participants = conversation.getParticipantIds(); assertTrue("Robot should be a participant on wavelet prior to test operation to add it.", participants.contains(ROBOT)); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ROBOT.getAddress())); try { service.execute(operation, context, ROBOT); fail("Duplicate add of participant should have generated error in service execution."); } catch(InvalidRequestException e) { // Good. } }
register(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.WAVELET_APPEND_BLIP, BlipOperationServices.create()); register(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.BLIP_CONTINUE_THREAD, BlipOperationServices.create()); register(OperationType.BLIP_CREATE_CHILD, BlipOperationServices.create());
public void testInvalidParticipantAddress() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, MALFORMED_ADDRESS)); try { service.execute(operation, context, ROBOT); fail("Addition of invalid particpant address should have generated error in service " + "execution."); } catch(InvalidRequestException e) { // Good. } } }
register(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.WAVELET_APPEND_BLIP, BlipOperationServices.create()); register(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.BLIP_CONTINUE_THREAD, BlipOperationServices.create()); register(OperationType.BLIP_CREATE_CHILD, BlipOperationServices.create());
public void testRemoveParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = new OperationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX.method(), OPERATION_ID, s(WAVE_ID), s(WAVELET_ID), rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); service.execute(operation, context, ROBOT); // Verify Alex is now a participant on the wave. participants = conversation.getParticipantIds(); assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX)); // Attempt to remove Alex. OperationRequest operation2 = operationRequest(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, OPERATION2_ID, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); service.execute(operation2, context, ROBOT); // Verify Alex is no longer a participant on the wave. participants = conversation.getParticipantIds(); assertFalse("Alex should no longer be a participant on the wavelet.", participants.contains(ALEX)); }
@SuppressWarnings("deprecation") @Inject OperationServiceRegistryImpl(NotifyOperationService notifyOpService) { super(); // Register all the OperationProviders register(OperationType.ROBOT_NOTIFY, notifyOpService); register(OperationType.ROBOT_NOTIFY_CAPABILITIES_HASH, notifyOpService); register(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.WAVELET_APPEND_BLIP, BlipOperationServices.create()); register(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, ParticipantServices.create()); register(OperationType.BLIP_CONTINUE_THREAD, BlipOperationServices.create()); register(OperationType.BLIP_CREATE_CHILD, BlipOperationServices.create()); register(OperationType.BLIP_DELETE, BlipOperationServices.create()); register(OperationType.DOCUMENT_APPEND_INLINE_BLIP, BlipOperationServices.create()); register(OperationType.DOCUMENT_APPEND_MARKUP, BlipOperationServices.create()); register(OperationType.DOCUMENT_INSERT_INLINE_BLIP, BlipOperationServices.create()); register(OperationType.DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT, BlipOperationServices.create()); register(OperationType.WAVELET_CREATE, CreateWaveletService.create()); register(OperationType.DOCUMENT_MODIFY, DocumentModifyService.create()); register(OperationType.WAVELET_SET_TITLE, WaveletSetTitleService.create()); register(OperationType.ROBOT_FOLDER_ACTION, FolderActionService.create()); } }
public void testRemoveParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = new OperationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX.method(), OPERATION_ID, s(WAVE_ID), s(WAVELET_ID), rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); service.execute(operation, context, ROBOT); // Verify Alex is now a participant on the wave. participants = conversation.getParticipantIds(); assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX)); // Attempt to remove Alex. OperationRequest operation2 = operationRequest(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, OPERATION2_ID, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); service.execute(operation2, context, ROBOT); // Verify Alex is no longer a participant on the wave. participants = conversation.getParticipantIds(); assertFalse("Alex should no longer be a participant on the wavelet.", participants.contains(ALEX)); }
public void testAddThrowsOnDuplicateParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm robot is on wave prior to operation to re-add it. Set<ParticipantId> participants = conversation.getParticipantIds(); assertTrue("Robot should be a participant on wavelet prior to test operation to add it.", participants.contains(ROBOT)); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ROBOT.getAddress())); try { service.execute(operation, context, ROBOT); fail("Duplicate add of participant should have generated error in service execution."); } catch(InvalidRequestException e) { // Good. } }
public void testRemoveThrowsOnNonWaveletParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = operationRequest(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); try { service.execute(operation, context, ROBOT); fail("Removal of non-participant should have generated error in service execution."); } catch(InvalidRequestException e) { // Good. } }
public void testRemoveThrowsOnNonWaveletParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = operationRequest(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID, ALEX.getAddress())); try { service.execute(operation, context, ROBOT); fail("Removal of non-participant should have generated error in service execution."); } catch(InvalidRequestException e) { // Good. } }
public void testAddParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID,ALEX.getAddress())); service.execute(operation, context, ROBOT); JsonRpcResponse response = context.getResponse(OPERATION_ID); assertFalse("Add Participant generated error in service execution.", response.isError()); // Verify Alex is now a participant on the wave. participants = conversation.getParticipantIds(); assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX)); }
public void testAddParticipant() throws Exception { OperationContextImpl context = helper.getContext(); ObservableConversation conversation = context.openConversation(WAVE_ID, WAVELET_ID, ROBOT).getRoot(); String rootBlipId = ConversationUtil.getRootBlipId(conversation); // Confirm alex is not on wave prior to operation. Set<ParticipantId> participants = conversation.getParticipantIds(); assertFalse("Alex should not be a participant on wavelet prior to operation to add him.", participants.contains(ALEX)); OperationRequest operation = operationRequest(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, rootBlipId, Parameter.of(ParamsProperty.PARTICIPANT_ID,ALEX.getAddress())); service.execute(operation, context, ROBOT); JsonRpcResponse response = context.getResponse(OPERATION_ID); assertFalse("Add Participant generated error in service execution.", response.isError()); // Verify Alex is now a participant on the wave. participants = conversation.getParticipantIds(); assertTrue("Alex should now be a participant on the wavelet.", participants.contains(ALEX)); }