@Test public void convertLegacyEventToEventWithoutDocument() { Set<String> target = new HashSet<>(); target.add("mywiki:XWiki.Bar"); LegacyEvent event = new LegacyEvent(); event.setApplication("app"); event.setBody("body"); event.setDate(new Date(10)); event.setWiki("mywiki"); event.setEventId("eventId"); event.setPriority(20); event.setRequestId("requestId"); event.setStream("stream"); event.setTitle("title"); event.setType("type"); event.setUser("mywiki:XWiki.Foo"); event.setVersion("10.3"); event.setTarget(target); event.setHidden(false); when(eventFactory.createRawEvent()).thenReturn(new DefaultEvent()); DocumentReference userDocReference = new DocumentReference("mywiki", "XWiki", "User"); when(resolver.resolve("mywiki:XWiki.Foo", EntityType.DOCUMENT)).thenReturn(userDocReference); Event result = legacyEventConverter.convertLegacyActivityToEvent(event); assertNotNull(result); assertEquals("app", result.getApplication()); assertEquals("body", result.getBody()); assertEquals("eventId", result.getId()); assertEquals(Event.Importance.MINOR, result.getImportance()); assertEquals("requestId", result.getGroupId()); assertEquals("stream", result.getStream()); assertEquals("title", result.getTitle()); assertEquals("type", result.getType()); assertEquals(userDocReference, result.getUser()); assertEquals("10.3", result.getDocumentVersion()); assertEquals(target, result.getTarget()); assertFalse(result.getHidden()); verify(resolver, times(1)).resolve(any(), any()); }
@Override public Event convertLegacyActivityToEvent(LegacyEvent e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); Event result; if (converter == null) { result = super.convertLegacyActivityToEvent(e); } else { result = converter.convertLegacyActivityToEvent(e); } return result; }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public Event convertLegacyActivityToEvent(LegacyEvent e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); Event result; if (converter == null) { result = super.convertLegacyActivityToEvent(e); } else { result = converter.convertLegacyActivityToEvent(e); } return result; } }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public Event convertLegacyActivityToEvent(LegacyEvent e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); Event result; if (converter == null) { result = super.convertLegacyActivityToEvent(e); } else { result = converter.convertLegacyActivityToEvent(e); } return result; }  }
DefaultLegacyEventConverter extends AbstractLegacyEventConverter { @Override public Event convertLegacyActivityToEvent(LegacyEvent e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); Event result; if (converter == null) { result = super.convertLegacyActivityToEvent(e); } else { result = converter.convertLegacyActivityToEvent(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 Event convertLegacyActivityToEvent(LegacyEvent e) { LegacyEventConverter converter = this.getConverterForType(e.getType()); Event result; if (converter == null) { result = super.convertLegacyActivityToEvent(e); } else { result = converter.convertLegacyActivityToEvent(e); } return result; }  @Override LegacyEvent convertEventToLegacyActivity(Event e); @Override Event convertLegacyActivityToEvent(LegacyEvent e); @Override LegacyEventStatus convertEventStatusToLegacyActivityStatus(EventStatus eventStatus); @Override EventStatus convertLegacyActivityStatusToEventStatus(LegacyEventStatus eventStatus);  }