Return-Path: Delivered-To: apmail-avalon-cvs-archive@www.apache.org Received: (qmail 14351 invoked from network); 2 Sep 2004 16:14:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 2 Sep 2004 16:14:01 -0000 Received: (qmail 61013 invoked by uid 500); 2 Sep 2004 16:14:01 -0000 Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 60941 invoked by uid 500); 2 Sep 2004 16:14:00 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 60927 invoked by uid 99); 2 Sep 2004 16:14:00 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 02 Sep 2004 09:14:00 -0700 Received: (qmail 14259 invoked by uid 65534); 2 Sep 2004 16:13:58 -0000 Date: 2 Sep 2004 16:13:58 -0000 Message-ID: <20040902161358.14255.qmail@minotaur.apache.org> From: niclas@apache.org To: cvs@avalon.apache.org Subject: svn commit: rev 37394 - in avalon/trunk/tools: . magic/src/main/org/apache/avalon/tools/model magic/src/main/org/apache/avalon/tools/tasks X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: niclas Date: Thu Sep 2 09:13:58 2004 New Revision: 37394 Modified: avalon/trunk/tools/index.xml avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/BlockTask.java avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java Log: Fixed a x:configuration problem. Implemented includes/excludes for JUnitTask. Modified: avalon/trunk/tools/index.xml ============================================================================== --- avalon/trunk/tools/index.xml (original) +++ avalon/trunk/tools/index.xml Thu Sep 2 09:13:58 2004 @@ -6,7 +6,7 @@ ant ant - 1.6.1 + 1.6.2 jar @@ -20,7 +20,7 @@ ant ant-nodeps - 1.6.1 + 1.6.2 jar @@ -35,7 +35,7 @@ ant ant-junit - 1.6.1 + 1.6.2 jar Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java ============================================================================== --- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java (original) +++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java Thu Sep 2 09:13:58 2004 @@ -138,7 +138,27 @@ public static final String SRC_TEST_KEY = "project.src.test"; + /** + * the key for the include pattern for test cases + */ + public static final String TEST_INCLUDES_KEY = "project.test.includes"; + + /** + * default value + */ + public static final String TEST_INCLUDES_VALUE = "**/*TestCase.java, **/*Test.java"; + + /** + * the key for the exclude pattern for test cases + */ + public static final String TEST_EXCLUDES_KEY = "project.test.excludes"; + /** + * default value + */ + public static final String TEST_EXCLUDES_VALUE = "**/Abstract*.java, **/AllTest*.java"; + + /** * The value of the default project.src.test property value. */ public static final String SRC_TEST = "test"; @@ -316,6 +336,8 @@ private File m_temp; private File m_docs; private File m_test; + private String m_testIncludes; + private String m_testExcludes; /** * Creation of the context and association ofnthe context under the KEY key. @@ -333,6 +355,8 @@ project.setNewProperty( SRC_MAIN_KEY, SRC_MAIN ); project.setNewProperty( SRC_CONFIG_KEY, SRC_CONFIG ); project.setNewProperty( SRC_TEST_KEY, SRC_TEST ); + project.setNewProperty( TEST_INCLUDES_KEY, TEST_INCLUDES_VALUE ); + project.setNewProperty( TEST_EXCLUDES_KEY, TEST_EXCLUDES_VALUE ); project.setNewProperty( ETC_KEY, ETC_VALUE ); @@ -352,7 +376,8 @@ m_testClasses = setBuildPath( TEST_CLASSES ); m_testReports = setBuildPath( TEST_REPORTS ); m_docs = setBuildPath( DOCS ); - + m_testIncludes = setupTestIncludes(project.getProperty(TEST_INCLUDES_KEY)); + m_testExcludes = setupTestExcludes(project.getProperty(TEST_EXCLUDES_KEY)); project.addReference( KEY, this ); } @@ -455,6 +480,24 @@ { return m_test; } + + /** + * Return the project test includes. + * @return the includes pattern + */ + public String getTestIncludes() + { + return m_testIncludes; + } + + /** + * Return the project test excludes. + * @return the excludes pattern + */ + public String getTestExcludes() + { + return m_testExcludes; + } /** * Reuturn the project docs directory. @@ -558,6 +601,21 @@ if( null == path ) return new File( basedir, SRC_VALUE ); return new File( basedir, path ); } + + private static String setupTestIncludes( final String includes ) + { + if( null == includes ) + return TEST_INCLUDES_VALUE; + return includes; + } + + private static String setupTestExcludes( final String excludes ) + { + if( null == excludes ) + return TEST_EXCLUDES_VALUE; + return excludes; + } + private static File setupEtc( final File basedir, final String path ) { Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java ============================================================================== --- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java (original) +++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java Thu Sep 2 09:13:58 2004 @@ -146,7 +146,8 @@ m_signature = project.getProperty( GUMP_SIGNATURE_KEY ); m_system = getSystemDirectory( project ); project.setProperty( KEY, Context.getCanonicalPath( m_system ) ); - File user = new File( m_system, "user.properties" ); + File home = new File( System.getProperty( "user.home" ) ); + File user = new File( home, "magic.properties" ); loadProperties( project, user ); File properties = new File( m_system, "magic.properties" ); loadProperties( project, properties ); Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/BlockTask.java ============================================================================== --- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/BlockTask.java (original) +++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/BlockTask.java Thu Sep 2 09:13:58 2004 @@ -653,6 +653,7 @@ String uri, String localName, String qName, String value) throws BuildException { + System.out.println("setting DynamicAttribute with: " + localName + ", " + qName + ", " + value ); m_attributes.put( qName, value ); } @@ -705,7 +706,7 @@ */ public Configuration[] getChildren() { - return (Configuration[]) m_children.toArray( new Configuration[0] ); + return (Configuration[]) m_children.toArray( new Configuration[m_children.size()] ); } } @@ -1053,7 +1054,7 @@ if( attributes.size() > 0 ) { Map.Entry[] values = (Map.Entry[]) attributes.entrySet().toArray( new Map.Entry[0] ); - for( int i=0; i 0 ) { writer.write( ">" ); - for( int i=0; i" ); + if( null == config.getValue() ) + { + writer.write( "/>" ); + } + else + { + writer.write( ">" ); + writer.write( config.getValue() ); + writer.write( "" ); + } } } Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java ============================================================================== --- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java (original) +++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/tasks/JUnitTestTask.java Thu Sep 2 09:13:58 2004 @@ -35,6 +35,8 @@ import java.io.File; +import java.util.StringTokenizer; + /** * Load a goal. * @@ -214,8 +216,11 @@ final FileSet fileset = new FileSet(); fileset.setDir( src ); - fileset.createInclude().setName( "**/*TestCase.java" ); - fileset.createExclude().setName( "**/Abstract*.java" ); + final String includes = getContext().getTestIncludes(); + final String excludes = getContext().getTestExcludes(); + createIncludes(fileset, includes); + createExcludes(fileset, excludes); + project.log( "MAGIC TEST FILTERS: includes=" + includes + ", excludes=" + excludes, Project.MSG_VERBOSE ); final JUnitTask junit = (JUnitTask) getProject().createTask( "junit" ); junit.init(); @@ -288,6 +293,28 @@ junit.setTaskName( getTaskName() ); junit.execute(); + } + + private void createIncludes(FileSet set, String pattern) + { + StringTokenizer tokenizer = new StringTokenizer(pattern, ", ", false); + while( tokenizer.hasMoreTokens()) + { + String item = tokenizer.nextToken(); + set.createInclude().setName( item ); + } + + } + + private void createExcludes(FileSet set, String pattern) + { + StringTokenizer tokenizer = new StringTokenizer(pattern, ", ", false); + while( tokenizer.hasMoreTokens()) + { + String item = tokenizer.nextToken(); + set.createExclude().setName( item ); + } + } private String getCachePath() --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org