On 2014-02-10 10:52, Carlos Munoz wrote:
> In
> zanata-war/src/main/java/org/zanata/service/impl/DocumentServiceImpl.java:
> 
>> @@ -154,11 +158,14 @@ public HDocument saveDocument(String projectSlug, String iterationSlug,
>>          documentDAO.flush();
>>  
>>          long actorId = authenticatedAccount.getPerson().getId();
>> -        if (changed && Events.exists()) {
>> -            Events.instance().raiseTransactionSuccessEvent(
>> -                    DocumentUploadedEvent.EVENT_NAME,
>> -                    new DocumentUploadedEvent(actorId, document.getId(), true, hLocale
>> -                            .getLocaleId()));
>> +        if (changed) {
>> +            if( Events.exists() ) {
>> +                Events.instance().raiseTransactionSuccessEvent(
> 
> What do you have in mind? It's just a precaution to check for that. I
> think if the event framework were not present a lot of Zanata features
> would break.

Well, to start at the bottom, could we inject the Events component, and
mark it as required?  Otherwise we might need some sort of Null Object.
 (That might be hard to do without modifying Seam.)

If we have an 'if', we really ought to test both paths (eg for complete
branch coverage).  Whereas if we can eliminate the 'if', that's one code
path we don't need to test.

-- 
Sean Flanigan

Senior Software Engineer
Engineering - Internationalisation
Red Hat