[MSHARED-517] Refactor Code to remove usage of deprecated marked code.
 o Remove usage of deprecated marked code MavenSession.getExecutionProperties().
 o Improved StubMavenSession to use the userProperties and systemProperties.
 o Suppressing warning related to missing serial UUID in some tests.


git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1744899 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java b/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java
index fb3f9d3..eaf87ca 100644
--- a/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java
+++ b/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java
@@ -36,7 +36,6 @@
 import org.codehaus.plexus.interpolation.multi.MultiDelimiterStringSearchInterpolator;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 
-import javax.annotation.Nonnull;
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
@@ -46,6 +45,8 @@
 import java.util.List;
 import java.util.Properties;
 
+import javax.annotation.Nonnull;
+
 class BaseFilter
     extends AbstractLogEnabled
     implements DefaultFilterInfo
@@ -102,8 +103,9 @@
         // or do we have to throw an MavenFilteringException with mavenSession cannot be null
         if ( request.getMavenSession() != null )
         {
-            // execution properties wins
-            baseProps.putAll( request.getMavenSession().getExecutionProperties() );
+            // User properties have precedence over system properties
+            baseProps.putAll( request.getMavenSession().getSystemProperties() );
+            baseProps.putAll( request.getMavenSession().getUserProperties() );
         }
 
         // now we build properties to use for resources interpolation
@@ -139,8 +141,9 @@
         }
         if ( request.getMavenSession() != null )
         {
-            // execution properties wins
-            filterProperties.putAll( request.getMavenSession().getExecutionProperties() );
+            // User properties have precedence over system properties
+            filterProperties.putAll( request.getMavenSession().getSystemProperties() );
+            filterProperties.putAll( request.getMavenSession().getUserProperties() );
         }
 
         if ( request.getAdditionalProperties() != null )
diff --git a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
index edce207..058fd57 100644
--- a/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
+++ b/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
@@ -636,6 +636,7 @@
         assertEquals( "includefile.txt", files[0].getName() );
     }
 
+    @SuppressWarnings( "serial" )
     public void testEmptyDirectories()
         throws Exception
     {
@@ -694,6 +695,7 @@
         }
     }
 
+    @SuppressWarnings( "serial" )
     public void testShouldReturnGitIgnoreFiles()
         throws Exception
     {
@@ -795,6 +797,7 @@
     /**
      * unit test for MSHARED-81 : https://issues.apache.org/jira/browse/MSHARED-81
      */
+    @SuppressWarnings( "serial" )
     public void testMSHARED81()
         throws Exception
     {
@@ -856,6 +859,7 @@
     /**
      * unit test for edge cases : https://issues.apache.org/jira/browse/MSHARED-228
      */
+    @SuppressWarnings( "serial" )
     public void testEdgeCases()
         throws Exception
     {
diff --git a/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java b/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java
index 63bc645..42d1b67 100644
--- a/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java
+++ b/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java
@@ -22,7 +22,6 @@
 import java.util.Properties;
 
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.settings.Settings;
@@ -38,38 +37,47 @@
     extends MavenSession
 {
 
-    private Properties executionProperties;
+    private Properties userProperties;
+
+    private Properties systemProperties;
 
     private final Settings settings;
 
     public StubMavenSession( Settings settings )
     {
-        this( null, settings );
+        this( null, null, settings );
     }
 
     public StubMavenSession()
     {
-        this( null, null );
+        this( null, null, null );
     }
 
-    public StubMavenSession( Properties executionProperties )
+    public StubMavenSession( Properties userProperties )
     {
-        this( executionProperties, null );
+        this( null, userProperties, null );
     }
 
-    public StubMavenSession( Properties executionProperties, Settings settings )
+    public StubMavenSession( Properties systemProperties, Properties userProperties, Settings settings )
     {
 
         super( (PlexusContainer) null, (RepositorySystemSession) null, new DefaultMavenExecutionRequest(),
                (MavenExecutionResult) null );
 
         this.settings = settings;
-        this.executionProperties = new Properties();
-        if ( executionProperties != null )
+
+        this.systemProperties = new Properties();
+        if ( systemProperties != null )
         {
-            this.executionProperties.putAll( executionProperties );
+            this.systemProperties.putAll( systemProperties );
         }
-        this.executionProperties.putAll( System.getProperties() );
+        this.systemProperties.putAll( System.getProperties() );
+
+        this.userProperties = new Properties();
+        if ( userProperties != null )
+        {
+            this.userProperties.putAll( userProperties );
+        }
     }
 
     public Settings getSettings()
@@ -77,9 +85,14 @@
         return settings;
     }
 
-    public Properties getExecutionProperties()
+    public Properties getSystemProperties()
     {
-        return this.executionProperties;
+        return this.systemProperties;
+    }
+
+    public Properties getUserProperties()
+    {
+        return this.userProperties;
     }
 
 }
diff --git a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
index 8ae0725..bf5b36e 100644
--- a/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
+++ b/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java
@@ -44,8 +44,8 @@
             MavenProject mavenProject = new MavenProject();
             mavenProject.setVersion( "1.0" );
             mavenProject.setGroupId( "org.apache" );
-            Properties executionProperties = new Properties();
-            executionProperties.setProperty( "foo", "bar" );
+            Properties userProperties = new Properties();
+            userProperties.setProperty( "foo", "bar" );
             MavenFileFilter mavenFileFilter = lookup( MavenFileFilter.class );
 
             File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" );
@@ -57,7 +57,7 @@
             }
 
             mavenFileFilter.copyFile( from, to, true, mavenProject, null, false, null,
-                                      new StubMavenSession( executionProperties ) );
+                                      new StubMavenSession( userProperties ) );
 
             Properties reading = new Properties();
             readFileInputStream = new FileInputStream( to );
@@ -86,8 +86,8 @@
             MavenProject mavenProject = new MavenProject();
             mavenProject.setVersion( "1.0" );
             mavenProject.setGroupId( "org.apache" );
-            Properties executionProperties = new Properties();
-            executionProperties.setProperty( "foo", "bar" );
+            Properties userProperties = new Properties();
+            userProperties.setProperty( "foo", "bar" );
             MavenFileFilter mavenFileFilter = lookup( MavenFileFilter.class );
 
             File from = new File( getBasedir() + "/src/test/units-files/reflection-test.properties" );
@@ -99,7 +99,7 @@
             }
 
             mavenFileFilter.copyFile( from, to, false, mavenProject, null, false, null,
-                                      new StubMavenSession( executionProperties ) );
+                                      new StubMavenSession( userProperties ) );
 
             Properties reading = new Properties();
             readFileInputStream = new FileInputStream( to );