1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.api.plugin.testing.stubs;
20
21 import java.util.Optional;
22
23 import org.apache.maven.api.MojoExecution;
24 import org.apache.maven.api.Plugin;
25 import org.apache.maven.api.model.PluginExecution;
26 import org.apache.maven.api.plugin.descriptor.MojoDescriptor;
27 import org.apache.maven.api.xml.XmlNode;
28
29
30
31
32 public class MojoExecutionStub implements MojoExecution {
33 private String executionId;
34 private String goal;
35 private XmlNode dom;
36 private Plugin plugin = new PluginStub();
37 private PluginExecution model;
38 private MojoDescriptor descriptor;
39 private String lifecyclePhase;
40
41 public MojoExecutionStub(String executionId, String goal) {
42 this(executionId, goal, null);
43 }
44
45 public MojoExecutionStub(String executionId, String goal, XmlNode dom) {
46 this.executionId = executionId;
47 this.goal = goal;
48 this.dom = dom;
49 }
50
51 @Override
52 public Plugin getPlugin() {
53 return plugin;
54 }
55
56 @Override
57 public PluginExecution getModel() {
58 return model;
59 }
60
61 @Override
62 public MojoDescriptor getDescriptor() {
63 return descriptor;
64 }
65
66 @Override
67 public String getLifecyclePhase() {
68 return lifecyclePhase;
69 }
70
71 @Override
72 public String getExecutionId() {
73 return executionId;
74 }
75
76 @Override
77 public String getGoal() {
78 return goal;
79 }
80
81 @Override
82 public Optional<XmlNode> getConfiguration() {
83 return Optional.ofNullable(dom);
84 }
85
86 public void setExecutionId(String executionId) {
87 this.executionId = executionId;
88 }
89
90 public void setGoal(String goal) {
91 this.goal = goal;
92 }
93
94 public void setDom(XmlNode dom) {
95 this.dom = dom;
96 }
97
98 public void setPlugin(Plugin plugin) {
99 this.plugin = plugin;
100 }
101
102 public void setModel(PluginExecution model) {
103 this.model = model;
104 }
105
106 public void setDescriptor(MojoDescriptor descriptor) {
107 this.descriptor = descriptor;
108 }
109
110 public void setLifecyclePhase(String lifecyclePhase) {
111 this.lifecyclePhase = lifecyclePhase;
112 }
113 }