Author: hboutemy Date: Mon Nov 1 09:48:23 2010 New Revision: 1029586 URL: http://svn.apache.org/viewvc?rev=1029586&view=rev Log: [ARCHETYPE-341] allow content in source or resource elements of archetype.xsd
Added: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java (with props) maven/archetype/trunk/archetype-common/src/test/resources/org/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml (with props) Modified: maven/archetype/trunk/archetype-common/pom.xml maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilderTest.java Modified: maven/archetype/trunk/archetype-common/pom.xml URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/pom.xml?rev=1029586&r1=1029585&r2=1029586&view=diff ============================================================================== --- maven/archetype/trunk/archetype-common/pom.xml (original) +++ maven/archetype/trunk/archetype-common/pom.xml Mon Nov 1 09:48:23 2010 @@ -177,6 +177,7 @@ under the License. <goal>java</goal> <goal>xpp3-reader</goal> <goal>xpp3-writer</goal> + <goal>xsd</goal> </goals> </execution> <execution> Modified: maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo?rev=1029586&r1=1029585&r2=1029586&view=diff ============================================================================== --- maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo (original) +++ maven/archetype/trunk/archetype-common/src/main/mdo/archetype.mdo Mon Nov 1 09:48:23 2010 @@ -2,8 +2,8 @@ <!-- START SNIPPET: modello-model --> -<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd" +<model xmlns="http://modello.codehaus.org/MODELLO/1.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.4.0 http://modello.codehaus.org/xsd/modello-1.4.0.xsd" xml.namespace="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/${version}" xml.schemaLocation="http://maven.apache.org/xsd/archetype-${version}.xsd"> <id>archetype</id> @@ -98,6 +98,12 @@ can be non-filtered.</description> <version>1.0.0</version> <fields> + <field xml.content="true"> + <name>file</name> + <version>1.0.0</version> + <type>String</type> + <description><![CDATA[The source file.]]></description> + </field> <field xml.attribute="true"> <name>encoding</name> <version>1.0.0</version> @@ -112,6 +118,12 @@ <description>Describes a resource file.</description> <version>1.0.0</version> <fields> + <field xml.content="true"> + <name>file</name> + <version>1.0.0</version> + <type>String</type> + <description><![CDATA[The resource file.]]></description> + </field> <field xml.attribute="true"> <name>encoding</name> <version>1.0.0</version> Modified: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilderTest.java URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilderTest.java?rev=1029586&r1=1029585&r2=1029586&view=diff ============================================================================== --- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilderTest.java (original) +++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeDescriptorBuilderTest.java Mon Nov 1 09:48:23 2010 @@ -1,19 +1,22 @@ package org.apache.maven.archetype.old.descriptor; /* - * Copyright 2004-2006 The Apache Software Foundation. + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ import junit.framework.Test; Added: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java?rev=1029586&view=auto ============================================================================== --- maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java (added) +++ maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java Mon Nov 1 09:48:23 2010 @@ -0,0 +1,70 @@ +package org.apache.maven.archetype.old.descriptor; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.codehaus.plexus.PlexusTestCase; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + + +public class ArchetypeXsdTest + extends PlexusTestCase +{ + private static final String ARCHETYPE_XSD = "archetype-1.0.0.xsd"; + + public void testXsd() + throws Exception + { + File archetypeXsd = new File( getBasedir(), "/target/generated-site/xsd/" + ARCHETYPE_XSD ); + + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setValidating( true ); + factory.setNamespaceAware( true ); + SAXParser saxParser = factory.newSAXParser(); + saxParser.setProperty( "http://java.sun.com/xml/jaxp/properties/schemaLanguage", + "http://www.w3.org/2001/XMLSchema" ); + saxParser.setProperty( "http://java.sun.com/xml/jaxp/properties/schemaSource", archetypeXsd ); + + saxParser.parse( new InputSource( getClass().getResourceAsStream( "sample-archetype.xml" ) ), new Handler() ); + } + + private static class Handler + extends DefaultHandler + { + public void warning ( SAXParseException e ) + throws SAXException + { + throw e; + } + + public void error ( SAXParseException e ) + throws SAXException + { + throw e; + } + } +} Propchange: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/old/descriptor/ArchetypeXsdTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml URL: http://svn.apache.org/viewvc/maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml?rev=1029586&view=auto ============================================================================== --- maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml (added) +++ maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml Mon Nov 1 09:48:23 2010 @@ -0,0 +1,36 @@ +<?xml version="1.0"?> + +<archetype xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype/1.0.0 http://maven.apache.org/xsd/archetype-1.0.0.xsd"> + <id>standard</id> + <allowPartial>true</allowPartial> + + <sources> + <source>source0</source> + <source encoding="utf-8">source1</source> + </sources> + <resources> + <resource>resource0</resource> + <resource filtered="false">resource1</resource> + <resource encoding="iso-8859-1">resource2</resource> + <resource encoding="iso-8859-1" filtered="true">resource3</resource> + </resources> + + <testSources> + <source>testSource0</source> + <source encoding="utf-8">testSource1</source> + </testSources> + <testResources> + <resource>testResource0</resource> + <resource filtered="false">testResource1</resource> + <resource encoding="iso-8859-1">testResource2</resource> + <resource encoding="iso-8859-1" filtered="true">testResource3</resource> + </testResources> + + <siteResources> + <resource>siteResource0</resource> + <resource filtered="false">siteResource1</resource> + <resource encoding="utf-16">siteResource2</resource> + <resource encoding="utf-16" filtered="true">siteResource3</resource> + </siteResources> +</archetype> Propchange: maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: maven/archetype/trunk/archetype-common/src/test/resources/org/apache/maven/archetype/old/descriptor/sample-archetype.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain