1 package org.apache.maven.shared.filtering;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Properties;
23
24 import org.apache.maven.execution.DefaultMavenExecutionRequest;
25 import org.apache.maven.execution.MavenExecutionResult;
26 import org.apache.maven.execution.MavenSession;
27 import org.apache.maven.settings.Settings;
28 import org.codehaus.plexus.PlexusContainer;
29 import org.eclipse.aether.RepositorySystemSession;
30
31
32
33
34
35
36 public class StubMavenSession
37 extends MavenSession
38 {
39
40 private Properties userProperties;
41
42 private Properties systemProperties;
43
44 private final Settings settings;
45
46 public StubMavenSession( Settings settings )
47 {
48 this( null, null, settings );
49 }
50
51 public StubMavenSession()
52 {
53 this( null, null, null );
54 }
55
56 public StubMavenSession( Properties userProperties )
57 {
58 this( null, userProperties, null );
59 }
60
61 public StubMavenSession( Properties systemProperties, Properties userProperties, Settings settings )
62 {
63
64 super( (PlexusContainer) null, (RepositorySystemSession) null, new DefaultMavenExecutionRequest(),
65 (MavenExecutionResult) null );
66
67 this.settings = settings;
68
69 this.systemProperties = new Properties();
70 if ( systemProperties != null )
71 {
72 this.systemProperties.putAll( systemProperties );
73 }
74 this.systemProperties.putAll( System.getProperties() );
75
76 this.userProperties = new Properties();
77 if ( userProperties != null )
78 {
79 this.userProperties.putAll( userProperties );
80 }
81 }
82
83 @Override
84 public Settings getSettings()
85 {
86 return settings;
87 }
88
89 @Override
90 public Properties getSystemProperties()
91 {
92 return this.systemProperties;
93 }
94
95 @Override
96 public Properties getUserProperties()
97 {
98 return this.userProperties;
99 }
100
101 }