Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java Fri Oct 17 15:36:52 2014 @@ -19,9 +19,6 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.apache.maven.shared.utils.io.IOUtil; -import org.apache.maven.shared.utils.StringUtils; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -29,11 +26,12 @@ import java.io.IOException; import java.util.Iterator; import java.util.Properties; +import org.apache.maven.shared.utils.StringUtils; +import org.apache.maven.shared.utils.io.IOUtil; /** * @author <a href="mailto:ken...@neonics.com">Kenney Westerhof</a> * @author William Ferguson - * */ public final class PropertyUtils { @@ -48,8 +46,8 @@ public final class PropertyUtils /** * Reads a property file, resolving all internal variables, using the supplied base properties. * <p> - * The properties are resolved iteratively, so if the value of property A refers to property B, - * then after resolution the value of property B will contain the value of property B. + * The properties are resolved iteratively, so if the value of property A refers to property B, then after + * resolution the value of property B will contain the value of property B. * </p> * * @param propFile The property file to load. @@ -83,13 +81,13 @@ public final class PropertyUtils // The algorithm iterates only over the fileProps which is all that is required to resolve // the properties defined within the file. This is slightly different to current, however // I suspect that this was the actual original intent. - // + // // The difference is that #loadPropertyFile(File, boolean, boolean) also resolves System properties // whose values contain expressions. I believe this is unexpected and is not validated by the test cases, // as can be verified by replacing the implementation of #loadPropertyFile(File, boolean, boolean) // with the commented variant I have provided that reuses this method. - for ( Iterator iter = fileProps.keySet().iterator(); iter.hasNext(); ) + for ( Iterator<Object> iter = fileProps.keySet().iterator(); iter.hasNext(); ) { final String k = (String) iter.next(); final String propValue = getPropertyValue( k, combinedProps ); @@ -111,7 +109,7 @@ public final class PropertyUtils public static Properties loadPropertyFile( File propfile, boolean fail, boolean useSystemProps ) throws IOException { - + final Properties baseProps = new Properties(); if ( useSystemProps ) @@ -140,16 +138,10 @@ public final class PropertyUtils return resolvedProps; } - /** - * Retrieves a property value, replacing values like ${token} - * using the Properties to look them up. - * - * It will leave unresolved properties alone, trying for System - * properties, and implements reparsing (in the case that - * the value of a property contains a key), and will - * not loop endlessly on a pair like - * test = ${test}. + * Retrieves a property value, replacing values like ${token} using the Properties to look them up. It will leave + * unresolved properties alone, trying for System properties, and implements reparsing (in the case that the value + * of a property contains a key), and will not loop endlessly on a pair like test = ${test}. * * @param k * @param p
Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java Fri Oct 17 15:36:52 2014 @@ -26,8 +26,6 @@ import static org.mockito.Mockito.when; import java.io.Reader; import java.io.StringReader; -import java.util.Arrays; -import java.util.HashSet; import org.codehaus.plexus.interpolation.Interpolator; import org.codehaus.plexus.interpolation.RecursionInterceptor; @@ -40,7 +38,7 @@ import org.mockito.MockitoAnnotations; public abstract class AbstractInterpolatorFilterReaderLineEndingTest { - @Mock + @Mock private Interpolator interpolator; @Before @@ -48,9 +46,10 @@ public abstract class AbstractInterpolat { MockitoAnnotations.initMocks( this ); } - + @Test - public void testDefaults() throws Exception + public void testDefaults() + throws Exception { when( interpolator.interpolate( eq( "${a}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE_A" ); @@ -82,7 +81,6 @@ public abstract class AbstractInterpolat reader = getDollarBracesReader( in, interpolator, "\\" ); assertEquals( "unknown expression ${unknown}", IOUtil.toString( reader ) ); } - // MSHARED-198: custom delimiters doesn't work as expected @Test @@ -91,12 +89,12 @@ public abstract class AbstractInterpolat { when( interpolator.interpolate( eq( "aaaFILTER.a.MEaaa" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" ); when( interpolator.interpolate( eq( "abcFILTER.a.MEabc" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DONE" ); - + Reader in = new StringReader( "aaaFILTER.a.MEaaa" ); Reader reader = getAaa_AaaReader( in, interpolator ); - + assertEquals( "DONE", IOUtil.toString( reader ) ); - + in = new StringReader( "abcFILTER.a.MEabc" ); reader = getAbc_AbcReader( in, interpolator ); assertEquals( "DONE", IOUtil.toString( reader ) ); @@ -104,20 +102,21 @@ public abstract class AbstractInterpolat // MSHARED-235: reader exceeds readAheadLimit @Test - public void testMarkInvalid() throws Exception + public void testMarkInvalid() + throws Exception { Reader in = new StringReader( "@\").replace(p,\"]\").replace(q,\"" ); Reader reader = getAtReader( in, interpolator, "\\" ); - assertEquals( "@\").replace(p,\"]\").replace(q,\"", IOUtil.toString( reader ) ); + assertEquals( "@\").replace(p,\"]\").replace(q,\"", IOUtil.toString( reader ) ); } protected abstract Reader getAbc_AbcReader( Reader in, Interpolator interpolator ); - + protected abstract Reader getAaa_AaaReader( Reader in, Interpolator interpolator ); - + protected abstract Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString ); - + protected abstract Reader getAtReader( Reader in, Interpolator interpolator, String escapeString ); } \ No newline at end of file Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/BoundedReaderTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/BoundedReaderTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/BoundedReaderTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/BoundedReaderTest.java Fri Oct 17 15:36:52 2014 @@ -27,66 +27,78 @@ import java.io.StringReader; import org.junit.Test; -public class BoundedReaderTest { +public class BoundedReaderTest +{ + private final Reader sr = new BufferedReader( new StringReader( "01234567890" ) ); - private final Reader sr = new BufferedReader(new StringReader("01234567890")); - - @Test - public void readTillEnd() throws IOException { - BoundedReader mr = new BoundedReader(sr, 3); - mr.mark(3); - mr.read(); - mr.read(); - mr.read(); - assertEquals(-1, mr.read()); - } - - @Test - public void readMulti() throws IOException { - BoundedReader mr = new BoundedReader(sr, 3); - char[] cbuf = new char[4]; - for (int i= 0; i < cbuf.length; i++) cbuf[i] = 'X'; - final int read = mr.read(cbuf, 0, 4); - assertEquals( 3, read); - assertEquals('0', cbuf[0]); - assertEquals('1', cbuf[1]); - assertEquals('2', cbuf[2]); - assertEquals('X', cbuf[3]); - } - - @Test - public void readMultiWithOffset() throws IOException { - BoundedReader mr = new BoundedReader(sr, 3); - char[] cbuf = new char[4]; - for (int i= 0; i < cbuf.length; i++) cbuf[i] = 'X'; - final int read = mr.read(cbuf, 1, 2); - assertEquals( 2, read); - assertEquals('X', cbuf[0]); - assertEquals('0', cbuf[1]); - assertEquals('1', cbuf[2]); - assertEquals('X', cbuf[3]); - } - - @Test - public void resetWorks() throws IOException { - BoundedReader mr = new BoundedReader(sr,3 ); - mr.read(); - mr.read(); - mr.read(); - mr.reset(); - mr.read(); - mr.read(); - mr.read(); - assertEquals(-1, mr.read()); - - } - - @Test - public void skipTest() throws IOException { - BoundedReader mr = new BoundedReader(sr, 3); - mr.skip(2); - mr.read(); - assertEquals(-1, mr.read()); - } + @Test + public void readTillEnd() + throws IOException + { + BoundedReader mr = new BoundedReader( sr, 3 ); + mr.mark( 3 ); + mr.read(); + mr.read(); + mr.read(); + assertEquals( -1, mr.read() ); + } + + @Test + public void readMulti() + throws IOException + { + BoundedReader mr = new BoundedReader( sr, 3 ); + char[] cbuf = new char[4]; + for ( int i = 0; i < cbuf.length; i++ ) + cbuf[i] = 'X'; + final int read = mr.read( cbuf, 0, 4 ); + assertEquals( 3, read ); + assertEquals( '0', cbuf[0] ); + assertEquals( '1', cbuf[1] ); + assertEquals( '2', cbuf[2] ); + assertEquals( 'X', cbuf[3] ); + } + + @Test + public void readMultiWithOffset() + throws IOException + { + BoundedReader mr = new BoundedReader( sr, 3 ); + char[] cbuf = new char[4]; + for ( int i = 0; i < cbuf.length; i++ ) + cbuf[i] = 'X'; + final int read = mr.read( cbuf, 1, 2 ); + assertEquals( 2, read ); + assertEquals( 'X', cbuf[0] ); + assertEquals( '0', cbuf[1] ); + assertEquals( '1', cbuf[2] ); + assertEquals( 'X', cbuf[3] ); + } + + @Test + public void resetWorks() + throws IOException + { + BoundedReader mr = new BoundedReader( sr, 3 ); + mr.read(); + mr.read(); + mr.read(); + mr.reset(); + mr.read(); + mr.read(); + mr.read(); + assertEquals( -1, mr.read() ); + + } + + @Test + public void skipTest() + throws IOException + { + BoundedReader mr = new BoundedReader( sr, 3 ); + mr.skip( 2 ); + mr.read(); + assertEquals( -1, mr.read() ); + } } \ No newline at end of file Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java Fri Oct 17 15:36:52 2014 @@ -42,8 +42,6 @@ import org.codehaus.plexus.PlexusTestCas public class DefaultMavenFileFilterTest extends PlexusTestCase { - - File to = new File( getBasedir(), "target/reflection-test.properties" ); @@ -132,7 +130,6 @@ public class DefaultMavenFileFilterTest assertTrue( filterProperties.getProperty( "third_filter_key" ).equals( "first and second" ) ); } - // MSHARED-161: DefaultMavenFileFilter.getDefaultFilterWrappers loads // filters from the current directory instead of using basedir @@ -150,9 +147,9 @@ public class DefaultMavenFileFilterTest req.setInjectProjectBuildFilters( true ); List<FilterWrapper> wrappers = mavenFileFilter.getDefaultFilterWrappers( req ); - - Reader reader = wrappers.get(0).getReader( new StringReader( "${filefilter} ${buildfilter}" ) ); - + + Reader reader = wrappers.get( 0 ).getReader( new StringReader( "${filefilter} ${buildfilter}" ) ); + assertEquals( "true true", IOUtil.toString( reader ) ); } @@ -176,9 +173,10 @@ public class DefaultMavenFileFilterTest reader = wrappers.get( 0 ).getReader( new StringReader( "abcFILTER.a.MEabc" ) ); assertEquals( "DONE", IOUtil.toString( reader ) ); } - + // MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the first one being left open - public void testLineWithSingleAtAndExpression() throws Exception + public void testLineWithSingleAtAndExpression() + throws Exception { MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(), "default" ); Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilterTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilterTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilterTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilterTest.java Fri Oct 17 15:36:52 2014 @@ -19,23 +19,23 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.apache.maven.shared.utils.io.IOUtil; -import org.codehaus.plexus.PlexusTestCase; - import java.io.Reader; import java.io.StringReader; import java.util.Properties; +import org.apache.maven.shared.utils.io.IOUtil; +import org.codehaus.plexus.PlexusTestCase; + /** * @author Kristian Rosenvold - * */ public class DefaultMavenReaderFilterTest extends PlexusTestCase { - public void testJustDoSomeFiltering() throws Exception + public void testJustDoSomeFiltering() + throws Exception { - assertNotNull(DefaultMavenReaderFilter.class); + assertNotNull( DefaultMavenReaderFilter.class ); MavenReaderFilter readerFilter = (MavenReaderFilter) lookup( MavenReaderFilter.class.getName(), "default" ); StringReader src = new StringReader( "t...@titi.com ${foo}" ); Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java Fri Oct 17 15:36:52 2014 @@ -19,15 +19,6 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Resource; -import org.apache.maven.settings.Settings; -import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; -import org.codehaus.plexus.interpolation.ValueSource; -import org.apache.maven.shared.utils.io.FileUtils; -import org.apache.maven.shared.utils.io.IOUtil; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -37,6 +28,15 @@ import java.util.Collections; import java.util.List; import java.util.Properties; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Resource; +import org.apache.maven.settings.Settings; +import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.utils.io.IOUtil; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; +import org.codehaus.plexus.interpolation.ValueSource; + /** * @author Olivier Lamy * @version $Id$ @@ -85,8 +85,8 @@ public class DefaultMavenResourcesFilter resource.setFiltering( true ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); @@ -116,13 +116,13 @@ public class DefaultMavenResourcesFilter List<String> filtersFile = new ArrayList<String>(); Settings settings = new Settings(); - settings.setLocalRepository( - System.getProperty( "localRepository", System.getProperty( "maven.repo.local", "/path/to/local/repo" ) ) ); + settings.setLocalRepository( System.getProperty( "localRepository", + System.getProperty( "maven.repo.local", "/path/to/local/repo" ) ) ); MavenSession session = new StubMavenSession( settings ); mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), session ); + Collections.<String> emptyList(), session ); Properties result = new Properties(); FileInputStream in = null; @@ -167,8 +167,8 @@ public class DefaultMavenResourcesFilter resource.setFiltering( true ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); MavenResourcesExecution mavenResourcesExecution = @@ -205,8 +205,8 @@ public class DefaultMavenResourcesFilter resource.setFiltering( true ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); Properties additionalProperties = new Properties(); @@ -221,8 +221,7 @@ public class DefaultMavenResourcesFilter assertFiltering( baseDir, initialImageFile, true, true ); } - private void assertFiltering( File baseDir, File initialImageFile, boolean escapeTest, - boolean additionnalProperties ) + private void assertFiltering( File baseDir, File initialImageFile, boolean escapeTest, boolean additionnalProperties ) throws Exception { assertEquals( 7, outputDirectory.listFiles().length ); @@ -319,8 +318,8 @@ public class DefaultMavenResourcesFilter resource.setFiltering( true ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); @@ -361,7 +360,7 @@ public class DefaultMavenResourcesFilter resource.setDirectory( unitFilesDir ); resource.setFiltering( false ); mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, "UTF-8", null, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); assertEquals( 7, outputDirectory.listFiles().length ); Properties result = @@ -439,12 +438,12 @@ public class DefaultMavenResourcesFilter resource.addInclude( "includ*" ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); File[] files = outputDirectory.listFiles(); @@ -476,12 +475,12 @@ public class DefaultMavenResourcesFilter resource.addInclude( "**/includ*" ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); File[] files = outputDirectory.listFiles(); @@ -517,12 +516,12 @@ public class DefaultMavenResourcesFilter resource.addExclude( "**/excludedir/**" ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); File[] files = outputDirectory.listFiles(); @@ -574,12 +573,12 @@ public class DefaultMavenResourcesFilter FileUtils.cleanDirectory( targetPathFile ); } List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); File[] files = targetPathFile.listFiles(); @@ -609,12 +608,12 @@ public class DefaultMavenResourcesFilter resource.addInclude( "includ*" ); resource.setTargetPath( "testTargetPath" ); List<String> filtersFile = new ArrayList<String>(); - filtersFile.add( - getBasedir() + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); + filtersFile.add( getBasedir() + + "/src/test/units-files/maven-resources-filtering/empty-maven-resources-filtering.txt" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); File targetPathFile = new File( outputDirectory, "testTargetPath" ); @@ -646,7 +645,7 @@ public class DefaultMavenResourcesFilter } ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", Collections.EMPTY_LIST, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesExecution.setIncludeEmptyDirs( true ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); @@ -718,7 +717,7 @@ public class DefaultMavenResourcesFilter File output = new File( outputDirectory, "MSHARED-81" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, output, mavenProject, "UTF-8", Collections.EMPTY_LIST, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesExecution.setIncludeEmptyDirs( true ); mavenResourcesExecution.setEscapeString( "\\" ); @@ -726,8 +725,9 @@ public class DefaultMavenResourcesFilter Properties filteredResult = PropertyUtils.loadPropertyFile( new File( output, "filtered.properties" ), null ); - Properties expectedFilteredResult = PropertyUtils.loadPropertyFile( - new File( getBasedir() + "/src/test/units-files/MSHARED-81", "expected-filtered.properties" ), null ); + Properties expectedFilteredResult = + PropertyUtils.loadPropertyFile( new File( getBasedir() + "/src/test/units-files/MSHARED-81", + "expected-filtered.properties" ), null ); System.out.println( "\nExpected:\n" ); expectedFilteredResult.list( System.out ); @@ -739,8 +739,9 @@ public class DefaultMavenResourcesFilter Properties nonFilteredResult = PropertyUtils.loadPropertyFile( new File( output, "unfiltered.properties" ), null ); - Properties expectedNonFilteredResult = PropertyUtils.loadPropertyFile( - new File( getBasedir() + "/src/test/units-files/MSHARED-81/resources", "unfiltered.properties" ), null ); + Properties expectedNonFilteredResult = + PropertyUtils.loadPropertyFile( new File( getBasedir() + "/src/test/units-files/MSHARED-81/resources", + "unfiltered.properties" ), null ); assertTrue( nonFilteredResult.equals( expectedNonFilteredResult ) ); } @@ -782,7 +783,7 @@ public class DefaultMavenResourcesFilter File output = new File( outputDirectory, "edge-cases" ); MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, output, mavenProject, "UTF-8", Collections.EMPTY_LIST, - Collections.<String>emptyList(), new StubMavenSession() ); + Collections.<String> emptyList(), new StubMavenSession() ); mavenResourcesExecution.setIncludeEmptyDirs( true ); mavenResourcesExecution.setEscapeString( "\\" ); @@ -790,8 +791,9 @@ public class DefaultMavenResourcesFilter Properties filteredResult = PropertyUtils.loadPropertyFile( new File( output, "filtered.properties" ), null ); - Properties expectedFilteredResult = PropertyUtils.loadPropertyFile( - new File( getBasedir() + "/src/test/units-files/edge-cases", "expected-filtered.properties" ), null ); + Properties expectedFilteredResult = + PropertyUtils.loadPropertyFile( new File( getBasedir() + "/src/test/units-files/edge-cases", + "expected-filtered.properties" ), null ); System.out.println( "\nExpected:\n" ); expectedFilteredResult.list( System.out ); @@ -803,12 +805,13 @@ public class DefaultMavenResourcesFilter Properties nonFilteredResult = PropertyUtils.loadPropertyFile( new File( output, "unfiltered.properties" ), null ); - Properties expectedNonFilteredResult = PropertyUtils.loadPropertyFile( - new File( getBasedir() + "/src/test/units-files/edge-cases/resources", "unfiltered.properties" ), null ); + Properties expectedNonFilteredResult = + PropertyUtils.loadPropertyFile( new File( getBasedir() + "/src/test/units-files/edge-cases/resources", + "unfiltered.properties" ), null ); assertTrue( nonFilteredResult.equals( expectedNonFilteredResult ) ); } - + // MSHARED-220: Apply filtering to filenames public void testFilterFileName() throws Exception @@ -832,8 +835,9 @@ public class DefaultMavenResourcesFilter resource.setTargetPath( "testTargetPath" ); MavenResourcesExecution mavenResourcesExecution = - new MavenResourcesExecution( Collections.singletonList( resource ), outputDirectory, mavenProject, "UTF-8", Collections.<String>emptyList(), - Collections.<String>emptyList(), new StubMavenSession() ); + new MavenResourcesExecution( Collections.singletonList( resource ), outputDirectory, mavenProject, "UTF-8", + Collections.<String> emptyList(), Collections.<String> emptyList(), + new StubMavenSession() ); mavenResourcesExecution.setFilterFilenames( true ); mavenResourcesFiltering.filterResources( mavenResourcesExecution ); Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java Fri Oct 17 15:36:52 2014 @@ -27,18 +27,17 @@ import java.util.List; import java.util.Properties; import org.apache.maven.model.Resource; -import org.codehaus.plexus.PlexusTestCase; import org.apache.maven.shared.utils.io.FileUtils; import org.apache.maven.shared.utils.io.IOUtil; +import org.codehaus.plexus.PlexusTestCase; /** * @author Olivier Lamy - * */ public class EscapeStringTest extends PlexusTestCase { - + File outputDirectory = new File( getBasedir(), "target/EscapeStringTest" ); File unitDirectory = new File( getBasedir(), "src/test/units-files/escape-remove-char" ); @@ -68,8 +67,8 @@ public class EscapeStringTest projectProperties.put( "java.version", "zloug" ); projectProperties.put( "replaceThis", "I am the replacement" ); mavenProject.setProperties( projectProperties ); - MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class - .getName() ); + MavenResourcesFiltering mavenResourcesFiltering = + (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class.getName() ); Resource resource = new Resource(); List<Resource> resources = new ArrayList<Resource>(); @@ -81,11 +80,9 @@ public class EscapeStringTest List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); - MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, - mavenProject, "UTF-8", - filtersFile, - nonFilteredFileExtensions, - new StubMavenSession() ); + MavenResourcesExecution mavenResourcesExecution = + new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, + nonFilteredFileExtensions, new StubMavenSession() ); mavenResourcesExecution.setUseDefaultFilterWrappers( true ); mavenResourcesExecution.setEscapeString( "!" ); Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java Fri Oct 17 15:36:52 2014 @@ -47,24 +47,25 @@ public class FilteringUtilsTest // This doesn't work, see MSHARED-121 /* - public void testEscapeWindowsPathStartingWithDrivelessAbsolutePath() - { - assertEquals( "\\\\Users\\\\Administrator", FilteringUtils.escapeWindowsPath( "\\Users\\Administrator" ) ); - } - */ + * public void testEscapeWindowsPathStartingWithDrivelessAbsolutePath() + * { + * assertEquals( "\\\\Users\\\\Administrator", FilteringUtils.escapeWindowsPath( "\\Users\\Administrator" ) ); + * } + */ // This doesn't work, see MSHARED-121 /* - public void testEscapeWindowsPathStartingWithExpression() - { - assertEquals( "${pathExpr}\\\\Documents", FilteringUtils.escapeWindowsPath( "${pathExpr}\\Documents" ) ); - } - */ + * public void testEscapeWindowsPathStartingWithExpression() + * { + * assertEquals( "${pathExpr}\\\\Documents", FilteringUtils.escapeWindowsPath( "${pathExpr}\\Documents" ) ); + * } + */ // MSHARED-179 public void testEscapeWindowsPathNotAtBeginning() throws Exception { - assertEquals( "jdbc:derby:C:\\\\Users\\\\Administrator/test;create=true", FilteringUtils.escapeWindowsPath( "jdbc:derby:C:\\Users\\Administrator/test;create=true" ) ); + assertEquals( "jdbc:derby:C:\\\\Users\\\\Administrator/test;create=true", + FilteringUtils.escapeWindowsPath( "jdbc:derby:C:\\Users\\Administrator/test;create=true" ) ); } } Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java Fri Oct 17 15:36:52 2014 @@ -37,19 +37,21 @@ public class InterpolatorFilterReaderLin { return new InterpolatorFilterReaderLineEnding( in, interpolator, "abc", "abc", true ); } - + @Override protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString ) { - InterpolatorFilterReaderLineEnding reader = new InterpolatorFilterReaderLineEnding( in, interpolator, "${", "}", true ); + InterpolatorFilterReaderLineEnding reader = + new InterpolatorFilterReaderLineEnding( in, interpolator, "${", "}", true ); reader.setEscapeString( escapeString ); return reader; } - + @Override protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString ) { - InterpolatorFilterReaderLineEnding reader = new InterpolatorFilterReaderLineEnding( in, interpolator, "@", "@", true ); + InterpolatorFilterReaderLineEnding reader = + new InterpolatorFilterReaderLineEnding( in, interpolator, "@", "@", true ); reader.setEscapeString( escapeString ); return reader; } Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InvalidMarkTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InvalidMarkTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InvalidMarkTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InvalidMarkTest.java Fri Oct 17 15:36:52 2014 @@ -23,8 +23,8 @@ import java.io.File; import java.util.Collections; import org.apache.maven.model.Resource; -import org.codehaus.plexus.PlexusTestCase; import org.apache.maven.shared.utils.io.FileUtils; +import org.codehaus.plexus.PlexusTestCase; /** * @author Mikolaj Izdebski @@ -48,20 +48,18 @@ public class InvalidMarkTest public void testEscape() throws Exception { - MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class - .getName() ); + MavenResourcesFiltering mavenResourcesFiltering = + (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class.getName() ); Resource resource = new Resource(); resource.setDirectory( "src/test/units-files/MSHARED-325" ); resource.setFiltering( true ); - MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( Collections.singletonList( resource ), - outputDirectory, - new StubMavenProject( new File(".") ), - "UTF-8", - Collections.<String>emptyList(), - Collections.<String>emptyList(), - new StubMavenSession() ); + MavenResourcesExecution mavenResourcesExecution = + new MavenResourcesExecution( Collections.singletonList( resource ), outputDirectory, + new StubMavenProject( new File( "." ) ), "UTF-8", + Collections.<String> emptyList(), Collections.<String> emptyList(), + new StubMavenSession() ); try { Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MuliLinesMavenResourcesFilteringTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MuliLinesMavenResourcesFilteringTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MuliLinesMavenResourcesFilteringTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MuliLinesMavenResourcesFilteringTest.java Fri Oct 17 15:36:52 2014 @@ -27,14 +27,12 @@ import java.util.List; import java.util.Properties; import org.apache.maven.model.Resource; -import org.codehaus.plexus.PlexusTestCase; import org.apache.maven.shared.utils.io.FileUtils; import org.apache.maven.shared.utils.io.IOUtil; +import org.codehaus.plexus.PlexusTestCase; /** * @author Olivier Lamy - * - * * @version $Id$ */ public class MuliLinesMavenResourcesFilteringTest @@ -55,7 +53,6 @@ public class MuliLinesMavenResourcesFilt } /** - * * @throws Exception */ public void testFilteringTokenOnce() @@ -71,7 +68,8 @@ public class MuliLinesMavenResourcesFilt projectProperties.put( "foo", "bar" ); projectProperties.put( "java.version", "zloug" ); mavenProject.setProperties( projectProperties ); - MavenResourcesFiltering mavenResourcesFiltering = (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class.getName() ); + MavenResourcesFiltering mavenResourcesFiltering = + (MavenResourcesFiltering) lookup( MavenResourcesFiltering.class.getName() ); String unitFilesDir = getBasedir() + "/src/test/units-files/MRESOURCES-104"; @@ -86,14 +84,11 @@ public class MuliLinesMavenResourcesFilt List<String> nonFilteredFileExtensions = Collections.singletonList( "gif" ); - MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, outputDirectory, - mavenProject, "UTF-8", - filtersFile, - nonFilteredFileExtensions, - new StubMavenSession() ); + MavenResourcesExecution mavenResourcesExecution = + new MavenResourcesExecution( resources, outputDirectory, mavenProject, "UTF-8", filtersFile, + nonFilteredFileExtensions, new StubMavenSession() ); mavenResourcesExecution.setUseDefaultFilterWrappers( true ); - - + mavenResourcesFiltering.filterResources( mavenResourcesExecution ); Properties result = new Properties(); @@ -107,11 +102,11 @@ public class MuliLinesMavenResourcesFilt { IOUtil.close( in ); } - - System.out.println("properties " + result.toString()); - //email=f...@bar.com - //foo=${project.version} - //bar=@project.version@ + + System.out.println( "properties " + result.toString() ); + // email=f...@bar.com + // foo=${project.version} + // bar=@project.version@ assertEquals( "1.0", result.get( "foo" ) ); assertEquals( "1.0", result.get( "bar" ) ); assertEquals( "f...@bar.com", result.get( "email" ) ); Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java Fri Oct 17 15:36:52 2014 @@ -38,10 +38,11 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -public class MultiDelimiterInterpolatorFilterReaderLineEndingTest extends AbstractInterpolatorFilterReaderLineEndingTest +public class MultiDelimiterInterpolatorFilterReaderLineEndingTest + extends AbstractInterpolatorFilterReaderLineEndingTest { - @Mock + @Mock private Interpolator interpolator; @Before @@ -49,36 +50,40 @@ public class MultiDelimiterInterpolatorF { MockitoAnnotations.initMocks( this ); } - + @Override protected Reader getAaa_AaaReader( Reader in, Interpolator interpolator ) { - MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); + MultiDelimiterInterpolatorFilterReaderLineEnding reader = + new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setDelimiterSpecs( Collections.singleton( "aaa*aaa" ) ); return reader; } - + @Override protected Reader getAbc_AbcReader( Reader in, Interpolator interpolator ) { - MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); + MultiDelimiterInterpolatorFilterReaderLineEnding reader = + new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setDelimiterSpecs( Collections.singleton( "abc*abc" ) ); return reader; } - + @Override protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String escapeString ) { - MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); + MultiDelimiterInterpolatorFilterReaderLineEnding reader = + new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setDelimiterSpecs( Collections.singleton( "${*}" ) ); reader.setEscapeString( escapeString ); return reader; } - + @Override protected Reader getAtReader( Reader in, Interpolator interpolator, String escapeString ) { - MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); + MultiDelimiterInterpolatorFilterReaderLineEnding reader = + new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setDelimiterSpecs( Collections.singleton( "@" ) ); reader.setEscapeString( escapeString ); return reader; @@ -95,24 +100,25 @@ public class MultiDelimiterInterpolatorF MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) ); - + assertEquals( "t...@titi.com bar", IOUtil.toString( reader ) ); } - + // http://stackoverflow.com/questions/21786805/maven-war-plugin-customize-filter-delimitters-in-webresources/ @Test - public void testAtDollarExpression() throws Exception + public void testAtDollarExpression() + throws Exception { when( interpolator.interpolate( eq( "${db.server}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_SERVER" ); when( interpolator.interpolate( eq( "${db.port}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_PORT" ); when( interpolator.interpolate( eq( "${db.name}" ), eq( "" ), isA( RecursionInterceptor.class ) ) ).thenReturn( "DB_NAME" ); - + Reader in = new StringReader( " url=\"jdbc:oracle:thin:\\@${db.server}:${db.port}:${db.name}\"" ); MultiDelimiterInterpolatorFilterReaderLineEnding reader = - new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); + new MultiDelimiterInterpolatorFilterReaderLineEnding( in, interpolator, true ); reader.setEscapeString( "\\" ); reader.setDelimiterSpecs( new HashSet<String>( Arrays.asList( "${*}", "@" ) ) ); - + assertEquals( " url=\"jdbc:oracle:thin:@DB_SERVER:DB_PORT:DB_NAME\"", IOUtil.toString( reader ) ); } } Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java Fri Oct 17 15:36:52 2014 @@ -33,14 +33,14 @@ public class StubMavenProject extends MavenProject { private Properties properties; - + private File basedir; - protected StubMavenProject (File basedir) + protected StubMavenProject( File basedir ) { this.basedir = basedir; } - + public Properties getProperties() { return this.properties; @@ -51,19 +51,18 @@ public class StubMavenProject this.properties = properties; } - public void addProperty(String key, String value) + public void addProperty( String key, String value ) { - if (this.properties == null) + if ( this.properties == null ) { this.properties = new Properties(); } this.properties.put( key, value ); } - + public File getBasedir() { return basedir; } - } Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java Fri Oct 17 15:36:52 2014 @@ -34,9 +34,9 @@ public class StubMavenSession { private Properties executionProperties; - + private final Settings settings; - + public StubMavenSession( Settings settings ) { this( null, settings ); @@ -51,11 +51,11 @@ public class StubMavenSession { this( executionProperties, null ); } - + public StubMavenSession( Properties executionProperties, Settings settings ) { super( null, null, null, null, null, null, null, null, null ); - + this.settings = settings; this.executionProperties = new Properties(); if ( executionProperties != null ) @@ -64,7 +64,7 @@ public class StubMavenSession } this.executionProperties.putAll( System.getProperties() ); } - + public Settings getSettings() { return settings; Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java (original) +++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java Fri Oct 17 15:36:52 2014 @@ -51,11 +51,11 @@ public class TestReflectionProperties File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" ); File to = new File( getBasedir() + "/target/reflection-test.properties" ); - if (to.exists()) + if ( to.exists() ) { to.delete(); - } - + } + mavenFileFilter.copyFile( from, to, true, mavenProject, null, false, null, new StubMavenSession( executionProperties ) ); @@ -93,11 +93,11 @@ public class TestReflectionProperties File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" ); File to = new File( getBasedir() + "/target/reflection-test.properties" ); - if (to.exists()) + if ( to.exists() ) { to.delete(); } - + mavenFileFilter.copyFile( from, to, false, mavenProject, null, false, null, new StubMavenSession( executionProperties ) ); @@ -117,6 +117,6 @@ public class TestReflectionProperties } } - } - + } + }