git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271627 13f79535-47bb-0310-9956-ffa450edef68master
@@ -8,12 +8,12 @@ | |||||
package org.apache.antlib.core; | package org.apache.antlib.core; | ||||
import java.io.File; | import java.io.File; | ||||
import org.apache.aut.converter.AbstractConverter; | |||||
import org.apache.aut.converter.ConverterException; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.aut.converter.AbstractConverter; | |||||
import org.apache.aut.converter.ConverterException; | |||||
/** | /** | ||||
* String to file converter | * String to file converter | ||||
@@ -8,6 +8,7 @@ | |||||
package org.apache.antlib.vfile; | package org.apache.antlib.vfile; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.antlib.vfile.selectors.AndFileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.FileType; | import org.apache.aut.vfs.FileType; | ||||
@@ -15,7 +16,6 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.selectors.AndFileSelector; | |||||
/** | /** | ||||
* A file set, that contains those files under a directory that match | * A file set, that contains those files under a directory that match | ||||
@@ -8,10 +8,10 @@ | |||||
package org.apache.antlib.vfile; | package org.apache.antlib.vfile; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.antlib.vfile.selectors.AndFileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.selectors.AndFileSelector; | |||||
/** | /** | ||||
* A file-list which filters another. | * A file-list which filters another. | ||||
@@ -67,6 +67,6 @@ public class FilteredFileList | |||||
} | } | ||||
} | } | ||||
return (FileObject[])acceptedFiles.toArray( new FileObject[acceptedFiles.size() ] ); | |||||
return (FileObject[])acceptedFiles.toArray( new FileObject[ acceptedFiles.size() ] ); | |||||
} | } | ||||
} | } |
@@ -40,7 +40,7 @@ public class ListFilesTask | |||||
final FileObject[] files = m_files.listFiles( getContext() ); | final FileObject[] files = m_files.listFiles( getContext() ); | ||||
for( int i = 0; i < files.length; i++ ) | for( int i = 0; i < files.length; i++ ) | ||||
{ | { | ||||
FileObject file = files[i ]; | |||||
FileObject file = files[ i ]; | |||||
getLogger().info( file.toString() ); | getLogger().info( file.toString() ); | ||||
} | } | ||||
} | } | ||||
@@ -7,7 +7,10 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.oro.text.GlobCompiler; | import org.apache.oro.text.GlobCompiler; | ||||
@@ -15,9 +18,6 @@ import org.apache.oro.text.regex.MalformedPatternException; | |||||
import org.apache.oro.text.regex.Pattern; | import org.apache.oro.text.regex.Pattern; | ||||
import org.apache.oro.text.regex.Perl5Compiler; | import org.apache.oro.text.regex.Perl5Compiler; | ||||
import org.apache.oro.text.regex.Perl5Matcher; | import org.apache.oro.text.regex.Perl5Matcher; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* An abstract file selector that selects files based on name. | * An abstract file selector that selects files based on name. | ||||
@@ -8,10 +8,10 @@ | |||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector that performs an AND of nested selectors. Performs | * A file selector that performs an AND of nested selectors. Performs | ||||
@@ -46,8 +46,8 @@ public class AndFileSelector | |||||
{ | { | ||||
for( int i = 0; i < m_selectors.size(); i++ ) | for( int i = 0; i < m_selectors.size(); i++ ) | ||||
{ | { | ||||
final FileSelector fileSelector = (FileSelector)m_selectors.get(i ); | |||||
if( ! fileSelector.accept( file, path, context ) ) | |||||
final FileSelector fileSelector = (FileSelector)m_selectors.get( i ); | |||||
if( !fileSelector.accept( file, path, context ) ) | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -8,7 +8,6 @@ | |||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.antlib.vfile.selectors.AbstractNameFileSelector; | |||||
/** | /** | ||||
* A file selector that selects files based on their base-name. | * A file selector that selects files based on their base-name. | ||||
@@ -7,11 +7,11 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector that only selects files that exist. | * A file selector that only selects files that exist. | ||||
@@ -9,8 +9,8 @@ package org.apache.antlib.vfile.selectors; | |||||
import org.apache.antlib.vfile.FileSelector; | import org.apache.antlib.vfile.FileSelector; | ||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileType; | |||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.FileType; | |||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
@@ -37,8 +37,8 @@ public class IsEmptyFolderSelector | |||||
try | try | ||||
{ | { | ||||
return ( file.exists() | return ( file.exists() | ||||
&& file.getType() == FileType.FOLDER | |||||
&& file.getChildren().length == 0 ); | |||||
&& file.getType() == FileType.FOLDER | |||||
&& file.getChildren().length == 0 ); | |||||
} | } | ||||
catch( FileSystemException e ) | catch( FileSystemException e ) | ||||
{ | { | ||||
@@ -7,12 +7,12 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.FileType; | import org.apache.aut.vfs.FileType; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector which only selects files, not folders. | * A file selector which only selects files, not folders. | ||||
@@ -7,12 +7,12 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.FileType; | import org.apache.aut.vfs.FileType; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector which only selects folders, not files. | * A file selector which only selects folders, not files. | ||||
@@ -8,7 +8,6 @@ | |||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.antlib.vfile.selectors.AbstractNameFileSelector; | |||||
/** | /** | ||||
* A file selector that selects files based on their name. | * A file selector that selects files based on their name. | ||||
@@ -7,10 +7,10 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector that negates a nested file selector. | * A file selector that negates a nested file selector. | ||||
@@ -46,6 +46,6 @@ public class NotFileSelector | |||||
{ | { | ||||
throw new TaskException( "notfileselector.no-selector.error" ); | throw new TaskException( "notfileselector.no-selector.error" ); | ||||
} | } | ||||
return ! m_selector.accept( file, path, context ); | |||||
return !m_selector.accept( file, path, context ); | |||||
} | } | ||||
} | } |
@@ -8,10 +8,10 @@ | |||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.antlib.vfile.FileSelector; | |||||
/** | /** | ||||
* A file selector that performs an OR of nested selectors. Performs | * A file selector that performs an OR of nested selectors. Performs | ||||
@@ -46,7 +46,7 @@ public class OrFileSelector | |||||
{ | { | ||||
for( int i = 0; i < m_selectors.size(); i++ ) | for( int i = 0; i < m_selectors.size(); i++ ) | ||||
{ | { | ||||
final FileSelector fileSelector = (FileSelector)m_selectors.get(i ); | |||||
final FileSelector fileSelector = (FileSelector)m_selectors.get( i ); | |||||
if( fileSelector.accept( file, path, context ) ) | if( fileSelector.accept( file, path, context ) ) | ||||
{ | { | ||||
return true; | return true; | ||||
@@ -54,6 +54,6 @@ public class OrFileSelector | |||||
} | } | ||||
// Return true if there are no selectors, false if there are | // Return true if there are no selectors, false if there are | ||||
return (m_selectors.size() == 0); | |||||
return ( m_selectors.size() == 0 ); | |||||
} | } | ||||
} | } |
@@ -8,7 +8,6 @@ | |||||
package org.apache.antlib.vfile.selectors; | package org.apache.antlib.vfile.selectors; | ||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.antlib.vfile.selectors.AbstractNameFileSelector; | |||||
/** | /** | ||||
* A file selector that selects files based on their URL. | * A file selector that selects files based on their URL. | ||||
@@ -7,6 +7,7 @@ | |||||
*/ | */ | ||||
package org.apache.aut.vfs.provider.local; | package org.apache.aut.vfs.provider.local; | ||||
import java.io.File; | |||||
import org.apache.aut.vfs.FileObject; | import org.apache.aut.vfs.FileObject; | ||||
import org.apache.aut.vfs.FileSystemException; | import org.apache.aut.vfs.FileSystemException; | ||||
import org.apache.aut.vfs.provider.AbstractFileSystemProvider; | import org.apache.aut.vfs.provider.AbstractFileSystemProvider; | ||||
@@ -14,7 +15,6 @@ import org.apache.aut.vfs.provider.DefaultFileName; | |||||
import org.apache.aut.vfs.provider.FileSystem; | import org.apache.aut.vfs.provider.FileSystem; | ||||
import org.apache.aut.vfs.provider.FileSystemProvider; | import org.apache.aut.vfs.provider.FileSystemProvider; | ||||
import org.apache.aut.vfs.provider.ParsedUri; | import org.apache.aut.vfs.provider.ParsedUri; | ||||
import java.io.File; | |||||
/** | /** | ||||
* A file system provider, which uses direct file access. | * A file system provider, which uses direct file access. | ||||
@@ -415,7 +415,7 @@ public class DefaultConfigurer | |||||
// Convert the value to the appropriate type | // Convert the value to the appropriate type | ||||
final Class type = setter.getType(); | final Class type = setter.getType(); | ||||
if( ! type.isInstance( objValue ) ) | |||||
if( !type.isInstance( objValue ) ) | |||||
{ | { | ||||
objValue = m_converter.convert( type, objValue, context ); | objValue = m_converter.convert( type, objValue, context ); | ||||
} | } | ||||
@@ -478,7 +478,7 @@ public class DefaultConfigurer | |||||
configureObject( child, element, context ); | configureObject( child, element, context ); | ||||
// Convert the object, if necessary | // Convert the object, if necessary | ||||
if( ! type.isInstance( child ) ) | |||||
if( !type.isInstance( child ) ) | |||||
{ | { | ||||
child = m_converter.convert( type, child, context ); | child = m_converter.convert( type, child, context ); | ||||
} | } | ||||
@@ -540,7 +540,8 @@ public class DefaultConfigurer | |||||
// Map the expected type to a role. If found, instantiate the default | // Map the expected type to a role. If found, instantiate the default | ||||
// type for that role | // type for that role | ||||
final RoleInfo roleInfo = m_roleManager.getRoleByType( type ); | final RoleInfo roleInfo = m_roleManager.getRoleByType( type ); | ||||
if( roleInfo != null ) { | |||||
if( roleInfo != null ) | |||||
{ | |||||
final String typeName = roleInfo.getDefaultType(); | final String typeName = roleInfo.getDefaultType(); | ||||
if( typeName != null ) | if( typeName != null ) | ||||
{ | { | ||||
@@ -582,7 +583,7 @@ public class DefaultConfigurer | |||||
// Use the generic 'data-type' role. | // Use the generic 'data-type' role. | ||||
final TypeFactory factory = m_typeManager.getFactory( DataType.class ); | final TypeFactory factory = m_typeManager.getFactory( DataType.class ); | ||||
if( ! factory.canCreate( name ) ) | |||||
if( !factory.canCreate( name ) ) | |||||
{ | { | ||||
throw new NoSuchPropertyException(); | throw new NoSuchPropertyException(); | ||||
} | } | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.configurer; | package org.apache.myrmidon.components.configurer; | ||||
/** | /** | ||||
* A marker exception that is thrown when an unknown property is encountered. | * A marker exception that is thrown when an unknown property is encountered. | ||||
* | * | ||||
@@ -140,7 +140,7 @@ public class DefaultMasterConverter | |||||
ArrayList queue = new ArrayList(); | ArrayList queue = new ArrayList(); | ||||
queue.add( originalClass ); | queue.add( originalClass ); | ||||
while( ! queue.isEmpty() ) | |||||
while( !queue.isEmpty() ) | |||||
{ | { | ||||
Class clazz = (Class)queue.remove( 0 ); | Class clazz = (Class)queue.remove( 0 ); | ||||
@@ -152,7 +152,7 @@ public class DefaultMasterConverter | |||||
final Class[] interfaces = clazz.getInterfaces(); | final Class[] interfaces = clazz.getInterfaces(); | ||||
for( int i = 0; i < interfaces.length; i++ ) | for( int i = 0; i < interfaces.length; i++ ) | ||||
{ | { | ||||
queue.add( interfaces[i ] ); | |||||
queue.add( interfaces[ i ] ); | |||||
} | } | ||||
// Check if we can convert from current class to destination | // Check if we can convert from current class to destination | ||||
@@ -24,9 +24,9 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
import org.apache.avalon.framework.service.Serviceable; | |||||
import org.apache.avalon.framework.service.ServiceException; | import org.apache.avalon.framework.service.ServiceException; | ||||
import org.apache.avalon.framework.service.ServiceManager; | import org.apache.avalon.framework.service.ServiceManager; | ||||
import org.apache.avalon.framework.service.Serviceable; | |||||
import org.apache.myrmidon.interfaces.deployer.DeploymentException; | import org.apache.myrmidon.interfaces.deployer.DeploymentException; | ||||
import org.apache.myrmidon.interfaces.extensions.ExtensionManager; | import org.apache.myrmidon.interfaces.extensions.ExtensionManager; | ||||
@@ -145,7 +145,7 @@ public class DefaultDeployer | |||||
throws Exception | throws Exception | ||||
{ | { | ||||
final String roleShorthand = definition.getRoleShorthand(); | final String roleShorthand = definition.getRoleShorthand(); | ||||
final String roleName = getRole( roleShorthand ).getName(); | |||||
final String roleName = getRole( roleShorthand ).getName(); | |||||
final String factoryClassName = definition.getFactoryClass(); | final String factoryClassName = definition.getFactoryClass(); | ||||
handleType( deployment, ServiceFactory.class, roleName, factoryClassName ); | handleType( deployment, ServiceFactory.class, roleName, factoryClassName ); | ||||
} | } | ||||
@@ -277,7 +277,7 @@ public class DefaultDeployer | |||||
private RoleInfo getRole( final String roleShorthand ) | private RoleInfo getRole( final String roleShorthand ) | ||||
throws DeploymentException | throws DeploymentException | ||||
{ | { | ||||
final RoleInfo roleInfo = m_roleManager.getRoleByShorthandName( roleShorthand ); | |||||
final RoleInfo roleInfo = m_roleManager.getRoleByShorthandName( roleShorthand ); | |||||
if( null == roleInfo ) | if( null == roleInfo ) | ||||
{ | { | ||||
final String message = REZ.getString( "unknown-role4name.error", roleShorthand ); | final String message = REZ.getString( "unknown-role4name.error", roleShorthand ); | ||||
@@ -16,8 +16,8 @@ import org.apache.avalon.framework.configuration.ConfigurationException; | |||||
import org.apache.avalon.framework.configuration.DefaultConfiguration; | import org.apache.avalon.framework.configuration.DefaultConfiguration; | ||||
import org.apache.avalon.framework.logger.Logger; | import org.apache.avalon.framework.logger.Logger; | ||||
import org.apache.avalon.framework.parameters.Parameters; | import org.apache.avalon.framework.parameters.Parameters; | ||||
import org.apache.avalon.framework.service.ServiceManager; | |||||
import org.apache.avalon.framework.service.ServiceException; | import org.apache.avalon.framework.service.ServiceException; | ||||
import org.apache.avalon.framework.service.ServiceManager; | |||||
import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
import org.apache.myrmidon.interfaces.aspect.AspectManager; | import org.apache.myrmidon.interfaces.aspect.AspectManager; | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.interfaces.role; | package org.apache.myrmidon.interfaces.role; | ||||
/** | /** | ||||
* A role definition. Role definitions are immutable. | * A role definition. Role definitions are immutable. | ||||
* | * | ||||
@@ -87,7 +85,7 @@ public final class RoleInfo | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
if( ! m_name.equals( role.m_name ) ) | |||||
if( !m_name.equals( role.m_name ) ) | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -95,7 +93,7 @@ public final class RoleInfo | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
if( m_shorthand != null && ! m_shorthand.equals( role.m_shorthand ) ) | |||||
if( m_shorthand != null && !m_shorthand.equals( role.m_shorthand ) ) | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -13,7 +13,7 @@ package org.apache.myrmidon.listeners; | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | ||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
* @ant:type type="listener" name="noprefix" | * @ant:type type="listener" name="noprefix" | ||||
*/ | |||||
*/ | |||||
public class NoPrefixProjectListener | public class NoPrefixProjectListener | ||||
extends DefaultProjectListener | extends DefaultProjectListener | ||||
{ | { | ||||
@@ -12,7 +12,6 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.myrmidon.AbstractProjectTest; | import org.apache.myrmidon.AbstractProjectTest; | ||||
import org.apache.myrmidon.LogMessageTracker; | import org.apache.myrmidon.LogMessageTracker; | ||||
import org.apache.myrmidon.components.configurer.DefaultConfigurer; | |||||
/** | /** | ||||
* Test cases for <property> task. | * Test cases for <property> task. | ||||
@@ -42,17 +41,17 @@ public class PropertyTest | |||||
// Set by attribute | // Set by attribute | ||||
LogMessageTracker tracker = new LogMessageTracker(); | LogMessageTracker tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-attr", "test-prop = [some value]"); | |||||
tracker.addExpectedMessage( "set-attr", "test-prop = [some value]" ); | |||||
executeTarget( projectFile, "set-attr", tracker ); | executeTarget( projectFile, "set-attr", tracker ); | ||||
// Set by text content | // Set by text content | ||||
tracker = new LogMessageTracker(); | tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-content", "test-prop2 = [some value]"); | |||||
tracker.addExpectedMessage( "set-content", "test-prop2 = [some value]" ); | |||||
executeTarget( projectFile, "set-content", tracker ); | executeTarget( projectFile, "set-content", tracker ); | ||||
// Set by nested element | // Set by nested element | ||||
tracker = new LogMessageTracker(); | tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-element", "test-prop3 = [value=[some value]]"); | |||||
tracker.addExpectedMessage( "set-element", "test-prop3 = [value=[some value]]" ); | |||||
executeTarget( projectFile, "set-element", tracker ); | executeTarget( projectFile, "set-element", tracker ); | ||||
} | } | ||||
@@ -7,8 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile; | package org.apache.antlib.vfile; | ||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
import java.io.File; | import java.io.File; | ||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
/** | /** | ||||
* Test cases for the <v-copy> task. | * Test cases for the <v-copy> task. | ||||
@@ -9,14 +9,11 @@ package org.apache.aut.vfs; | |||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.Reader; | |||||
import java.io.StringWriter; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import junit.framework.TestCase; | |||||
import org.apache.aut.vfs.impl.DefaultFileSystemManager; | import org.apache.aut.vfs.impl.DefaultFileSystemManager; | ||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
@@ -203,21 +200,21 @@ public abstract class AbstractFileSystemTest | |||||
/** | /** | ||||
* Checks that a relative name resolves to the expected absolute path. | * Checks that a relative name resolves to the expected absolute path. | ||||
*/ | */ | ||||
private void assertSameName(String expectedPath, | |||||
FileName baseName, | |||||
String relName ) throws Exception | |||||
private void assertSameName( String expectedPath, | |||||
FileName baseName, | |||||
String relName ) throws Exception | |||||
{ | { | ||||
FileName name = baseName.resolveName(relName); | |||||
FileName name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
// Replace the separators | // Replace the separators | ||||
relName.replace('\\', '/'); | |||||
name = baseName.resolveName(relName); | |||||
relName.replace( '\\', '/' ); | |||||
name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
// And again | // And again | ||||
relName.replace('/', '\\'); | |||||
name = baseName.resolveName(relName); | |||||
relName.replace( '/', '\\' ); | |||||
name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
} | } | ||||
@@ -457,12 +454,12 @@ public abstract class AbstractFileSystemTest | |||||
// Test non-empty file | // Test non-empty file | ||||
FileObject file = m_baseFolder.resolveFile( "file1.txt" ); | FileObject file = m_baseFolder.resolveFile( "file1.txt" ); | ||||
FileContent content = file.getContent(); | FileContent content = file.getContent(); | ||||
assertSameContent(m_charContent, content); | |||||
assertSameContent( m_charContent, content ); | |||||
// Test empty file | // Test empty file | ||||
file = m_baseFolder.resolveFile( "empty.txt" ); | file = m_baseFolder.resolveFile( "empty.txt" ); | ||||
content = file.getContent(); | content = file.getContent(); | ||||
assertSameContent("", content); | |||||
assertSameContent( "", content ); | |||||
} | } | ||||
/** | /** | ||||
@@ -7,7 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.aut.vfs; | package org.apache.aut.vfs; | ||||
import java.io.Writer; | |||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Set; | import java.util.Set; | ||||
@@ -7,8 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.aut.zip; | package org.apache.aut.zip; | ||||
import junit.framework.TestCase; | |||||
import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | ||||
import junit.framework.TestCase; | |||||
/** | /** | ||||
* JUnit testcases ZipEntry. | * JUnit testcases ZipEntry. | ||||
@@ -39,9 +39,9 @@ public abstract class AbstractMyrmidonTest | |||||
final String baseDirProp = System.getProperty( "test.basedir" ); | final String baseDirProp = System.getProperty( "test.basedir" ); | ||||
m_baseDir = new File( baseDirProp ); | m_baseDir = new File( baseDirProp ); | ||||
String packagePath = getClass().getName(); | String packagePath = getClass().getName(); | ||||
int idx = packagePath.lastIndexOf('.'); | |||||
packagePath = packagePath.substring(0, idx); | |||||
packagePath = packagePath.replace('.', File.separatorChar); | |||||
int idx = packagePath.lastIndexOf( '.' ); | |||||
packagePath = packagePath.substring( 0, idx ); | |||||
packagePath = packagePath.replace( '.', File.separatorChar ); | |||||
m_testBaseDir = new File( m_baseDir, packagePath ); | m_testBaseDir = new File( m_baseDir, packagePath ); | ||||
} | } | ||||
@@ -77,7 +77,7 @@ public class AbstractProjectTest | |||||
final String targetName, | final String targetName, | ||||
final String message ) | final String message ) | ||||
{ | { | ||||
executeTargetExpectError( projectFile, targetName, new String[] { message } ); | |||||
executeTargetExpectError( projectFile, targetName, new String[]{message} ); | |||||
} | } | ||||
/** | /** | ||||
@@ -171,17 +171,17 @@ public class DependencyMetricsTest | |||||
* Make sure that antlib package does not have any | * Make sure that antlib package does not have any | ||||
* unwanted dependencies. | * unwanted dependencies. | ||||
*/ | */ | ||||
/* | |||||
public void testAntlibDecoupled() | |||||
{ | |||||
final String packageName = "org.apache.antlib"; | |||||
final String[] badEfferents = new String[] | |||||
/* | |||||
public void testAntlibDecoupled() | |||||
{ | { | ||||
"org.apache.tools.ant" | |||||
}; | |||||
doTestDecoupled( packageName, badEfferents ); | |||||
} | |||||
*/ | |||||
final String packageName = "org.apache.antlib"; | |||||
final String[] badEfferents = new String[] | |||||
{ | |||||
"org.apache.tools.ant" | |||||
}; | |||||
doTestDecoupled( packageName, badEfferents ); | |||||
} | |||||
*/ | |||||
/** | /** | ||||
* Make sure there are no circular dependencies between packages because | * Make sure there are no circular dependencies between packages because | ||||
* circular dependencies are evil!!! | * circular dependencies are evil!!! | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.configurer; | package org.apache.myrmidon.components.configurer; | ||||
/** | /** | ||||
* Simple class to test typed adder. | * Simple class to test typed adder. | ||||
* | * | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.configurer; | package org.apache.myrmidon.components.configurer; | ||||
/** | /** | ||||
* Simple class with more than one typed adder method. | * Simple class with more than one typed adder method. | ||||
* | * | ||||
@@ -36,7 +36,7 @@ public class ConfigTestPrimConvert | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
if ( !AbstractComponentTest.equals( m_integerProp, test.m_integerProp ) ) | |||||
if( !AbstractComponentTest.equals( m_integerProp, test.m_integerProp ) ) | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -103,7 +103,7 @@ public class DefaultConfigurerTest | |||||
// Check result | // Check result | ||||
final ConfigTestPrimConvert expected = new ConfigTestPrimConvert(); | final ConfigTestPrimConvert expected = new ConfigTestPrimConvert(); | ||||
expected.setIntProp( 90 ); | expected.setIntProp( 90 ); | ||||
expected.setIntegerProp( new Integer(-401) ); | |||||
expected.setIntegerProp( new Integer( -401 ) ); | |||||
assertEquals( expected, test ); | assertEquals( expected, test ); | ||||
} | } | ||||
@@ -381,7 +381,7 @@ public class DefaultConfigurerTest | |||||
final ConfigTestInterfaceProp test = new ConfigTestInterfaceProp(); | final ConfigTestInterfaceProp test = new ConfigTestInterfaceProp(); | ||||
// Configure object | // Configure object | ||||
m_configurer.configure( test, config, m_context ); | |||||
m_configurer.configure( test, config, m_context ); | |||||
// Check result | // Check result | ||||
final ConfigTestInterfaceProp expected = new ConfigTestInterfaceProp(); | final ConfigTestInterfaceProp expected = new ConfigTestInterfaceProp(); | ||||
@@ -442,7 +442,7 @@ public class DefaultConfigurerTest | |||||
REZ.getString( "bad-configure-element.error", "test" ), | REZ.getString( "bad-configure-element.error", "test" ), | ||||
REZ.getString( "multiple-adder-methods-for-element.error", | REZ.getString( "multiple-adder-methods-for-element.error", | ||||
ConfigTestMultiTypedAdder.class.getName(), | ConfigTestMultiTypedAdder.class.getName(), | ||||
"") | |||||
"" ) | |||||
}; | }; | ||||
assertSameMessage( messages, ce ); | assertSameMessage( messages, ce ); | ||||
} | } | ||||
@@ -541,7 +541,7 @@ public class DefaultConfigurerTest | |||||
config.setAttribute( "my-role1", "some value" ); | config.setAttribute( "my-role1", "some value" ); | ||||
// Set up the converter and role | // Set up the converter and role | ||||
registerRole( new RoleInfo("my-role1", MyRole1.class ) ); | |||||
registerRole( new RoleInfo( "my-role1", MyRole1.class ) ); | |||||
registerConverter( ObjectToMyRole1Converter.class, String.class, MyRole1.class ); | registerConverter( ObjectToMyRole1Converter.class, String.class, MyRole1.class ); | ||||
final ConfigTestTypedProp test = new ConfigTestTypedProp(); | final ConfigTestTypedProp test = new ConfigTestTypedProp(); | ||||
@@ -69,13 +69,13 @@ public class DefaultDeployerTest | |||||
// Determine the shorthand for the DataType role | // Determine the shorthand for the DataType role | ||||
// Create the type definition | // Create the type definition | ||||
final TypeDefinition typeDef = new TypeDefinition( typeName, DATA_TYPE_ROLE, classname ); | |||||
final TypeDefinition typeDef = new TypeDefinition( typeName, DATA_TYPE_ROLE, classname ); | |||||
final ClassLoader classLoader = getClass().getClassLoader(); | final ClassLoader classLoader = getClass().getClassLoader(); | ||||
final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | ||||
// Make sure the test types have not been deployed | // Make sure the test types have not been deployed | ||||
assertTypesNotRegistered( ); | |||||
assertTypesNotRegistered(); | |||||
// Deploy the type | // Deploy the type | ||||
typeDeployer.deployType( typeDef ); | typeDeployer.deployType( typeDef ); | ||||
@@ -103,7 +103,7 @@ public class DefaultDeployerTest | |||||
final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | ||||
// Make sure the test types have not been deployed | // Make sure the test types have not been deployed | ||||
assertTypesNotRegistered( ); | |||||
assertTypesNotRegistered(); | |||||
// Deploy the type | // Deploy the type | ||||
typeDeployer.deployType( typeDef ); | typeDeployer.deployType( typeDef ); | ||||
@@ -176,7 +176,7 @@ public class DefaultDeployerTest | |||||
* Ensures the types from the test typelib descriptor have been correctly | * Ensures the types from the test typelib descriptor have been correctly | ||||
* deployed. | * deployed. | ||||
*/ | */ | ||||
private void assertTypesRegistered( ) throws Exception | |||||
private void assertTypesRegistered() throws Exception | |||||
{ | { | ||||
// Check the data-type | // Check the data-type | ||||
TypeFactory typeFactory = getTypeManager().getFactory( DataType.class ); | TypeFactory typeFactory = getTypeManager().getFactory( DataType.class ); | ||||
@@ -50,11 +50,11 @@ public class DefaultEmbeddorTest | |||||
final Target implicitTarget = project.getImplicitTarget(); | final Target implicitTarget = project.getImplicitTarget(); | ||||
assertEquals( 1, implicitTarget.getTasks().length ); | assertEquals( 1, implicitTarget.getTasks().length ); | ||||
assertEquals( "property", implicitTarget.getTasks()[0].getName() ); | |||||
assertEquals( "property", implicitTarget.getTasks()[ 0 ].getName() ); | |||||
final Target target = project.getTarget( "main-target" ); | final Target target = project.getTarget( "main-target" ); | ||||
assertEquals( 1, target.getTasks().length ); | assertEquals( 1, target.getTasks().length ); | ||||
assertEquals( "log", target.getTasks()[0].getName() ); | |||||
assertEquals( "log", target.getTasks()[ 0 ].getName() ); | |||||
} | } | ||||
/** | /** | ||||
@@ -7,13 +7,13 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.role; | package org.apache.myrmidon.components.role; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
import org.apache.myrmidon.interfaces.role.RoleManager; | |||||
import org.apache.myrmidon.interfaces.role.RoleInfo; | |||||
import org.apache.myrmidon.interfaces.role.RoleException; | import org.apache.myrmidon.interfaces.role.RoleException; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.myrmidon.interfaces.role.RoleInfo; | |||||
import org.apache.myrmidon.interfaces.role.RoleManager; | |||||
/** | /** | ||||
* Test cases for the DefaultRoleManager. | * Test cases for the DefaultRoleManager. | ||||
@@ -51,7 +51,7 @@ public class DefaultRoleManagerTest | |||||
// Lookup the role | // Lookup the role | ||||
RoleInfo role = m_roleManager.getRole( roleName ); | RoleInfo role = m_roleManager.getRole( roleName ); | ||||
assertTrue( origRole.equals(role) ); | |||||
assertTrue( origRole.equals( role ) ); | |||||
// Lookup the role by shorthand | // Lookup the role by shorthand | ||||
role = m_roleManager.getRoleByShorthandName( shorthand ); | role = m_roleManager.getRoleByShorthandName( shorthand ); | ||||
@@ -113,7 +113,7 @@ public class InstantiatingServiceManagerTest | |||||
{ | { | ||||
// Make sure that hasService() works correctly | // Make sure that hasService() works correctly | ||||
final String serviceRole = "some-unknown-service"; | final String serviceRole = "some-unknown-service"; | ||||
assertTrue( ! m_serviceManager.hasService( serviceRole ) ); | |||||
assertTrue( !m_serviceManager.hasService( serviceRole ) ); | |||||
// Make sure that lookup() fails | // Make sure that lookup() fails | ||||
try | try | ||||
@@ -9,7 +9,6 @@ package org.apache.myrmidon.interfaces.type; | |||||
import java.io.File; | import java.io.File; | ||||
import java.net.URL; | import java.net.URL; | ||||
import junit.framework.TestCase; | |||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
/** | /** | ||||
@@ -12,7 +12,6 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
import org.apache.myrmidon.AbstractProjectTest; | import org.apache.myrmidon.AbstractProjectTest; | ||||
import org.apache.myrmidon.LogMessageTracker; | import org.apache.myrmidon.LogMessageTracker; | ||||
import org.apache.myrmidon.components.configurer.DefaultConfigurer; | |||||
/** | /** | ||||
* Test cases for <property> task. | * Test cases for <property> task. | ||||
@@ -42,17 +41,17 @@ public class PropertyTest | |||||
// Set by attribute | // Set by attribute | ||||
LogMessageTracker tracker = new LogMessageTracker(); | LogMessageTracker tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-attr", "test-prop = [some value]"); | |||||
tracker.addExpectedMessage( "set-attr", "test-prop = [some value]" ); | |||||
executeTarget( projectFile, "set-attr", tracker ); | executeTarget( projectFile, "set-attr", tracker ); | ||||
// Set by text content | // Set by text content | ||||
tracker = new LogMessageTracker(); | tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-content", "test-prop2 = [some value]"); | |||||
tracker.addExpectedMessage( "set-content", "test-prop2 = [some value]" ); | |||||
executeTarget( projectFile, "set-content", tracker ); | executeTarget( projectFile, "set-content", tracker ); | ||||
// Set by nested element | // Set by nested element | ||||
tracker = new LogMessageTracker(); | tracker = new LogMessageTracker(); | ||||
tracker.addExpectedMessage( "set-element", "test-prop3 = [value=[some value]]"); | |||||
tracker.addExpectedMessage( "set-element", "test-prop3 = [value=[some value]]" ); | |||||
executeTarget( projectFile, "set-element", tracker ); | executeTarget( projectFile, "set-element", tracker ); | ||||
} | } | ||||
@@ -7,8 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.antlib.vfile; | package org.apache.antlib.vfile; | ||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
import java.io.File; | import java.io.File; | ||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
/** | /** | ||||
* Test cases for the <v-copy> task. | * Test cases for the <v-copy> task. | ||||
@@ -9,14 +9,11 @@ package org.apache.aut.vfs; | |||||
import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.Reader; | |||||
import java.io.StringWriter; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
import junit.framework.TestCase; | |||||
import org.apache.aut.vfs.impl.DefaultFileSystemManager; | import org.apache.aut.vfs.impl.DefaultFileSystemManager; | ||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
@@ -203,21 +200,21 @@ public abstract class AbstractFileSystemTest | |||||
/** | /** | ||||
* Checks that a relative name resolves to the expected absolute path. | * Checks that a relative name resolves to the expected absolute path. | ||||
*/ | */ | ||||
private void assertSameName(String expectedPath, | |||||
FileName baseName, | |||||
String relName ) throws Exception | |||||
private void assertSameName( String expectedPath, | |||||
FileName baseName, | |||||
String relName ) throws Exception | |||||
{ | { | ||||
FileName name = baseName.resolveName(relName); | |||||
FileName name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
// Replace the separators | // Replace the separators | ||||
relName.replace('\\', '/'); | |||||
name = baseName.resolveName(relName); | |||||
relName.replace( '\\', '/' ); | |||||
name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
// And again | // And again | ||||
relName.replace('/', '\\'); | |||||
name = baseName.resolveName(relName); | |||||
relName.replace( '/', '\\' ); | |||||
name = baseName.resolveName( relName ); | |||||
assertEquals( expectedPath, name.getPath() ); | assertEquals( expectedPath, name.getPath() ); | ||||
} | } | ||||
@@ -457,12 +454,12 @@ public abstract class AbstractFileSystemTest | |||||
// Test non-empty file | // Test non-empty file | ||||
FileObject file = m_baseFolder.resolveFile( "file1.txt" ); | FileObject file = m_baseFolder.resolveFile( "file1.txt" ); | ||||
FileContent content = file.getContent(); | FileContent content = file.getContent(); | ||||
assertSameContent(m_charContent, content); | |||||
assertSameContent( m_charContent, content ); | |||||
// Test empty file | // Test empty file | ||||
file = m_baseFolder.resolveFile( "empty.txt" ); | file = m_baseFolder.resolveFile( "empty.txt" ); | ||||
content = file.getContent(); | content = file.getContent(); | ||||
assertSameContent("", content); | |||||
assertSameContent( "", content ); | |||||
} | } | ||||
/** | /** | ||||
@@ -7,7 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.aut.vfs; | package org.apache.aut.vfs; | ||||
import java.io.Writer; | |||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.Set; | import java.util.Set; | ||||
@@ -7,8 +7,8 @@ | |||||
*/ | */ | ||||
package org.apache.aut.zip; | package org.apache.aut.zip; | ||||
import junit.framework.TestCase; | |||||
import java.util.NoSuchElementException; | import java.util.NoSuchElementException; | ||||
import junit.framework.TestCase; | |||||
/** | /** | ||||
* JUnit testcases ZipEntry. | * JUnit testcases ZipEntry. | ||||
@@ -39,9 +39,9 @@ public abstract class AbstractMyrmidonTest | |||||
final String baseDirProp = System.getProperty( "test.basedir" ); | final String baseDirProp = System.getProperty( "test.basedir" ); | ||||
m_baseDir = new File( baseDirProp ); | m_baseDir = new File( baseDirProp ); | ||||
String packagePath = getClass().getName(); | String packagePath = getClass().getName(); | ||||
int idx = packagePath.lastIndexOf('.'); | |||||
packagePath = packagePath.substring(0, idx); | |||||
packagePath = packagePath.replace('.', File.separatorChar); | |||||
int idx = packagePath.lastIndexOf( '.' ); | |||||
packagePath = packagePath.substring( 0, idx ); | |||||
packagePath = packagePath.replace( '.', File.separatorChar ); | |||||
m_testBaseDir = new File( m_baseDir, packagePath ); | m_testBaseDir = new File( m_baseDir, packagePath ); | ||||
} | } | ||||
@@ -77,7 +77,7 @@ public class AbstractProjectTest | |||||
final String targetName, | final String targetName, | ||||
final String message ) | final String message ) | ||||
{ | { | ||||
executeTargetExpectError( projectFile, targetName, new String[] { message } ); | |||||
executeTargetExpectError( projectFile, targetName, new String[]{message} ); | |||||
} | } | ||||
/** | /** | ||||
@@ -171,17 +171,17 @@ public class DependencyMetricsTest | |||||
* Make sure that antlib package does not have any | * Make sure that antlib package does not have any | ||||
* unwanted dependencies. | * unwanted dependencies. | ||||
*/ | */ | ||||
/* | |||||
public void testAntlibDecoupled() | |||||
{ | |||||
final String packageName = "org.apache.antlib"; | |||||
final String[] badEfferents = new String[] | |||||
/* | |||||
public void testAntlibDecoupled() | |||||
{ | { | ||||
"org.apache.tools.ant" | |||||
}; | |||||
doTestDecoupled( packageName, badEfferents ); | |||||
} | |||||
*/ | |||||
final String packageName = "org.apache.antlib"; | |||||
final String[] badEfferents = new String[] | |||||
{ | |||||
"org.apache.tools.ant" | |||||
}; | |||||
doTestDecoupled( packageName, badEfferents ); | |||||
} | |||||
*/ | |||||
/** | /** | ||||
* Make sure there are no circular dependencies between packages because | * Make sure there are no circular dependencies between packages because | ||||
* circular dependencies are evil!!! | * circular dependencies are evil!!! | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.configurer; | package org.apache.myrmidon.components.configurer; | ||||
/** | /** | ||||
* Simple class to test typed adder. | * Simple class to test typed adder. | ||||
* | * | ||||
@@ -7,8 +7,6 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.configurer; | package org.apache.myrmidon.components.configurer; | ||||
/** | /** | ||||
* Simple class with more than one typed adder method. | * Simple class with more than one typed adder method. | ||||
* | * | ||||
@@ -36,7 +36,7 @@ public class ConfigTestPrimConvert | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
if ( !AbstractComponentTest.equals( m_integerProp, test.m_integerProp ) ) | |||||
if( !AbstractComponentTest.equals( m_integerProp, test.m_integerProp ) ) | |||||
{ | { | ||||
return false; | return false; | ||||
} | } | ||||
@@ -103,7 +103,7 @@ public class DefaultConfigurerTest | |||||
// Check result | // Check result | ||||
final ConfigTestPrimConvert expected = new ConfigTestPrimConvert(); | final ConfigTestPrimConvert expected = new ConfigTestPrimConvert(); | ||||
expected.setIntProp( 90 ); | expected.setIntProp( 90 ); | ||||
expected.setIntegerProp( new Integer(-401) ); | |||||
expected.setIntegerProp( new Integer( -401 ) ); | |||||
assertEquals( expected, test ); | assertEquals( expected, test ); | ||||
} | } | ||||
@@ -381,7 +381,7 @@ public class DefaultConfigurerTest | |||||
final ConfigTestInterfaceProp test = new ConfigTestInterfaceProp(); | final ConfigTestInterfaceProp test = new ConfigTestInterfaceProp(); | ||||
// Configure object | // Configure object | ||||
m_configurer.configure( test, config, m_context ); | |||||
m_configurer.configure( test, config, m_context ); | |||||
// Check result | // Check result | ||||
final ConfigTestInterfaceProp expected = new ConfigTestInterfaceProp(); | final ConfigTestInterfaceProp expected = new ConfigTestInterfaceProp(); | ||||
@@ -442,7 +442,7 @@ public class DefaultConfigurerTest | |||||
REZ.getString( "bad-configure-element.error", "test" ), | REZ.getString( "bad-configure-element.error", "test" ), | ||||
REZ.getString( "multiple-adder-methods-for-element.error", | REZ.getString( "multiple-adder-methods-for-element.error", | ||||
ConfigTestMultiTypedAdder.class.getName(), | ConfigTestMultiTypedAdder.class.getName(), | ||||
"") | |||||
"" ) | |||||
}; | }; | ||||
assertSameMessage( messages, ce ); | assertSameMessage( messages, ce ); | ||||
} | } | ||||
@@ -541,7 +541,7 @@ public class DefaultConfigurerTest | |||||
config.setAttribute( "my-role1", "some value" ); | config.setAttribute( "my-role1", "some value" ); | ||||
// Set up the converter and role | // Set up the converter and role | ||||
registerRole( new RoleInfo("my-role1", MyRole1.class ) ); | |||||
registerRole( new RoleInfo( "my-role1", MyRole1.class ) ); | |||||
registerConverter( ObjectToMyRole1Converter.class, String.class, MyRole1.class ); | registerConverter( ObjectToMyRole1Converter.class, String.class, MyRole1.class ); | ||||
final ConfigTestTypedProp test = new ConfigTestTypedProp(); | final ConfigTestTypedProp test = new ConfigTestTypedProp(); | ||||
@@ -69,13 +69,13 @@ public class DefaultDeployerTest | |||||
// Determine the shorthand for the DataType role | // Determine the shorthand for the DataType role | ||||
// Create the type definition | // Create the type definition | ||||
final TypeDefinition typeDef = new TypeDefinition( typeName, DATA_TYPE_ROLE, classname ); | |||||
final TypeDefinition typeDef = new TypeDefinition( typeName, DATA_TYPE_ROLE, classname ); | |||||
final ClassLoader classLoader = getClass().getClassLoader(); | final ClassLoader classLoader = getClass().getClassLoader(); | ||||
final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | ||||
// Make sure the test types have not been deployed | // Make sure the test types have not been deployed | ||||
assertTypesNotRegistered( ); | |||||
assertTypesNotRegistered(); | |||||
// Deploy the type | // Deploy the type | ||||
typeDeployer.deployType( typeDef ); | typeDeployer.deployType( typeDef ); | ||||
@@ -103,7 +103,7 @@ public class DefaultDeployerTest | |||||
final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | final TypeDeployer typeDeployer = m_deployer.createDeployer( classLoader ); | ||||
// Make sure the test types have not been deployed | // Make sure the test types have not been deployed | ||||
assertTypesNotRegistered( ); | |||||
assertTypesNotRegistered(); | |||||
// Deploy the type | // Deploy the type | ||||
typeDeployer.deployType( typeDef ); | typeDeployer.deployType( typeDef ); | ||||
@@ -176,7 +176,7 @@ public class DefaultDeployerTest | |||||
* Ensures the types from the test typelib descriptor have been correctly | * Ensures the types from the test typelib descriptor have been correctly | ||||
* deployed. | * deployed. | ||||
*/ | */ | ||||
private void assertTypesRegistered( ) throws Exception | |||||
private void assertTypesRegistered() throws Exception | |||||
{ | { | ||||
// Check the data-type | // Check the data-type | ||||
TypeFactory typeFactory = getTypeManager().getFactory( DataType.class ); | TypeFactory typeFactory = getTypeManager().getFactory( DataType.class ); | ||||
@@ -50,11 +50,11 @@ public class DefaultEmbeddorTest | |||||
final Target implicitTarget = project.getImplicitTarget(); | final Target implicitTarget = project.getImplicitTarget(); | ||||
assertEquals( 1, implicitTarget.getTasks().length ); | assertEquals( 1, implicitTarget.getTasks().length ); | ||||
assertEquals( "property", implicitTarget.getTasks()[0].getName() ); | |||||
assertEquals( "property", implicitTarget.getTasks()[ 0 ].getName() ); | |||||
final Target target = project.getTarget( "main-target" ); | final Target target = project.getTarget( "main-target" ); | ||||
assertEquals( 1, target.getTasks().length ); | assertEquals( 1, target.getTasks().length ); | ||||
assertEquals( "log", target.getTasks()[0].getName() ); | |||||
assertEquals( "log", target.getTasks()[ 0 ].getName() ); | |||||
} | } | ||||
/** | /** | ||||
@@ -7,13 +7,13 @@ | |||||
*/ | */ | ||||
package org.apache.myrmidon.components.role; | package org.apache.myrmidon.components.role; | ||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
import org.apache.myrmidon.api.Task; | import org.apache.myrmidon.api.Task; | ||||
import org.apache.myrmidon.interfaces.role.RoleManager; | |||||
import org.apache.myrmidon.interfaces.role.RoleInfo; | |||||
import org.apache.myrmidon.interfaces.role.RoleException; | import org.apache.myrmidon.interfaces.role.RoleException; | ||||
import org.apache.avalon.excalibur.i18n.Resources; | |||||
import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
import org.apache.myrmidon.interfaces.role.RoleInfo; | |||||
import org.apache.myrmidon.interfaces.role.RoleManager; | |||||
/** | /** | ||||
* Test cases for the DefaultRoleManager. | * Test cases for the DefaultRoleManager. | ||||
@@ -51,7 +51,7 @@ public class DefaultRoleManagerTest | |||||
// Lookup the role | // Lookup the role | ||||
RoleInfo role = m_roleManager.getRole( roleName ); | RoleInfo role = m_roleManager.getRole( roleName ); | ||||
assertTrue( origRole.equals(role) ); | |||||
assertTrue( origRole.equals( role ) ); | |||||
// Lookup the role by shorthand | // Lookup the role by shorthand | ||||
role = m_roleManager.getRoleByShorthandName( shorthand ); | role = m_roleManager.getRoleByShorthandName( shorthand ); | ||||
@@ -113,7 +113,7 @@ public class InstantiatingServiceManagerTest | |||||
{ | { | ||||
// Make sure that hasService() works correctly | // Make sure that hasService() works correctly | ||||
final String serviceRole = "some-unknown-service"; | final String serviceRole = "some-unknown-service"; | ||||
assertTrue( ! m_serviceManager.hasService( serviceRole ) ); | |||||
assertTrue( !m_serviceManager.hasService( serviceRole ) ); | |||||
// Make sure that lookup() fails | // Make sure that lookup() fails | ||||
try | try | ||||
@@ -9,7 +9,6 @@ package org.apache.myrmidon.interfaces.type; | |||||
import java.io.File; | import java.io.File; | ||||
import java.net.URL; | import java.net.URL; | ||||
import junit.framework.TestCase; | |||||
import org.apache.myrmidon.AbstractMyrmidonTest; | import org.apache.myrmidon.AbstractMyrmidonTest; | ||||
/** | /** | ||||