public void testGenerateWaveletSelfRemovedEvent() throws Exception { wavelet.removeParticipant(ROBOT); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_SELF_REMOVED); // Participant changed event, after self removed event is filtered. assertEquals("Expected only one event", 1, messages.getEvents().size()); }
public void testGenerateWaveletParticipantsChangedEventOnAdd() throws Exception { wavelet.addParticipant(BOB); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_PARTICIPANTS_CHANGED); assertTrue("Only expected one event", messages.getEvents().size() == 1); WaveletParticipantsChangedEvent event = WaveletParticipantsChangedEvent.as(messages.getEvents().get(0)); assertTrue("Bob should be added", event.getParticipantsAdded().contains(BOB.getAddress())); }
public void testGenerateWaveletSelfRemovedEvent() throws Exception { wavelet.removeParticipant(ROBOT); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_SELF_REMOVED); // Participant changed event, after self removed event is filtered. assertEquals("Expected only one event", 1, messages.getEvents().size()); }
/** * Checks whether all events generated are in the capabilities map. */ private void checkAllEventsAreInCapabilites(EventMessageBundle messages, Map<EventType, Capability> capabilities) { for (Event event : messages.getEvents()) { if (!capabilities.containsKey(event.getType())) { fail("Generated event of type" + event.getType() + " which is not in the capabilities"); } } } }
/** * Checks whether all events generated are in the capabilities map. */ private void checkAllEventsAreInCapabilites(EventMessageBundle messages, Map<EventType, Capability> capabilities) { for (Event event : messages.getEvents()) { if (!capabilities.containsKey(event.getType())) { fail("Generated event of type" + event.getType() + " which is not in the capabilities"); } } } }
public void testGenerateWaveletParticipantsChangedEventOnRemove() throws Exception { wavelet.removeParticipant(ALEX); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_PARTICIPANTS_CHANGED); assertEquals("Expected one event", 1, messages.getEvents().size()); WaveletParticipantsChangedEvent event = WaveletParticipantsChangedEvent.as(messages.getEvents().get(0)); assertTrue( "Alex should be removed", event.getParticipantsRemoved().contains(ALEX.getAddress())); }
public void testGenerateWaveletParticipantsChangedEventOnAdd() throws Exception { wavelet.addParticipant(BOB); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_PARTICIPANTS_CHANGED); assertTrue("Only expected one event", messages.getEvents().size() == 1); WaveletParticipantsChangedEvent event = WaveletParticipantsChangedEvent.as(messages.getEvents().get(0)); assertTrue("Bob should be added", event.getParticipantsAdded().contains(BOB.getAddress())); }
public void testGenerateWaveletParticipantsChangedEventOnRemove() throws Exception { wavelet.removeParticipant(ALEX); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_PARTICIPANTS_CHANGED); assertEquals("Expected one event", 1, messages.getEvents().size()); WaveletParticipantsChangedEvent event = WaveletParticipantsChangedEvent.as(messages.getEvents().get(0)); assertTrue( "Alex should be removed", event.getParticipantsRemoved().contains(ALEX.getAddress())); }
public void testGenerateWaveletSelfAddedEvent() throws Exception { waveletData.removeParticipant(ROBOT); wavelet.addParticipant(ROBOT); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_SELF_ADDED); assertEquals("Expected two events", 2, messages.getEvents().size()); }
public void testGenerateWaveletSelfAddedEvent() throws Exception { waveletData.removeParticipant(ROBOT); wavelet.addParticipant(ROBOT); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_SELF_ADDED); assertEquals("Expected two events", 2, messages.getEvents().size()); }
public void testGenerateWaveletBlipRemovedEvent() throws Exception { ObservableConversationThread rootThread = conversationUtil.buildConversation(wavelet).getRoot().getRootThread(); ObservableConversationBlip newBlip = rootThread.appendBlip(); newBlip.delete(); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_REMOVED); assertEquals("Expected two events", 2, messages.getEvents().size()); // Blip removed should be the second event. WaveletBlipRemovedEvent event = WaveletBlipRemovedEvent.as(messages.getEvents().get(1)); assertEquals("Expected the same id as the removed blip", newBlip.getId(), event.getRemovedBlipId()); }
public void testGenerateWaveletBlipCreatedEvent() throws Exception { ObservableConversationView conversation = conversationUtil.buildConversation(wavelet); ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip(); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_CREATED); assertEquals("Expected one event", 1, messages.getEvents().size()); WaveletBlipCreatedEvent event = WaveletBlipCreatedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the same id as the new blip", newBlip.getId(), event.getNewBlipId()); }
public void testGenerateWaveletBlipCreatedEvent() throws Exception { ObservableConversationView conversation = conversationUtil.buildConversation(wavelet); ObservableConversationBlip newBlip = conversation.getRoot().getRootThread().appendBlip(); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_CREATED); assertEquals("Expected one event", 1, messages.getEvents().size()); WaveletBlipCreatedEvent event = WaveletBlipCreatedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the same id as the new blip", newBlip.getId(), event.getNewBlipId()); }
public void testGenerateWaveletBlipRemovedEvent() throws Exception { ObservableConversationThread rootThread = conversationUtil.buildConversation(wavelet).getRoot().getRootThread(); ObservableConversationBlip newBlip = rootThread.appendBlip(); newBlip.delete(); EventMessageBundle messages = generateAndCheckEvents(EventType.WAVELET_BLIP_REMOVED); assertEquals("Expected two events", 2, messages.getEvents().size()); // Blip removed should be the second event. WaveletBlipRemovedEvent event = WaveletBlipRemovedEvent.as(messages.getEvents().get(1)); assertEquals("Expected the same id as the removed blip", newBlip.getId(), event.getRemovedBlipId()); }
public void testGenerateAnnotatedTextChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); String annotationKey = "key"; String annotationValue = "value"; rootBlip.getContent().setAnnotation(0, 1, annotationKey, annotationValue); EventMessageBundle messages = generateAndCheckEvents(EventType.ANNOTATED_TEXT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); AnnotatedTextChangedEvent event = AnnotatedTextChangedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the key of the annotation", annotationKey, event.getName()); assertEquals("Expected the value of the annotation", annotationValue, event.getValue()); }
public void testGenerateAnnotatedTextChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); String annotationKey = "key"; String annotationValue = "value"; rootBlip.getContent().setAnnotation(0, 1, annotationKey, annotationValue); EventMessageBundle messages = generateAndCheckEvents(EventType.ANNOTATED_TEXT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); AnnotatedTextChangedEvent event = AnnotatedTextChangedEvent.as(messages.getEvents().get(0)); assertEquals("Expected the key of the annotation", annotationKey, event.getName()); assertEquals("Expected the value of the annotation", annotationValue, event.getValue()); }
public void testGenerateDocumentChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event", 1, messages.getEvents().size()); // Can not check the blip id because it is not accessible, however the line // here below will confirm that there was actually a real // DocumentChangedEvent put into the message bundle. DocumentChangedEvent event = DocumentChangedEvent.as(messages.getEvents().get(0)); assertEquals(ALEX.getAddress(), event.getModifiedBy()); }
public void testGenerateDocumentChangedEvent() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event", 1, messages.getEvents().size()); // Can not check the blip id because it is not accessible, however the line // here below will confirm that there was actually a real // DocumentChangedEvent put into the message bundle. DocumentChangedEvent event = DocumentChangedEvent.as(messages.getEvents().get(0)); assertEquals(ALEX.getAddress(), event.getModifiedBy()); }
public void testGenerateDocumentChangedEventOnlyOnce() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); // Change the document twice XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); }
public void testGenerateDocumentChangedEventOnlyOnce() throws Exception { ConversationBlip rootBlip = conversationUtil.buildConversation(wavelet).getRoot().getRootThread().getFirstBlip(); // Change the document twice XmlStringBuilder builder = XmlStringBuilder.createText("some random content"); LineContainers.appendToLastLine(rootBlip.getContent(), builder); LineContainers.appendToLastLine(rootBlip.getContent(), builder); EventMessageBundle messages = generateAndCheckEvents(EventType.DOCUMENT_CHANGED); assertEquals("Expected one event only", 1, messages.getEvents().size()); }