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