Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
98   469   66   1.78
20   347   0.67   55
55     1.2  
1    
 
  EventsChainingRenderer       Line # 41 98 0% 66 7 96% 0.95953757
 
  (420)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.internal.renderer.event;
21   
22    import java.util.Iterator;
23    import java.util.Map;
24   
25    import org.apache.commons.lang3.StringUtils;
26    import org.xwiki.rendering.listener.Format;
27    import org.xwiki.rendering.listener.HeaderLevel;
28    import org.xwiki.rendering.listener.MetaData;
29    import org.xwiki.rendering.listener.reference.ResourceReference;
30    import org.xwiki.rendering.listener.ListType;
31    import org.xwiki.rendering.listener.chaining.ListenerChain;
32    import org.xwiki.rendering.syntax.Syntax;
33    import org.xwiki.rendering.renderer.AbstractChainingPrintRenderer;
34   
35    /**
36    * Prints listener event names in a format useful for testing and debugging.
37    *
38    * @version $Id: 76d54f0e6f0adf22f1f1bbe13dcb26060b4ce8f3 $
39    * @since 1.8RC1
40    */
 
41    public class EventsChainingRenderer extends AbstractChainingPrintRenderer
42    {
 
43  431 toggle public EventsChainingRenderer(ListenerChain listenerChain)
44    {
45  431 setListenerChain(listenerChain);
46    }
47   
48    // Events
49   
50    /**
51    * {@inheritDoc}
52    * @since 3.0M2
53    */
 
54  431 toggle @Override
55    public void beginDocument(MetaData metaData)
56    {
57  431 getPrinter().println("beginDocument" + serializeParameters(metaData.getMetaData()));
58    }
59   
60    /**
61    * {@inheritDoc}
62    * @since 3.0M2
63    */
 
64  431 toggle @Override
65    public void endDocument(MetaData metaData)
66    {
67  431 getPrinter().print("endDocument" + serializeParameters(metaData.getMetaData()));
68    }
69   
 
70  50 toggle @Override
71    public void beginGroup(Map<String, String> parameters)
72    {
73  50 getPrinter().println("beginGroup" + serializeParameters(parameters));
74    }
75   
 
76  50 toggle @Override
77    public void endGroup(Map<String, String> parameters)
78    {
79  50 getPrinter().println("endGroup" + serializeParameters(parameters));
80    }
81   
 
82  162 toggle @Override
83    public void beginFormat(Format format, Map<String, String> parameters)
84    {
85  162 getPrinter().println("beginFormat [" + format + "]" + serializeParameters(parameters));
86    }
87   
 
88  162 toggle @Override
89    public void endFormat(Format format, Map<String, String> parameters)
90    {
91  162 getPrinter().println("endFormat [" + format + "]" + serializeParameters(parameters));
92    }
93   
 
94  393 toggle @Override
95    public void beginParagraph(Map<String, String> parameters)
96    {
97  393 getPrinter().println("beginParagraph" + serializeParameters(parameters));
98    }
99   
 
100  393 toggle @Override
101    public void endParagraph(Map<String, String> parameters)
102    {
103  393 getPrinter().println("endParagraph" + serializeParameters(parameters));
104    }
105   
 
106  152 toggle @Override
107    public void onNewLine()
108    {
109  152 getPrinter().println("onNewLine");
110    }
111   
 
112  144 toggle @Override
113    public void beginLink(ResourceReference reference, boolean isFreeStandingURI, Map<String, String> parameters)
114    {
115  144 getPrinter().println("beginLink [" + reference + "] [" + isFreeStandingURI + "]"
116    + serializeParameters(parameters));
117    }
118   
 
119  144 toggle @Override
120    public void endLink(ResourceReference reference, boolean isFreeStandingURI, Map<String, String> parameters)
121    {
122  144 getPrinter().println("endLink [" + reference + "] [" + isFreeStandingURI + "]"
123    + serializeParameters(parameters));
124    }
125   
 
126  39 toggle @Override
127    public void onMacro(String id, Map<String, String> parameters, String content, boolean isInline)
128    {
129  39 printMacroData("onMacro", id, parameters, content, isInline);
130    }
131   
 
132  142 toggle @Override
133    public void beginSection(Map<String, String> parameters)
134    {
135  142 getPrinter().println("beginSection" + serializeParameters(parameters));
136    }
137   
 
138  124 toggle @Override
139    public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters)
140    {
141  124 getPrinter().println("beginHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
142    }
143   
 
144  142 toggle @Override
145    public void endSection(Map<String, String> parameters)
146    {
147  142 getPrinter().println("endSection" + serializeParameters(parameters));
148    }
149   
 
150  124 toggle @Override
151    public void endHeader(HeaderLevel level, String id, Map<String, String> parameters)
152    {
153  124 getPrinter().println("endHeader [" + level + ", " + id + "]" + serializeParameters(parameters));
154    }
155   
 
156  1730 toggle @Override
157    public void onWord(String word)
158    {
159  1730 getPrinter().println("onWord [" + getEscaped(word) + "]");
160    }
161   
 
162  122 toggle @Override
163    public void beginList(ListType listType, Map<String, String> parameters)
164    {
165  122 getPrinter().println("beginList [" + listType + "]" + serializeParameters(parameters));
166    }
167   
 
168  165 toggle @Override
169    public void beginListItem()
170    {
171  165 getPrinter().println("beginListItem");
172    }
173   
 
174  122 toggle @Override
175    public void endList(ListType listType, Map<String, String> parameters)
176    {
177  122 getPrinter().println("endList [" + listType + "]" + serializeParameters(parameters));
178    }
179   
 
180  165 toggle @Override
181    public void endListItem()
182    {
183  165 getPrinter().println("endListItem");
184    }
185   
 
186  849 toggle @Override
187    public void onSpace()
188    {
189  849 getPrinter().println("onSpace");
190    }
191   
 
192  394 toggle @Override
193    public void onSpecialSymbol(char symbol)
194    {
195  394 getPrinter().println("onSpecialSymbol [" + symbol + "]");
196    }
197   
 
198  10 toggle @Override
199    public void onRawText(String text, Syntax syntax)
200    {
201  10 getPrinter().println("onRawText [" + text + "] [" + syntax.toIdString() + "]");
202    }
203   
 
204  1075 toggle @Override
205    public void beginMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
206    {
207  1075 printMacroData("beginMacroMarker", name, parameters, content, isInline);
208    }
209   
 
210  1075 toggle @Override
211    public void endMacroMarker(String name, Map<String, String> parameters, String content, boolean isInline)
212    {
213  1075 printMacroData("endMacroMarker", name, parameters, content, isInline);
214    }
215   
216    /**
217    * {@inheritDoc}
218    * @since 3.0M2
219    */
 
220  0 toggle @Override
221    public void beginMetaData(MetaData metaData)
222    {
223  0 getPrinter().println("beginMetaData" + serializeParameters(metaData.getMetaData()));
224    }
225   
226    /**
227    * {@inheritDoc}
228    * @since 3.0M2
229    */
 
230  0 toggle @Override
231    public void endMetaData(MetaData metaData)
232    {
233  0 getPrinter().println("endMetaData" + serializeParameters(metaData.getMetaData()));
234    }
235   
 
236  3 toggle @Override
237    public void onId(String name)
238    {
239  3 getPrinter().println("onId [" + name + "]");
240    }
241   
 
242  22 toggle @Override
243    public void onHorizontalLine(Map<String, String> parameters)
244    {
245  22 getPrinter().println("onHorizontalLine" + serializeParameters(parameters));
246    }
247   
 
248  16 toggle @Override
249    public void onEmptyLines(int count)
250    {
251  16 getPrinter().println("onEmptyLines [" + count + "]");
252    }
253   
 
254  39 toggle @Override
255    public void onVerbatim(String protectedString, boolean isInline, Map<String, String> parameters)
256    {
257  39 getPrinter().println(
258    "onVerbatim [" + protectedString + "] [" + isInline + "]" + serializeParameters(parameters));
259    }
260   
261    /**
262    * {@inheritDoc}
263    * @since 2.0RC1
264    */
 
265  39 toggle @Override
266    public void beginDefinitionList(Map<String, String> parameters)
267    {
268  39 getPrinter().println("beginDefinitionList" + serializeParameters(parameters));
269    }
270   
271    /**
272    * {@inheritDoc}
273    * @since 2.0RC1
274    */
 
275  39 toggle @Override
276    public void endDefinitionList(Map<String, String> parameters)
277    {
278  39 getPrinter().println("endDefinitionList" + serializeParameters(parameters));
279    }
280   
 
281  27 toggle @Override
282    public void beginDefinitionTerm()
283    {
284  27 getPrinter().println("beginDefinitionTerm");
285    }
286   
 
287  35 toggle @Override
288    public void beginDefinitionDescription()
289    {
290  35 getPrinter().println("beginDefinitionDescription");
291    }
292   
 
293  27 toggle @Override
294    public void endDefinitionTerm()
295    {
296  27 getPrinter().println("endDefinitionTerm");
297    }
298   
 
299  35 toggle @Override
300    public void endDefinitionDescription()
301    {
302  35 getPrinter().println("endDefinitionDescription");
303    }
304   
 
305  15 toggle @Override
306    public void beginQuotation(Map<String, String> parameters)
307    {
308  15 getPrinter().println("beginQuotation" + serializeParameters(parameters));
309    }
310   
 
311  15 toggle @Override
312    public void endQuotation(Map<String, String> parameters)
313    {
314  15 getPrinter().println("endQuotation" + serializeParameters(parameters));
315    }
316   
 
317  25 toggle @Override
318    public void beginQuotationLine()
319    {
320  25 getPrinter().println("beginQuotationLine");
321    }
322   
 
323  25 toggle @Override
324    public void endQuotationLine()
325    {
326  25 getPrinter().println("endQuotationLine");
327    }
328   
 
329  30 toggle @Override
330    public void beginTable(Map<String, String> parameters)
331    {
332  30 getPrinter().println("beginTable" + serializeParameters(parameters));
333    }
334   
 
335  72 toggle @Override
336    public void beginTableCell(Map<String, String> parameters)
337    {
338  72 getPrinter().println("beginTableCell" + serializeParameters(parameters));
339    }
340   
 
341  44 toggle @Override
342    public void beginTableHeadCell(Map<String, String> parameters)
343    {
344  44 getPrinter().println("beginTableHeadCell" + serializeParameters(parameters));
345    }
346   
 
347  55 toggle @Override
348    public void beginTableRow(Map<String, String> parameters)
349    {
350  55 getPrinter().println("beginTableRow" + serializeParameters(parameters));
351    }
352   
 
353  30 toggle @Override
354    public void endTable(Map<String, String> parameters)
355    {
356  30 getPrinter().println("endTable" + serializeParameters(parameters));
357    }
358   
 
359  72 toggle @Override
360    public void endTableCell(Map<String, String> parameters)
361    {
362  72 getPrinter().println("endTableCell" + serializeParameters(parameters));
363    }
364   
 
365  44 toggle @Override
366    public void endTableHeadCell(Map<String, String> parameters)
367    {
368  44 getPrinter().println("endTableHeadCell" + serializeParameters(parameters));
369    }
370   
 
371  55 toggle @Override
372    public void endTableRow(Map<String, String> parameters)
373    {
374  55 getPrinter().println("endTableRow" + serializeParameters(parameters));
375    }
376   
377    /**
378    * {@inheritDoc}
379    * @since 2.5RC1
380    */
 
381  60 toggle @Override
382    public void onImage(ResourceReference reference, boolean isFreeStandingURI, Map<String, String> parameters)
383    {
384  60 getPrinter().println("onImage [" + reference + "] [" + isFreeStandingURI + "]"
385    + serializeParameters(parameters));
386    }
387   
 
388  2434 toggle public String getEscaped(String str)
389    {
390  2434