@Test public void testUpdateCachedEntityWhenAuthoredFirstAndLastCommentsAndManyChanges() { setPersonAsAuthorOfFirstAndLastComments(); context.checking(new Expectations() { { oneOf(updater1).execute(firstComment, person); will(returnValue(true)); oneOf(updater2).execute(firstComment, person); will(returnValue(false)); oneOf(updater1).execute(lastComment, person); will(returnValue(true)); oneOf(updater2).execute(lastComment, person); will(returnValue(false)); } }); updaters.add(updater1); updaters.add(updater2); boolean returnValue = sut.updateCachedEntity(activity, person); assertTrue(returnValue); context.assertIsSatisfied(); }
@Override protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson) { boolean isUpdated = false; CommentDTO firstComment = inActivityDTO.getFirstComment(); CommentDTO lastComment = inActivityDTO.getLastComment(); if (isAuthoredByPerson(firstComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(firstComment, inPerson); } } if (isAuthoredByPerson(lastComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(lastComment, inPerson); } } return isUpdated; }
UpdateAuthorInfoInActivityEmbeddedCachedComments extends UpdateCachedItemsByIds<ActivityDTO, Person> { @Override protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson) { boolean isUpdated = false; CommentDTO firstComment = inActivityDTO.getFirstComment(); CommentDTO lastComment = inActivityDTO.getLastComment(); if (isAuthoredByPerson(firstComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(firstComment, inPerson); } } if (isAuthoredByPerson(lastComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(lastComment, inPerson); } } return isUpdated; } }
UpdateAuthorInfoInActivityEmbeddedCachedComments extends UpdateCachedItemsByIds<ActivityDTO, Person> { @Override protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson) { boolean isUpdated = false; CommentDTO firstComment = inActivityDTO.getFirstComment(); CommentDTO lastComment = inActivityDTO.getLastComment(); if (isAuthoredByPerson(firstComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(firstComment, inPerson); } } if (isAuthoredByPerson(lastComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(lastComment, inPerson); } } return isUpdated; } UpdateAuthorInfoInActivityEmbeddedCachedComments(final Integer inBatchSize,
            final List<UpdateCommentDTOFromPerson> inCommentUpdaters); }
UpdateAuthorInfoInActivityEmbeddedCachedComments extends UpdateCachedItemsByIds<ActivityDTO, Person> { @Override protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson) { boolean isUpdated = false; CommentDTO firstComment = inActivityDTO.getFirstComment(); CommentDTO lastComment = inActivityDTO.getLastComment(); if (isAuthoredByPerson(firstComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(firstComment, inPerson); } } if (isAuthoredByPerson(lastComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(lastComment, inPerson); } } return isUpdated; } UpdateAuthorInfoInActivityEmbeddedCachedComments(final Integer inBatchSize,
            final List<UpdateCommentDTOFromPerson> inCommentUpdaters);  }
UpdateAuthorInfoInActivityEmbeddedCachedComments extends UpdateCachedItemsByIds<ActivityDTO, Person> { @Override protected Boolean updateCachedEntity(final ActivityDTO inActivityDTO, final Person inPerson) { boolean isUpdated = false; CommentDTO firstComment = inActivityDTO.getFirstComment(); CommentDTO lastComment = inActivityDTO.getLastComment(); if (isAuthoredByPerson(firstComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(firstComment, inPerson); } } if (isAuthoredByPerson(lastComment, inPerson)) { for (UpdateCommentDTOFromPerson updater : commentUpdaters) { isUpdated |= updater.execute(lastComment, inPerson); } } return isUpdated; } UpdateAuthorInfoInActivityEmbeddedCachedComments(final Integer inBatchSize,
            final List<UpdateCommentDTOFromPerson> inCommentUpdaters);   }