@Test public void convertEventToLegacyActivityNoDocument() { DocumentReference useReference = new DocumentReference("mywiki", "XWiki", "Foo"); Set<String> target = Collections.singleton("mywiki:XWiki.Bar"); WikiReference wikiReference = new WikiReference("mywiki"); Event event = mock(Event.class); when(event.getImportance()).thenReturn(Event.Importance.MINOR); when(event.getApplication()).thenReturn("app"); when(event.getBody()).thenReturn("body"); when(event.getDate()).thenReturn(new Date(10)); when(event.getId()).thenReturn("eventId"); when(event.getWiki()).thenReturn(wikiReference); when(event.getGroupId()).thenReturn("groupId"); when(event.getStream()).thenReturn("stream"); when(event.getTitle()).thenReturn("title"); when(event.getType()).thenReturn("type"); when(event.getUser()).thenReturn(useReference); when(event.getTarget()).thenReturn(target); when(event.getHidden()).thenReturn(false); when(serializer.serialize(useReference)).thenReturn("mywiki:XWiki.Foo"); when(serializer.serialize(wikiReference)).thenReturn("mywiki"); LegacyEvent result = legacyEventConverter.convertEventToLegacyActivity(event); assertNotNull(result); assertEquals(20, result.getPriority()); assertEquals("app", result.getApplication()); assertEquals("body", result.getBody()); assertEquals(new Date(10), result.getDate()); assertEquals("eventId", result.getEventId()); assertNull(result.getPage()); assertEquals("", result.getParam1()); assertEquals("", result.getParam2()); assertEquals("groupId", result.getRequestId()); assertNull(result.getSpace()); assertEquals("stream", result.getStream()); assertEquals("title", result.getTitle()); assertEquals("type", result.getType()); assertNull(result.getUrl()); assertEquals("mywiki:XWiki.Foo", result.getUser()); assertEquals("", result.getVersion()); assertEquals("mywiki", result.getWiki()); assertEquals(target, result.getTarget()); assertFalse(result.isHidden()); verify(serializer, times(2)).serialize(any()); verify(compactSerializer, never()).serialize(any()); }
@Override public LegacyEvent convertEventToLegacyActivity(Event e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); LegacyEvent result; if (converter == null) { result = super.convertEventToLegacyActivity(e); } else { result = converter.convertEventToLegacyActivity(e); } return result; }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public LegacyEvent convertEventToLegacyActivity(Event e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); LegacyEvent result; if (converter == null) { result = super.convertEventToLegacyActivity(e); } else { result = converter.convertEventToLegacyActivity(e); } return result; } }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public LegacyEvent convertEventToLegacyActivity(Event e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); LegacyEvent result; if (converter == null) { result = super.convertEventToLegacyActivity(e); } else { result = converter.convertEventToLegacyActivity(e); } return result; }  }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public LegacyEvent convertEventToLegacyActivity(Event e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); LegacyEvent result; if (converter == null) { result = super.convertEventToLegacyActivity(e); } else { result = converter.convertEventToLegacyActivity(e); } return result; }  @Override LegacyEvent convertEventToLegacyActivity(Event e); @Override Event convertLegacyActivityToEvent(LegacyEvent e); @Override LegacyEventStatus convertEventStatusToLegacyActivityStatus(EventStatus eventStatus); @Override EventStatus convertLegacyActivityStatusToEventStatus(LegacyEventStatus eventStatus); }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public LegacyEvent convertEventToLegacyActivity(Event e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); LegacyEvent result; if (converter == null) { result = super.convertEventToLegacyActivity(e); } else { result = converter.convertEventToLegacyActivity(e); } return result; }  @Override LegacyEvent convertEventToLegacyActivity(Event e); @Override Event convertLegacyActivityToEvent(LegacyEvent e); @Override LegacyEventStatus convertEventStatusToLegacyActivityStatus(EventStatus eventStatus); @Override EventStatus convertLegacyActivityStatusToEventStatus(LegacyEventStatus eventStatus);  }