Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 91660 invoked from network); 24 Feb 2010 19:33:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Feb 2010 19:33:45 -0000 Received: (qmail 20597 invoked by uid 500); 24 Feb 2010 19:33:45 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 20569 invoked by uid 500); 24 Feb 2010 19:33:45 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 20558 invoked by uid 500); 24 Feb 2010 19:33:45 -0000 Received: (qmail 20555 invoked by uid 99); 24 Feb 2010 19:33:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 19:33:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 19:33:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B9E6723888E7; Wed, 24 Feb 2010 19:33:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r915943 - in /db/torque/torque4/trunk/torque-generator/src: main/java/org/apache/torque/gf/configuration/controller/ main/java/org/apache/torque/gf/file/ main/java/org/apache/torque/gf/source/ main/resources/org/apache/torque/gf/configurati... Date: Wed, 24 Feb 2010 19:33:20 -0000 To: torque-commits@db.apache.org From: tfischer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100224193320.B9E6723888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tfischer Date: Wed Feb 24 19:33:20 2010 New Revision: 915943 URL: http://svn.apache.org/viewvc?rev=915943&view=rev Log: changed configuration xsd such that several source file includes and excludes can be specified for one output Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceConfigurationTags.java db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceSaxHandler.java db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/source/FileSourcesImpl.java db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/gf/configuration/configuration.xsd db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf-parent/conf/control.xml db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf/conf/control.xml db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gf/conf/control.xml db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/configuration/ReadConfigurationTest.java db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/file/FilesetTest.java db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gf/conf/control.xml db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gf/conf/control.xml Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceConfigurationTags.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceConfigurationTags.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceConfigurationTags.java (original) +++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceConfigurationTags.java Wed Feb 24 19:33:20 2010 @@ -37,9 +37,6 @@ /** Attribute name for the "type" attribute. */ public static final String TYPE_ATTRIBUTE = "type"; - /** Attribute name for the "path" attribute. */ - public static final String PATH_ATTRIBUTE = "path"; - /** Attribute name for the "elements" attribute. */ public static final String ELEMENTS_ATTRIBUTE = "elements"; @@ -51,4 +48,11 @@ /** Tag name for the "class" attribute of the "transformer" tag. */ public static final String TRANSFORMER_CLASS_ATTRIBUTE = "class"; + + /** Tag name for the "transformer" tag. */ + public static final String INCLUDE_TAG = "include"; + + /** Tag name for the "transformer" tag. */ + public static final String EXCLUDE_TAG = "exclude"; + } Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceSaxHandler.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceSaxHandler.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceSaxHandler.java (original) +++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/SourceSaxHandler.java Wed Feb 24 19:33:20 2010 @@ -20,13 +20,15 @@ */ import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.ELEMENTS_ATTRIBUTE; -import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.PATH_ATTRIBUTE; import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.SOURCE_FILTER_ATTRIBUTE; import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.SOURCE_TAG; import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.TRANSFORMER_TAG; import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.TYPE_ATTRIBUTE; +import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.INCLUDE_TAG; +import static org.apache.torque.gf.configuration.controller.SourceConfigurationTags.EXCLUDE_TAG; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -34,6 +36,7 @@ import org.apache.torque.gf.configuration.ConfigurationHandlers; import org.apache.torque.gf.configuration.ConfigurationProvider; import org.apache.torque.gf.configuration.paths.ProjectPaths; +import org.apache.torque.gf.file.Fileset; import org.apache.torque.gf.source.FileSourcesImpl; import org.apache.torque.gf.source.SourceType; import org.apache.torque.gf.source.Sources; @@ -59,8 +62,17 @@ /** The file type of the sources element which is currently parsed. */ private String type; - /** The file path of the sources element which is currently parsed. */ - private String path; + /** The source file names which should be included in generation. */ + private Set includes = new HashSet(); + + /** The source file names which should be excluded from generation. */ + private Set excludes = new HashSet(); + + /** Whether an include tag is currently parsed. */ + private boolean inInclude = false; + + /** Whether an exclude tag is currently parsed. */ + private boolean inExclude = false; /** * The start elements path of the sources element @@ -149,15 +161,17 @@ else if (rawName.equals(SOURCE_TAG)) { type = attributes.getValue(TYPE_ATTRIBUTE); - path = attributes.getValue(PATH_ATTRIBUTE); - if (path == null) - { - throw new SAXException( - "path must not be null for source"); - } startElementsPath = attributes.getValue(ELEMENTS_ATTRIBUTE); sourceFilter = attributes.getValue(SOURCE_FILTER_ATTRIBUTE); } + else if (rawName.equals(INCLUDE_TAG)) + { + inInclude = true; + } + else if (rawName.equals(EXCLUDE_TAG)) + { + inExclude = true; + } else { throw new SAXException("Unknown element " + rawName); @@ -185,6 +199,14 @@ transformerSaxHandler = null; } } + else if (rawName.equals(INCLUDE_TAG)) + { + inInclude = false; + } + else if (rawName.equals(EXCLUDE_TAG)) + { + inExclude = false; + } else if (rawName.equals(SOURCE_TAG)) { try @@ -208,14 +230,17 @@ + " Known types are: " + sourceTypes); } } + Fileset fileset = new Fileset( + projectPaths.getDefaultSourcePath(), + includes, + excludes); sources = new FileSourcesImpl( sourceType, - path, + fileset, startElementsPath, sourceFilter, transformerDefinitions, - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); } catch (ConfigurationException e) { @@ -238,6 +263,24 @@ { transformerSaxHandler.characters(ch, start, length); } + else if (inInclude) + { + StringBuilder include = new StringBuilder(); + for (int i = start; i < start + length; ++i) + { + include.append(ch[i]); + } + includes.add(include.toString()); + } + else if (inExclude) + { + StringBuilder exclude = new StringBuilder(); + for (int i = start; i < start + length; ++i) + { + exclude.append(ch[i]); + } + excludes.add(exclude.toString()); + } } /** Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java (original) +++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/file/Fileset.java Wed Feb 24 19:33:20 2010 @@ -141,7 +141,7 @@ public List getFiles() throws IOException { List result = new ArrayList(); - if (includes == null) + if (includes == null || includes.isEmpty()) { getAllFiles(basedir, result); return result; @@ -405,4 +405,12 @@ } return normalizedParts; } + + @Override + public String toString() + { + return "Fileset [basedir=" + basedir + + ", excludes=" + excludes + + ", includes=" + includes + "]"; + } } Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/source/FileSourcesImpl.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/source/FileSourcesImpl.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/source/FileSourcesImpl.java (original) +++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/source/FileSourcesImpl.java Wed Feb 24 19:33:20 2010 @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -46,10 +45,8 @@ */ private SourceType type; - /** - * The path to the file(s). - */ - private String path; + /** The fileset defining the source files. */ + private Fileset sourceFileset; /** The paths of all contained Files. */ private List paths; @@ -67,14 +64,12 @@ * * @param type the source type, or null if the source type should * be determined from the file extension. - * @param path the path to the file(s) to read, not null. + * @param sourceFileset the fileset defining the source files, not null. * @param elements the path to the source elements to read, or null * if the root element should be used. * @param sourceFilter the fully qualified class name of the source filter, * or null. The referenced class must have a standard constructor. * @param configurationHandlers All known configuration handlers, not null. - * @param sourcesDir The directory where the sources should be read from, - * not null. * * @throws IllegalArgumentException if the source type is unknown. * @throws NullPointerException if path is null. @@ -83,41 +78,30 @@ */ public FileSourcesImpl( SourceType type, - String path, + Fileset sourceFileset, String elements, String sourceFilter, List transformerDefinitions, - ConfigurationHandlers configurationHandlers, - File sourcesDir) + ConfigurationHandlers configurationHandlers) throws ConfigurationException { super(elements, sourceFilter, transformerDefinitions); - if (path == null) + if (sourceFileset == null) { - throw new NullPointerException("path must not be null"); + throw new NullPointerException("sourceFileset must not be null"); } if (configurationHandlers == null) { throw new NullPointerException( "configurationHandlers must not be null"); } - if (sourcesDir == null) - { - throw new NullPointerException("sourcesDir must not be null"); - } this.type = type; - this.path = path; + this.sourceFileset = sourceFileset; this.configurationHandlers = configurationHandlers; - Fileset fileset = new Fileset(); - fileset.setBasedir(sourcesDir); - Set includes = new HashSet(); - includes.add(path); - fileset.setIncludes(includes); - try { - paths = fileset.getFiles(); + paths = sourceFileset.getFiles(); } catch (IOException e) { @@ -181,7 +165,7 @@ public String toString() { StringBuffer result = new StringBuffer(); - result.append("(path=").append(path) + result.append("(sourceFileset=").append(sourceFileset) .append(",type=").append(type) .append(",sourceFilter=").append(getSourceFilter()) .append(",startElementsPath=").append(getStartElementsPath()) @@ -195,10 +179,45 @@ { return type; } + + /** + * Returns all included source file patterns, or null or an empty set + * if all files are included. + * + * @return all included file patterns, or null. + */ + public Set getIncludes() + { + if (sourceFileset.getIncludes() == null) + { + return null; + } + return Collections.unmodifiableSet(sourceFileset.getIncludes()); + } - public String getPath() + /** + * Returns all excluded source file patterns, or null or an empty set + * if no files are excluded. + * + * @return all excluded file patterns, or null. + */ + public Set getExcludes() + { + if (sourceFileset.getExcludes() == null) + { + return null; + } + return Collections.unmodifiableSet(sourceFileset.getExcludes()); + } + + /** + * Returns the base directory for the source files. + * + * @return the base directory for the source files, or null. + */ + public File getBasedir() { - return path; + return sourceFileset.getBasedir(); } public List getPaths() Modified: db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/gf/configuration/configuration.xsd URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/gf/configuration/configuration.xsd?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/gf/configuration/configuration.xsd (original) +++ db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/gf/configuration/configuration.xsd Wed Feb 24 19:33:20 2010 @@ -101,12 +101,22 @@ - + - + + - - + + + + + + + + + + + Modified: db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf-parent/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf-parent/conf/control.xml?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf-parent/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf-parent/conf/control.xml Wed Feb 24 19:33:20 2010 @@ -30,12 +30,17 @@ ParentFoo ParentBar - + + parentSource + - + + secondParentSource + secondParentExclude + Modified: db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf/conf/control.xml?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gf/conf/control.xml Wed Feb 24 19:33:20 2010 @@ -30,16 +30,22 @@ Foo Bar - + - + + second.source.path.properties + second.excluded.properties + - + + third.source.path.properties + third.excluded.properties + Modified: db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gf/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gf/conf/control.xml?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gf/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gf/conf/control.xml Wed Feb 24 19:33:20 2010 @@ -23,7 +23,9 @@ xsi:schemaLocation="http://db.apache.org/torque/gf/4.0/configuration http://db.apache.org/torque/gf/4.0/configuration.xsd" xmlns="http://db.apache.org/torque/gf/4.0/configuration"> - + + source.xml + Modified: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/configuration/ReadConfigurationTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/configuration/ReadConfigurationTest.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/configuration/ReadConfigurationTest.java (original) +++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/configuration/ReadConfigurationTest.java Wed Feb 24 19:33:20 2010 @@ -28,8 +28,10 @@ import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.torque.gf.BaseTest; @@ -48,6 +50,7 @@ import org.apache.torque.gf.control.action.ApplyAction; import org.apache.torque.gf.control.action.MergepointAction; import org.apache.torque.gf.control.action.TraverseAllAction; +import org.apache.torque.gf.file.Fileset; import org.apache.torque.gf.generator.Generator; import org.apache.torque.gf.java.JavaGenerator; import org.apache.torque.gf.option.Option; @@ -196,14 +199,17 @@ } { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + new HashSet(), + new HashSet()); FileSourcesImpl sources = new FileSourcesImpl( new XmlSourceType(), - "source", + sourceFileset, null, null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -252,14 +258,17 @@ } { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + createSetFrom("second.source.path.properties"), + createSetFrom("second.excluded.properties")); FileSourcesImpl sources = new FileSourcesImpl( new PropertiesSourceType(), - "secondSourcePath", + sourceFileset, "properties/entry", null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -286,14 +295,17 @@ assertFalse(outputFile.isSkipIfExists()); { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + createSetFrom("third.source.path.properties"), + createSetFrom("third.excluded.properties")); FileSourcesImpl sources = new FileSourcesImpl( null, - "third.source.path.properties", + sourceFileset, null, null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -613,14 +625,17 @@ } { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + createSetFrom("parentSource"), + new HashSet()); FileSourcesImpl sources = new FileSourcesImpl( new XmlSourceType(), - "parentSource", + sourceFileset, null, null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -656,14 +671,17 @@ } { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + new HashSet(), + new HashSet()); FileSourcesImpl sources = new FileSourcesImpl( new XmlSourceType(), - "source", + sourceFileset, null, null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -708,14 +726,17 @@ } { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + createSetFrom("second.source.path.properties"), + createSetFrom("second.excluded.properties")); FileSourcesImpl sources = new FileSourcesImpl( new PropertiesSourceType(), - "secondSourcePath", + sourceFileset, "properties/entry", null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -739,14 +760,17 @@ assertEquals("outputFileName", outputFile.getFilename()); assertNull(outputFile.getFilenameGenerator()); { + Fileset sourceFileset = new Fileset( + projectPaths.getDefaultSourcePath(), + createSetFrom("third.source.path.properties"), + createSetFrom("third.excluded.properties")); FileSourcesImpl sources = new FileSourcesImpl( null, - "third.source.path.properties", + sourceFileset, null, null, new ArrayList(), - configurationHandlers, - projectPaths.getDefaultSourcePath()); + configurationHandlers); assertSourcesEquals( sources, (FileSourcesImpl) outputFile.getSources()); @@ -872,10 +896,33 @@ expected.getType(), actual.getType()); assertEquals( - expected.getPath(), - actual.getPath()); + expected.getIncludes(), + actual.getIncludes()); + assertEquals( + expected.getExcludes(), + actual.getExcludes()); + assertEquals( + expected.getBasedir(), + actual.getBasedir()); assertEquals( expected.getPaths(), actual.getPaths()); } + + /** + * Creates as set containing the Strings in content. + * + * @param content The Strings which should be in the set. + * + * @return the Set containing all the strings. + */ + private static Set createSetFrom(String... content) + { + Set result = new HashSet(); + for (String part : content) + { + result.add(part); + } + return result; + } } Modified: db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/file/FilesetTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/file/FilesetTest.java?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/file/FilesetTest.java (original) +++ db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/gf/file/FilesetTest.java Wed Feb 24 19:33:20 2010 @@ -123,7 +123,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("1.properties"), + createSetFrom("1.properties"), null); assertFileListEquals( fileset, @@ -135,7 +135,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/2.properties"), + createSetFrom("subfolder/2.properties"), null); assertFileListEquals( fileset, @@ -147,7 +147,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/subsubfolder\\3.properties"), + createSetFrom("subfolder/subsubfolder\\3.properties"), null); assertFileListEquals( fileset, @@ -159,7 +159,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("*//2.properties"), + createSetFrom("*//2.properties"), null); assertFileListEquals( fileset, @@ -171,7 +171,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("?.properties"), + createSetFrom("?.properties"), null); assertFileListEquals( fileset, @@ -183,7 +183,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("*.properties"), + createSetFrom("*.properties"), null); assertFileListEquals( fileset, @@ -196,7 +196,7 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/../1.properties"), + createSetFrom("subfolder/../1.properties"), null); assertFileListEquals( fileset, @@ -208,7 +208,7 @@ { Fileset fileset = new Fileset( new File(TEST_BASE_DIR, "subfolder"), - getSetWith("../1.properties"), + createSetFrom("../1.properties"), null); assertFileListEquals( fileset, @@ -222,7 +222,7 @@ * * @return the Set containing all the strings. */ - private static Set getSetWith(String... content) + private static Set createSetFrom(String... content) { Set result = new HashSet(); for (String part : content) @@ -259,12 +259,37 @@ } @Test + public void testFilelistAllEmpty() throws IOException + { + Fileset fileset = new Fileset( + TEST_BASE_DIR, + new HashSet(), + new HashSet()); + List fileList = fileset.getFiles(); + Iterator fileIt = fileList.iterator(); + while (fileIt.hasNext()) + { + File file = fileIt.next(); + if (file.getPath().indexOf(".svn") != -1) + { + fileIt.remove(); + } + } + assertFileListEquals( + fileList, + new File(TEST_BASE_DIR, "1.properties"), + new File(TEST_BASE_DIR, "11.properties"), + new File(TEST_BASE_DIR, "package.html"), + new File(TEST_BASE_DIR, "subfolder/2.properties"), + new File(TEST_BASE_DIR, "subfolder/subsubfolder/3.properties")); + } + @Test public void testFilelistExcludeInBasedir() throws IOException { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("*"), - getSetWith("11.properties")); + createSetFrom("*"), + createSetFrom("11.properties")); assertFileListEquals( fileset, new File(TEST_BASE_DIR, "./package.html"), @@ -276,8 +301,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/*"), - getSetWith("subfolder/2.properties")); + createSetFrom("subfolder/*"), + createSetFrom("subfolder/2.properties")); assertFileListEquals( fileset, new File[] {}); @@ -288,8 +313,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/*"), - getSetWith("subfolder\\2.properties")); + createSetFrom("subfolder/*"), + createSetFrom("subfolder\\2.properties")); assertFileListEquals( fileset, new File[] {}); @@ -300,8 +325,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/*"), - getSetWith("*/2.properties")); + createSetFrom("subfolder/*"), + createSetFrom("*/2.properties")); assertFileListEquals( fileset, new File[] {}); @@ -312,8 +337,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/*"), - getSetWith("su??old?r/2.properties")); + createSetFrom("subfolder/*"), + createSetFrom("su??old?r/2.properties")); assertFileListEquals( fileset, new File[] {}); @@ -324,8 +349,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("subfolder/*"), - getSetWith("su??old?r/./2.properties")); + createSetFrom("subfolder/*"), + createSetFrom("su??old?r/./2.properties")); assertFileListEquals( fileset, new File[] {}); @@ -336,8 +361,8 @@ { Fileset fileset = new Fileset( TEST_BASE_DIR, - getSetWith("*"), - getSetWith("subfolder/../11.properties")); + createSetFrom("*"), + createSetFrom("subfolder/../11.properties")); assertFileListEquals( fileset, new File(TEST_BASE_DIR, "./package.html"), @@ -349,8 +374,8 @@ { Fileset fileset = new Fileset( new File(TEST_BASE_DIR, "subfolder"), - getSetWith("../*"), - getSetWith("../1.properties", ".././package.html")); + createSetFrom("../*"), + createSetFrom("../1.properties", ".././package.html")); assertFileListEquals( fileset, new File(TEST_BASE_DIR, "subfolder/../11.properties")); Modified: db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gf/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gf/conf/control.xml?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gf/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gf/conf/control.xml Wed Feb 24 19:33:20 2010 @@ -34,7 +34,9 @@ - + + propertiesData.properties + @@ -47,11 +49,15 @@ - + + propertiesData.properties + - + + propertiesData.properties + Modified: db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gf/conf/control.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gf/conf/control.xml?rev=915943&r1=915942&r2=915943&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gf/conf/control.xml (original) +++ db/torque/torque4/trunk/torque-generator/src/test/site/gettingStarted/src/main/torque-gf/conf/control.xml Wed Feb 24 19:33:20 2010 @@ -25,7 +25,9 @@ loglevel="debug"> - + + propertiesData.properties + --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org