Changeset 2011
- Timestamp:
- 07/06/12 11:00:54 (12 years ago)
- Location:
- ComponentRegistry/trunk/CMDValidate
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/CMDValidate/pom.xml
r2010 r2011 3 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4 4 <modelVersion>4.0.0</modelVersion> 5 <parent>6 <groupId>clarin.cmdi</groupId>7 <artifactId>componentRegistry.parent</artifactId>8 <version>1.0</version>9 </parent>10 5 <groupId>clarin.cmdi</groupId> 11 6 <artifactId>cmd-validate</artifactId> -
ComponentRegistry/trunk/CMDValidate/src/test/java/clarin/cmdi/schema/cmd/TestCMDValidate.java
r1859 r2011 45 45 46 46 @Test 47 public void valid () throws Exception {47 public void valid_0() throws Exception { 48 48 assertTrue(validate("CLARINWebService.xml")); 49 49 assertEquals(0, cmdValidator.getMessages().size()); … … 140 140 assertNotNull(message.text); 141 141 } 142 143 @Test 144 public void valid_8() throws Exception { 145 assertTrue(validate("CLARINWebService_warn-8.xml")); 146 147 final List<Message> messages = cmdValidator.getMessages(); 148 assertEquals(2, messages.size()); 149 Message message = messages.get(0); 150 assertFalse(message.error); 151 assertEquals("/CMD_ComponentSpec[1]/CMD_Component[1]",message.location); 152 assertNotNull(message.test); 153 assertEquals("A nested component or element has the same name ('Service') as this component! Please, consider to rename one of them.",message.text); 154 message = messages.get(1); 155 assertFalse(message.error); 156 assertEquals("/CMD_ComponentSpec[1]/CMD_Component[1]/CMD_Component[1]/AttributeList[1]/Attribute[1]",message.location); 157 assertNotNull(message.test); 158 assertEquals("An attribute has the same name ('Service') as its element or component! Please, consider to rename one of them.",message.text); 159 } 142 160 } -
ComponentRegistry/trunk/CMDValidate/src/test/resources/schema/general-component-schema.xsd
r1877 r2011 38 38 <xs:annotation> 39 39 <xs:appinfo> 40 <sch:pattern id="c omponent" name="CMD component group">40 <sch:pattern id="c_sibs" name="Check siblings"> 41 41 <sch:rule context="CMD_Component|CMD_Element"> 42 42 <sch:assert test="empty(preceding-sibling::*[@name=current()/@name])">Sibling components or elements should all have a different name. Found multiple components or elements named '<sch:value-of select="@name"/>'!</sch:assert> 43 </sch:rule> 44 </sch:pattern> 45 <sch:pattern id="c_nest" name="Check nesting"> 46 <sch:rule context="CMD_Component[exists(CMD_Component|CMD_Element)]" role="warning"> 47 <sch:assert test="empty((CMD_Component|CMD_Element)[@name=current()/@name])">A nested component or element has the same name ('<sch:value-of select="@name"/>') as this component! Please, consider to rename one of them.</sch:assert> 43 48 </sch:rule> 44 49 </sch:pattern> … … 99 104 <xs:annotation> 100 105 <xs:appinfo> 101 <sch:pattern id="attribute" name="CMD attribute"> 106 <sch:pattern id="a_res" name="Check reserved attribute names"> 107 <sch:rule context="Attribute"> 108 <sch:assert test="not(Name=('ref','ComponentId'))">Attribute name shouldn't be 'ref' or 'ComponentId', as these are used internally by CMD!</sch:assert> 109 </sch:rule> 110 </sch:pattern> 111 <sch:pattern id="a_sibs" name="Check attribute siblings"> 102 112 <sch:rule context="Attribute"> 103 113 <sch:assert test="empty(preceding-sibling::Attribute[Name=current()/Name])">All attributes in an attribute list should have a different name. Found multiple attributes named '<sch:value-of select="Name"/>'!</sch:assert> 104 <sch:assert test="not(Name=('ref','ComponentId'))">Attribute name shouldn't be 'ref' or 'ComponentId', as these are used internally by CMD!</sch:assert> 114 </sch:rule> 115 </sch:pattern> 116 <sch:pattern id="a_nest" name="Check attribute nesting"> 117 <sch:rule context="Attribute" role="warning"> 118 <sch:assert test="empty((ancestor::CMD_Component|ancestor::CMD_Element)[1][@name=current()/Name])">An attribute has the same name ('<sch:value-of select="Name"/>') as its element or component! Please, consider to rename one of them.</sch:assert> 105 119 </sch:rule> 106 120 </sch:pattern>
Note: See TracChangeset
for help on using the changeset viewer.