archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r583632 - /maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumerUtilTest.java
Date Wed, 10 Oct 2007 22:38:44 GMT
would "new File( path ).getCanonicalPath()" be more suitable?

On 11/10/2007, at 12:23 AM, joakime@apache.org wrote:

> Author: joakime
> Date: Wed Oct 10 15:23:04 2007
> New Revision: 583632
>
> URL: http://svn.apache.org/viewvc?rev=583632&view=rev
> Log:
> [MRM-534] Test failure in RepositoryContentConsumerUtilTest
> Fixed OS specific validation in mock object to be OS neutral.
>
> Modified:
>     maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
> test/java/org/apache/maven/archiva/repository/scanner/ 
> RepositoryContentConsumerUtilTest.java
>
> Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/ 
> src/test/java/org/apache/maven/archiva/repository/scanner/ 
> RepositoryContentConsumerUtilTest.java
> URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/ 
> archiva-repository-layer/src/test/java/org/apache/maven/archiva/ 
> repository/scanner/RepositoryContentConsumerUtilTest.java? 
> rev=583632&r1=583631&r2=583632&view=diff
> ====================================================================== 
> ========
> --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
> test/java/org/apache/maven/archiva/repository/scanner/ 
> RepositoryContentConsumerUtilTest.java (original)
> +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/ 
> test/java/org/apache/maven/archiva/repository/scanner/ 
> RepositoryContentConsumerUtilTest.java Wed Oct 10 15:23:04 2007
> @@ -19,6 +19,7 @@
>   * under the License.
>   */
>
> +import org.apache.commons.lang.SystemUtils;
>  import  
> org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
>  import  
> org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
>  import  
> org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
> @@ -27,6 +28,8 @@
>  import org.codehaus.plexus.PlexusTestCase;
>  import org.easymock.MockControl;
>
> +import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
> +
>  import java.io.File;
>  import java.util.Collections;
>  import java.util.List;
> @@ -121,13 +124,13 @@
>
>          ManagedRepositoryConfiguration repo = createRepository 
> ( "id", "name", getTestFile( "target/test-repo" ) );
>          File testFile = getTestFile( "target/test-repo/path/to/ 
> test-file.txt" );
> -
> +
>          knownConsumer.beginScan( repo );
>          knownConsumer.getExcludes();
>          knownControl.setReturnValue( Collections.EMPTY_LIST );
>          knownConsumer.getIncludes();
>          knownControl.setReturnValue( Collections.singletonList 
> ( "**/*.txt" ) );
> -        knownConsumer.processFile( "path/to/test-file.txt" );
> +        knownConsumer.processFile( _OS("path/to/test-file.txt") );
>  //        knownConsumer.completeScan();
>          knownControl.replay();
>
> @@ -154,7 +157,7 @@
>          knownControl.replay();
>
>          invalidConsumer.beginScan( repo );
> -        invalidConsumer.processFile( "path/to/test-file.xml" );
> +        invalidConsumer.processFile( _OS("path/to/test-file.xml") );
>          invalidConsumer.getId();
>          invalidControl.setReturnValue( "invalid" );
>  //        invalidConsumer.completeScan();
> @@ -177,7 +180,7 @@
>          knownControl.replay();
>
>          invalidConsumer.beginScan( repo );
> -        invalidConsumer.processFile( "path/to/test-file.txt" );
> +        invalidConsumer.processFile( _OS("path/to/test-file.txt") );
>          invalidConsumer.getId();
>          invalidControl.setReturnValue( "invalid" );
>  //        invalidConsumer.completeScan();
> @@ -187,5 +190,18 @@
>
>          knownControl.verify();
>          invalidControl.verify();
> +    }
> +
> +    /**
> +     * Create an OS specific version of the filepath.
> +     * Provide path in unix "/" format.
> +     */
> +    private String _OS( String path )
> +    {
> +        if ( SystemUtils.IS_OS_WINDOWS )
> +        {
> +            return path.replace( '/', '\\' );
> +        }
> +        return path;
>      }
>  }
>

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/

Mime
View raw message