|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This report was generated with an evaluation server license. Purchase Clover or configure your license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ContentDecoratorChain | Line # 47 | 24 | 0% | 14 | 24 | 41,5% |
0.41463414
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (42) | |||
| Result | |||
|
0.2682927
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNowAndCheckCommentsReindexed
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNowAndCheckCommentsReindexed
|
1 PASS | |
|
0.2682927
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryAsIsAndCheckCommentsStaysIndexed
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryAsIsAndCheckCommentsStaysIndexed
|
1 PASS | |
|
0.2682927
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryAsIsAndCheckCommentsStaysIndexed
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryAsIsAndCheckCommentsStaysIndexed
|
1 PASS | |
|
0.2682927
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNowAndCheckCommentsReindexed
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNowAndCheckCommentsReindexed
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.SingleBlogBloggerAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.SingleBlogBloggerAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.MultiBlogMetaWeblogAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.MultiBlogMetaWeblogAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.domain.BlogServiceTest.testListenersFiredWhenBlogEntryPublished
net.sourceforge.pebble.domain.BlogServiceTest.testListenersFiredWhenBlogEntryPublished
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.MultiBlogMetaWeblogAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.MultiBlogMetaWeblogAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.SingleBlogMetaWeblogAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.SingleBlogMetaWeblogAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.domain.BlogServiceTest.testListenersFiredWhenBlogEntryPublished
net.sourceforge.pebble.domain.BlogServiceTest.testListenersFiredWhenBlogEntryPublished
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNow
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNow
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.SingleBlogBloggerAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.SingleBlogBloggerAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNow
net.sourceforge.pebble.web.action.PublishBlogEntryActionTest.testPublishBlogEntryNow
|
1 PASS | |
|
0.17073171
|
net.sourceforge.pebble.webservice.SingleBlogMetaWeblogAPIHandlerTest.testEditPost
net.sourceforge.pebble.webservice.SingleBlogMetaWeblogAPIHandlerTest.testEditPost
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testMultipleSubCategory
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testMultipleSubCategory
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerptNoExtendedBody
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerptNoExtendedBody
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testImport
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testImport
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testImport
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testImport
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testPublished
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testPublished
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testUTF8
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testUTF8
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testPublished
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testPublished
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoPrimaryCategory
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoPrimaryCategory
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testComment
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testComment
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerpt
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerpt
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testMultipleSubCategory
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testMultipleSubCategory
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testUTF8
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testUTF8
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testComment
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testComment
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerpt
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerpt
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerptNoExtendedBody
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoExcerptNoExtendedBody
|
1 PASS | |
|
0.14634146
|
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoPrimaryCategory
net.sourceforge.pebble.util.importer.MovableTypeImporterTest.testNoPrimaryCategory
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToCommentThatDoesntExist
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToCommentThatDoesntExist
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToBlogEntry
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToBlogEntry
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToComment
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToComment
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testPublishedViewBlogEntry
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testPublishedViewBlogEntry
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToComment
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToComment
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testUnpublishedViewBlogEntryAsUserThatIsAuthorisedForBlog
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testUnpublishedViewBlogEntryAsUserThatIsAuthorisedForBlog
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToCommentThatDoesntExist
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToCommentThatDoesntExist
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsAnonymousUser
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsAnonymousUser
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testUnpublishedViewBlogEntryAsUserThatIsAuthorisedForBlog
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testUnpublishedViewBlogEntryAsUserThatIsAuthorisedForBlog
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsAnonymousUser
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsAnonymousUser
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testPublishedViewBlogEntry
net.sourceforge.pebble.web.action.ViewBlogEntryActionTest.testPublishedViewBlogEntry
|
1 PASS | |
|
0.07317073
|
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToBlogEntry
net.sourceforge.pebble.web.action.SaveCommentActionTest.testProcessAsBlogContributorWhenReplyingToBlogEntry
|
1 PASS | |
| 1 | /* | |
| 2 | * Copyright (c) 2003-2006, Simon Brown | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions are met: | |
| 7 | * | |
| 8 | * - Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * | |
| 11 | * - Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in | |
| 13 | * the documentation and/or other materials provided with the | |
| 14 | * distribution. | |
| 15 | * | |
| 16 | * - Neither the name of Pebble nor the names of its contributors may | |
| 17 | * be used to endorse or promote products derived from this software | |
| 18 | * without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |
| 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 30 | * POSSIBILITY OF SUCH DAMAGE. | |
| 31 | */ | |
| 32 | package net.sourceforge.pebble.decorator; | |
| 33 | ||
| 34 | import net.sourceforge.pebble.domain.*; | |
| 35 | import net.sourceforge.pebble.api.decorator.ContentDecorator; | |
| 36 | import net.sourceforge.pebble.api.decorator.ContentDecoratorContext; | |
| 37 | ||
| 38 | import java.util.ArrayList; | |
| 39 | import java.util.List; | |
| 40 | import java.util.Iterator; | |
| 41 | ||
| 42 | /** | |
| 43 | * Manages a list of content decorators at runtime. | |
| 44 | * | |
| 45 | * @author Simon Brown | |
| 46 | */ | |
| 47 | public class ContentDecoratorChain implements ContentDecorator { | |
| 48 | ||
| 49 | /** the blog associated with this chain */ | |
| 50 | private Blog blog; | |
| 51 | ||
| 52 | /** the list of decorators */ | |
| 53 | private List<ContentDecorator> decorators = new ArrayList<ContentDecorator>(); | |
| 54 | ||
| 55 | /** | |
| 56 | * Creates a new chain. | |
| 57 | */ | |
| 58 | 1334 |
public ContentDecoratorChain(Blog blog) { |
| 59 | 1334 | setBlog(blog); |
| 60 | } | |
| 61 | ||
| 62 | /** | |
| 63 | * Adds a new decorator. | |
| 64 | * | |
| 65 | * @param decorator a ContentDecorator instance | |
| 66 | */ | |
| 67 | 9338 |
public void add(ContentDecorator decorator) { |
| 68 | 9338 | decorators.add(decorator); |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Gets the list of decorators in use. | |
| 73 | */ | |
| 74 | 0 |
public List getContentDecorators() { |
| 75 | 0 | return new ArrayList(decorators); |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * Decorates the specified blog entry. | |
| 80 | * | |
| 81 | * @param context the context in which the decoration is running | |
| 82 | * @param blogEntry the blog entry to be decorated | |
| 83 | */ | |
| 84 | 14 |
public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) { |
| 85 | 14 | for (ContentDecorator decorator : decorators) { |
| 86 | 98 | decorator.decorate(context, blogEntry); |
| 87 | } | |
| 88 | ||
| 89 | // if the view is detail, decorate the comments and TrackBacks too | |
| 90 | 14 | if (context.getView() == ContentDecoratorContext.DETAIL_VIEW) { |
| 91 | 14 | for (Comment comment : blogEntry.getComments()) { |
| 92 | 4 | decorate(context, comment); |
| 93 | } | |
| 94 | ||
| 95 | 14 | for (TrackBack trackBack : blogEntry.getTrackBacks()) { |
| 96 | 0 | decorate(context, trackBack); |
| 97 | } | |
| 98 | } | |
| 99 | } | |
| 100 | ||
| 101 | /** | |
| 102 | * Decorates the specified comment. | |
| 103 | * | |
| 104 | * @param context the context in which the decoration is running | |
| 105 | * @param comment the comment to be decorated | |
| 106 | */ | |
| 107 | 16 |
public void decorate(ContentDecoratorContext context, Comment comment) { |
| 108 | 16 | for (ContentDecorator decorator : decorators) { |
| 109 | 112 | decorator.decorate(context, comment); |
| 110 | } | |
| 111 | } | |
| 112 | ||
| 113 | /** | |
| 114 | * Decorates the specified TrackBack. | |
| 115 | * | |
| 116 | * @param context the context in which the decoration is running | |
| 117 | * @param trackBack the TrackBack to be decorated | |
| 118 | */ | |
| 119 | 0 |
public void decorate(ContentDecoratorContext context, TrackBack trackBack) { |
| 120 | 0 | for (ContentDecorator decorator : decorators) { |
| 121 | 0 | decorator.decorate(context, trackBack); |
| 122 | } | |
| 123 | } | |
| 124 | ||
| 125 | /** | |
| 126 | * Decorates the specified static page. | |
| 127 | * | |
| 128 | * @param context the context in which the decoration is running | |
| 129 | * @param staticPage the static page to be decorated | |
| 130 | */ | |
| 131 | 0 |
public void decorate(ContentDecoratorContext context, StaticPage staticPage) { |
| 132 | 0 | for (ContentDecorator decorator : decorators) { |
| 133 | 0 | decorator.decorate(context, staticPage); |
| 134 | } | |
| 135 | } | |
| 136 | ||
| 137 | /** | |
| 138 | * Gets the blog to which this decorator is associated. | |
| 139 | * | |
| 140 | * @return a Blog instance | |
| 141 | */ | |
| 142 | 0 |
public Blog getBlog() { |
| 143 | 0 | return this.blog; |
| 144 | } | |
| 145 | ||
| 146 | /** | |
| 147 | * Sets the blog to which this decorator is associated. | |
| 148 | * | |
| 149 | * @param blog a Blog instance | |
| 150 | */ | |
| 151 | 1334 |
public void setBlog(Blog blog) { |
| 152 | 1334 | this.blog = blog; |
| 153 | } | |
| 154 | ||
| 155 | /** | |
| 156 | * Gets the list of content decorators. | |
| 157 | * | |
| 158 | * @return a List of ContentDecorator instances | |
| 159 | */ | |
| 160 | 0 |
public List<ContentDecorator> getDecorators() { |
| 161 | 0 | return new ArrayList<ContentDecorator>(decorators); |
| 162 | } | |
| 163 | ||
| 164 | /** | |
| 165 | * Decorates the specified blog entries. | |
| 166 | * | |
| 167 | * @param blogEntries a List of BlogEntry instances | |
| 168 | */ | |
| 169 | 0 |
public static void decorate(ContentDecoratorContext context, List blogEntries) { |
| 170 | 0 | if (blogEntries != null) { |
| 171 | 0 | Iterator it = blogEntries.iterator(); |
| 172 | 0 | while (it.hasNext()) { |
| 173 | 0 | BlogEntry blogEntry = (BlogEntry)it.next(); |
| 174 | 0 | blogEntry.getBlog().getContentDecoratorChain().decorate(context, blogEntry); |
| 175 | } | |
| 176 | } | |
| 177 | } | |
| 178 | ||
| 179 | } | |
|
||||||||||||