2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.shale.clay.config;
18  
19  import java.util.Iterator;
20  
21  import junit.framework.Test;
22  import junit.framework.TestSuite;
23  
24  import org.apache.shale.clay.config.beans.AttributeBean;
25  import org.apache.shale.clay.config.beans.ComponentBean;
26  import org.apache.shale.clay.config.beans.ElementBean;
27  
28  // Tests that the clay component metadata can be loaded and inheritance resolved.
29  public class ConfigTestCase extends AbstractTestCaseConfig {
30  
31      // Construct a new instance of this test case.
32      public ConfigTestCase(String name) {
33          super(name);
34      }
35  
36      // Return the tests included in this test case.
37      public static Test suite() {
38  
39          return (new TestSuite(ConfigTestCase.class));
40  
41      }
42  
43  
44      public void testLoadConfigFile() {
45  
46          // loads the default config from the META-INF jar folder
47          loadConfigFile("");
48          
49          //verify the components where loaded
50          for (int i = 0; i < COMPONENTS.length; i++) {
51              ComponentBean bean = standardConfigBean.getElement(((String[])COMPONENTS[i])[0]);
52              assertNotNull("component", bean);
53              assertEquals("component.jsfid",((String[])COMPONENTS[i])[0],  bean.getJsfid()); 
54              assertEquals("component.componentType", ((String[])COMPONENTS[i])[1], bean.getComponentType());
55          }
56  
57          //verify converters where loaded
58          for (int i = 0; i < CONVERTERS.length; i++) {
59              ComponentBean bean = standardConfigBean.getElement(((String[])CONVERTERS[i])[0]);
60              assertNotNull("converter", bean);
61              assertEquals("converter.jsfid", ((String[])CONVERTERS[i])[0], bean.getJsfid()); 
62              assertEquals("converter.componentType", ((String[])CONVERTERS[i])[1], bean.getComponentType());
63          }
64  
65          //verify validators where loaded 
66          for (int i = 0; i < VALIDATORS.length; i++) {
67              ComponentBean bean = standardConfigBean.getElement(((String[])VALIDATORS[i])[0]);
68              assertNotNull("validator", bean);
69              assertEquals("validator.jsfid", ((String[])VALIDATORS[i])[0], bean.getJsfid()); 
70              assertEquals("validator.componentType", ((String[])VALIDATORS[i])[1], bean.getComponentType());
71          }
72  
73      }
74  
75      //data that is used to verify the inheritance is working from the XML file.
76      //jsfid || id, componentType, facetName, allowBody, attributes[], 
77      //aggregates (converters, children, validators, actionListeners, valueChangeListeners)
78      protected static final Object[] CUSTOM_XML_COMPONENTS =  {
79               new Object[] {"street1Label","javax.faces.HtmlOutputLabel", null, "false", 
80                                  new Object[] {new String[] {"style", "color:blue"}, 
81                                                new String[] {"value", "Street 1:"},
82                                                new String[] {"for", "street1"}}
83                , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
84               },
85               new Object[] {"street1","javax.faces.HtmlOutputText", null, null, 
86                       new Object[] {new String[] {"size", "35"}, 
87                                     new String[] {"maxlength", "50"},
88                                     new String[] {"value", "#{@managed-bean-name.address1}"},  
89                                     new String[] {"required", "true"}}
90               , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
91               },  
92               new Object[] {"street1Message","javax.faces.HtmlMessage", null, "false", 
93                       new Object[] {new String[] {"style", "color:red"}, 
94                                     new String[] {"for", "street1"}}
95               , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
96               },   
97               new Object[] {"street2Label","javax.faces.HtmlOutputLabel", null, "false", 
98                       new Object[] {new String[] {"style", "color:blue"}, 
99                                     new String[] {"value", "Street 2:"},
100                                    new String[] {"for", "street2"}}
101              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
102              },
103              new Object[] {"street2","javax.faces.HtmlInputText", null, null, 
104                      new Object[] {new String[] {"size", "35"}, 
105                         new String[] {"maxlength", "50"},
106                         new String[] {"value", "#{@managed-bean-name.address2}"},  
107                         new String[] {"required", "true"}}
108              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
109              },  
110             new Object[] {"street2Message","javax.faces.HtmlMessage", null, "false", 
111                      new Object[] {new String[] {"style", "color:red"}, 
112                         new String[] {"for", "street2"}}
113             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                                  
114             },  
115             new Object[] {"zip","javax.faces.HtmlInputText", null, null, 
116                      new Object[] {new String[] {"size", "5"}, 
117                         new String[] {"maxlength", "9"},
118                         new String[] {"value", "#{@managed-bean-name.zip}"},  
119                         new String[] {"valueChangeListener", "#{@managed-bean-name.zipValueChange}"}}
120             , new Integer[] {new Integer(1), new Integer(0), new Integer(1), new Integer(0), new Integer(1)}                      
121             }, 
122             new Object[] {"integerConverter","javax.faces.Integer", null, null, 
123                      new Object[0]
124             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
125             },  
126             new Object[] {"longRangeValidator","javax.faces.LongRange", null, null, 
127                      new Object[] {new String[] {"minimum", "80000"}, 
128                         new String[] {"maximum", "80125"}}
129             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
130             },
131             new Object[] {"testValueChangeListener","org.apache.shale.clay.config.TestValueChangeListener", null, null, 
132                      new Object[0]
133             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                                         
134             },
135             new Object[] {"saveCommand","javax.faces.HtmlCommandButton", null, null, 
136                      new Object[] {new String[] {"value", "Save"}, 
137                         new String[] {"action", "#{@managed-bean-name.save}"},
138                         new String[] {"actionListener", "#{@managed-bean-name.saveAction}"}}  
139             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(1), new Integer(0)}                      
140              },
141             new Object[] {"testActionListener","org.apache.shale.clay.config.TestActionListener", null, null, 
142                      new Object[0]
143             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}                      
144             }  
145     };
146 
147     
148     //Data that is used to verify the inheritance is working from the HTML file.
149     //jsfid || id, componentType, facetName, allowBody, attributes[]
150     //aggregates (converters, children, validators, actionListeners, valueChangeListeners)
151     protected static final Object[] CUSTOM_HTML_COMPONENTS =  {
152              new Object[] {"street1Label","javax.faces.HtmlOutputLabel", null, "false", 
153                                 new Object[] {new String[] {"style", "color:blue"}, 
154                                               new String[] {"value", "Street 1:"},
155                                               new String[] {"for", "street1"}}
156              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
157              },
158              new Object[] {"street1","javax.faces.HtmlInputText", null, null, 
159                      new Object[] {new String[] {"size", "45"}, 
160                                    new String[] {"maxlength", "50"},
161                                    new String[] {"value", "#{@managed-bean-name.address1}"},  
162                                    new String[] {"required", "true"}}
163              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
164              },  
165              new Object[] {"street1Message","javax.faces.HtmlMessage", null, "false", 
166                      new Object[] {new String[] {"style", "color:red"}, 
167                                    new String[] {"for", "street1"}}
168              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
169              },   
170              new Object[] {"street2Label","javax.faces.HtmlOutputLabel", null, "false", 
171                      new Object[] {new String[] {"style", "color:blue"}, 
172                                    new String[] {"value", "Street 2:"},
173                                    new String[] {"for", "street2"}}
174              , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
175             },
176             new Object[] {"street2","javax.faces.HtmlInputText", null, null, 
177                      new Object[] {new String[] {"size", "45"}, 
178                         new String[] {"maxlength", "50"},
179                         new String[] {"value", "#{@managed-bean-name.address2}"},  
180                         new String[] {"required", "true"}}
181             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
182             },  
183             new Object[] {"street2Message","javax.faces.HtmlMessage", null, "false", 
184                      new Object[] {new String[] {"style", "color:red"}, 
185                         new String[] {"for", "street2"}}
186             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
187             },  
188             new Object[] {"zip","javax.faces.HtmlInputText", null, null, 
189                      new Object[] {new String[] {"size", "9"}, 
190                         new String[] {"maxlength", "9"},
191                         new String[] {"value", "#{@managed-bean-name.zip}"},  
192                         new String[] {"valueChangeListener", "#{@managed-bean-name.zipValueChange}"}}
193             , new Integer[] {new Integer(1), new Integer(0), new Integer(1), new Integer(0), new Integer(1)}
194             }, 
195             new Object[] {"integerConverter","javax.faces.Integer", null, null, 
196                      new Object[0]
197             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
198             },  
199             new Object[] {"longRangeValidator","javax.faces.LongRange", null, null, 
200                      new Object[] {new String[] {"minimum", "80000"}, 
201                         new String[] {"maximum", "80125"}}
202             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
203             },
204             new Object[] {"testValueChangeListener","org.apache.shale.clay.config.TestValueChangeListener", null, null, 
205                      new Object[0]
206             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
207             },
208             new Object[] {"saveCommand","javax.faces.HtmlCommandButton", null, null, 
209                      new Object[] {new String[] {"value", "Save"}, 
210                         new String[] {"action", "#{@managed-bean-name.save}"},
211                         new String[] {"actionListener", "#{@managed-bean-name.saveAction}"}}  
212             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(1), new Integer(0)}
213             },
214             new Object[] {"testActionListener","org.apache.shale.clay.config.TestActionListener", null, null, 
215               new Object[0]
216             , new Integer[] {new Integer(0), new Integer(0), new Integer(0), new Integer(0), new Integer(0)}
217             }  
218     };
219     
220     
221     
222     // loads the xml config files and validates a sample of 
223     // components state to the know good state.
224     public void testCustomConfigFile() {
225 
226         //loads the default and the custom address config files
227         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
228        
229         ComponentBean bean = standardConfigBean.getElement("agentAddressForm");
230         assertNotNull(bean);
231         
232         Iterator ci = bean.getChildrenIterator();
233         while (ci.hasNext()) {
234            ElementBean child = (ElementBean) ci.next();
235            //look for a component that we have setup to test
236            checkComponent(child, CUSTOM_XML_COMPONENTS, true);    
237         }
238     }
239     
240     
241     // loads the HTML document fragment into a graph of
242     // shale meta component data and validates the select
243     // sample to the known good state
244     public void testLoadHTMLFile() {
245 
246         //loads the default and the custom address config file
247         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
248 
249         ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address2.html"); 
250         assertNotNull(bean);
251 
252         Iterator ci = bean.getChildrenIterator();
253         while (ci.hasNext()) {
254            ElementBean child = (ElementBean) ci.next();
255            //look for a component that we have setup to test
256            checkComponent(child, CUSTOM_HTML_COMPONENTS, true);    
257         } 
258         
259     }
260 
261     
262     // loads the XHTML document fragment into a graph of
263     // shale meta component data and validates the select
264     // sample to the known good state
265     public void testLoadXHTMLNamespaceFile1() {
266 
267         //loads the default and the custom address config file
268         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
269 
270         ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address1.html"); 
271         assertNotNull(bean);
272 
273         Iterator ci = bean.getChildrenIterator();
274         while (ci.hasNext()) {
275            ElementBean child = (ElementBean) ci.next();
276            //look for a component that we have setup to test
277            checkComponent(child, CUSTOM_HTML_COMPONENTS, true);    
278         } 
279         
280     }
281 
282     // loads the XHTML document fragment into a graph of
283     // shale meta component data and validates the select
284     // sample to the known good state
285     public void testLoadXHTMLNamespaceFile3() {
286 
287         //loads the default and the custom address config file
288         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
289 
290         ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address3.html"); 
291         assertNotNull(bean);
292 
293         Iterator ci = bean.getChildrenIterator();
294         while (ci.hasNext()) {
295            ElementBean child = (ElementBean) ci.next();
296            //look for a component that we have setup to test
297            checkComponent(child, CUSTOM_HTML_COMPONENTS, true);    
298         } 
299         
300     }
301     
302     public void testLoadXHTMLJsfHtmlCore4() {
303 
304         //loads the default and the custom address config file
305         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
306 
307         ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address4.html"); 
308         assertNotNull(bean);
309 
310         Iterator ci = bean.getChildrenIterator();
311         while (ci.hasNext()) {
312            ElementBean child = (ElementBean) ci.next();
313            //look for a component that we have setup to test
314            checkComponent(child, CUSTOM_HTML_COMPONENTS, true);    
315         } 
316         
317     }
318 
319     public void testLoadXHTMLJsfHtmlCore5() {
320 
321         //loads the default and the custom address config file
322         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
323 
324         ComponentBean bean = htmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address5.html"); 
325         assertNotNull(bean);
326 
327         Iterator ci = bean.getChildrenIterator();
328         while (ci.hasNext()) {
329            ElementBean child = (ElementBean) ci.next();
330            //look for a component that we have setup to test
331            checkComponent(child, CUSTOM_HTML_COMPONENTS, false);    
332         } 
333         
334     }
335 
336     
337     
338     //test a full xml view including a html template (on-demand)
339     public void testLoadXMLFileOnDemand() {
340         
341         //loads the default and the custom address config file
342         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
343         
344         ComponentBean bean = xmlTemplateConfigBean.getElement("/org/apache/shale/clay/config/address.xml"); 
345         assertNotNull(bean);
346         
347         Iterator ci = bean.getChildrenIterator();
348         while (ci.hasNext()) {
349             ElementBean child = (ElementBean) ci.next();
350             
351             AttributeBean attr = null;
352             if (child.getId().equals("htmlBegin")) {
353                 attr = child.getAttribute("value");
354                 assertEquals("<html>", attr.getValue());
355             } else if (child.getId().equals("htmlEnd")) {
356                 attr = child.getAttribute("value");
357                 assertEquals("</html>", attr.getValue());
358             } else if (child.getId().equals("header")) {
359                 attr = child.getAttribute("value");
360                 assertEquals("<head><title>Testing</title></head>", attr.getValue());
361             } else if (child.getId().equals("bodyBegin")) {
362                 attr = child.getAttribute("value");
363                 assertEquals("<body>", attr.getValue());
364             } else if (child.getId().equals("bodyEnd")) {
365                 attr = child.getAttribute("value");
366                 assertEquals("</body>", attr.getValue());
367             } else if (child.getId().equals("content")) {
368                 //look for a component that we have setup to test
369                 checkComponent(child, CUSTOM_HTML_COMPONENTS, true); 
370             }
371         } 
372     }
373    
374     
375     //test a full xml view centralized config loaded on startup that 
376     //includes a html template (global template file)
377     public void testLoadXMLFileGlobal() {
378         
379         // loads the default and the custom address config file.
380         // loads a centralized full view config file.   
381         loadConfigFiles("/org/apache/shale/clay/config/address-config.xml", 
382                         "/org/apache/shale/clay/config/address-fullxml.xml");
383         
384         //loaded on startup, this call will just retrieve a loaded definitions
385         //the jsfid doesn't match the name of the config file, a requirement
386         //for on-demand full xml views
387         ComponentBean bean = xmlTemplateConfigBean.getElement("/address2.xml"); 
388         assertNotNull(bean);
389         
390         Iterator ci = bean.getChildrenIterator();
391         while (ci.hasNext()) {
392             ElementBean child = (ElementBean) ci.next();
393             
394             AttributeBean attr = null;
395             if (child.getId().equals("htmlBegin")) {
396                 attr = child.getAttribute("value");
397                 assertEquals("<html>", attr.getValue());
398             } else if (child.getId().equals("htmlEnd")) {
399                 attr = child.getAttribute("value");
400                 assertEquals("</html>", attr.getValue());
401             } else if (child.getId().equals("header")) {
402                 attr = child.getAttribute("value");
403                 assertEquals("<head><title>Testing</title></head>", attr.getValue());
404             } else if (child.getId().equals("bodyBegin")) {
405                 attr = child.getAttribute("value");
406                 assertEquals("<body>", attr.getValue());
407             } else if (child.getId().equals("bodyEnd")) {
408                 attr = child.getAttribute("value");
409                 assertEquals("</body>", attr.getValue());
410             } else if (child.getId().equals("content")) {
411                 //look for a component that we have setup to test
412                 checkComponent(child, CUSTOM_HTML_COMPONENTS, true); 
413             }
414         } 
415         
416     }
417     
418  
419     // checks a meta components realized state against the assumed values
420     protected void checkComponent(ComponentBean bean, Object[] knownGoodStates, boolean useJsfid) {
421        
422        String sarg = null;
423        int indx = -1;
424        if (useJsfid)
425           sarg = bean.getJsfid();
426        else
427           sarg = bean.getId();
428           
429        indx = indexOf(sarg, knownGoodStates);
430              
431        int converterCnt = -1;
432        int childrenCnt = -1;
433        int validatorCnt = -1;
434        int actionListenerCnt = -1;
435        int valueChangeListenerCnt = -1;
436        
437        
438        if (indx > -1) {
439             Object[] compData = (Object[]) knownGoodStates[indx];
440             
441             
442             if (useJsfid) {
443                String jsfid = (String) compData[0];
444                assertEquals("check.jsfid for" + sarg, jsfid, bean.getJsfid());
445             } else {
446                 String id = (String) compData[0];
447                 assertEquals("check.id for " + sarg, id, bean.getId());                
448             }
449 
450             String componentType = (String) compData[1];
451             assertEquals("check.componentType for " + sarg, componentType, bean.getComponentType());
452 
453             String facetName = (String) compData[2];
454             assertEquals("check.facetName for " + sarg, facetName, bean.getFacetName());
455 
456             String allowBody = (String) compData[3];
457             assertEquals("check.allowBody for " + sarg, allowBody, bean.getAllowBody());
458 
459             Object[] attributes = (Object[]) compData[4];
460             for (int i = 0; i < attributes.length; i++) {
461                 String[] valuepair = (String[]) attributes[i];
462 
463                 AttributeBean attr = bean.getAttribute(valuepair[0]);
464                 assertNotNull("check.attribute for " + sarg, attr);
465                 //System.out.println("\t" + attr.toString());
466                 assertEquals("check.attribute.value for " + sarg, valuepair[1], attr.getValue());
467             }
468             
469             // the know aggregate object counts
470             Integer[] aggregateCnts = (Integer[]) compData[5];
471             converterCnt = aggregateCnts[0].intValue();
472             childrenCnt = aggregateCnts[1].intValue();
473             validatorCnt = aggregateCnts[2].intValue();
474             actionListenerCnt = aggregateCnts[3].intValue();
475             valueChangeListenerCnt = aggregateCnts[4].intValue();
476 
477         }
478        
479         if (bean.getConverter() !=  null) {
480             if (converterCnt > -1)
481                assertEquals("check.converter.cnt for " + sarg, 1, converterCnt);
482             
483             checkComponent(bean.getConverter(), knownGoodStates, useJsfid);    
484         }
485         
486         if (childrenCnt > -1) {
487            assertEquals("check.children.cnt for " + sarg, childrenCnt, bean.getChildren().size());    
488         }
489         
490         Iterator ci = bean.getChildrenIterator();
491         while (ci.hasNext()) {
492            ComponentBean child = (ComponentBean) ci.next();
493            checkComponent(child, knownGoodStates, useJsfid);
494         }
495 
496         if (validatorCnt > -1) {
497             assertEquals("check.validator.cnt for " + sarg, validatorCnt, bean.getValidators().size());    
498         }
499         
500         ci = bean.getValidatorIterator();
501         while (ci.hasNext()) {
502            ComponentBean child = (ComponentBean) ci.next();
503            checkComponent(child, knownGoodStates, useJsfid);
504         }
505 
506         if (actionListenerCnt > -1) {
507             assertEquals("check.actionListener.cnt for " + sarg, actionListenerCnt, bean.getActionListeners().size());    
508         }
509         
510         ci = bean.getActionListenerIterator();
511         while (ci.hasNext()) {
512            ComponentBean child = (ComponentBean) ci.next();
513            checkComponent(child, knownGoodStates, useJsfid);
514         }
515 
516         if (valueChangeListenerCnt > -1) {
517             assertEquals("check.valueChangeListener.cnt for " + sarg, valueChangeListenerCnt, bean.getValueChangeListeners().size());    
518         }
519                
520         ci = bean.getValueChangeListenerIterator();
521         while (ci.hasNext()) {
522            ComponentBean child = (ComponentBean) ci.next();
523            checkComponent(child, knownGoodStates, useJsfid);
524         }
525 
526     }
527     
528     // looks to see if there is a state check for the components
529     protected int indexOf(String jsfid, Object[] knownGoodStates) {
530          for (int i = 0; i < knownGoodStates.length; i++) {
531              Object[] compData = (Object[]) knownGoodStates[i];
532              String id = (String) compData[0];
533              if (id.equals(jsfid)) {
534                 return i;   
535              }
536          }
537         return -1;
538     }
539    
540         
541     // test duplicate id check
542     public void testDuplicateComponentIds() {
543         
544         // loads the default and the custom address config file
545         loadConfigFile("/org/apache/shale/clay/config/address-config.xml");
546         
547         try {
548             ComponentBean bean = htmlTemplateConfigBean.getElement("org/apache/shale/clay/config/duplicate1.html");
549             assertTrue("Duplicate component check", false);
550         } catch (RuntimeException e) {
551             assertTrue(
552                     "Duplicate component check",
553                     e.getMessage().startsWith("A duplicate component id (street1) was found within the same naming container"));
554         }
555         
556         
557         ComponentBean bean = htmlTemplateConfigBean.getElement("org/apache/shale/clay/config/duplicate2.html");
558         assertNotNull("Duplicate component check", bean);
559         
560         
561     } 
562        
563 
564     
565 }