View Javadoc

1   package org.apache.maven.shared.release.phase;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.project.MavenProject;
23  import org.apache.maven.settings.Settings;
24  import org.apache.maven.shared.release.ReleaseResult;
25  import org.apache.maven.shared.release.config.ReleaseDescriptor;
26  import org.apache.maven.shared.release.env.ReleaseEnvironment;
27  
28  import java.util.List;
29  
30  /**
31   * Test stub for testing if a phase is executed.
32   *
33   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
34   */
35  public class ReleasePhaseStub
36      implements ReleasePhase
37  {
38      /**
39       * Whether the phase was simulated.
40       */
41      private boolean simulated;
42  
43      /**
44       * Whether the phase was executed.
45       */
46      private boolean executed;
47  
48      /**
49       * Whether the phase was cleaned.
50       */
51      private boolean cleaned;
52  
53      public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, Settings settings, List<MavenProject> reactorProjects )
54      {
55          ReleaseResult result = new ReleaseResult();
56  
57          executed = true;
58  
59          result.setResultCode( ReleaseResult.SUCCESS );
60  
61          return result;
62      }
63  
64      public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, Settings settings, List<MavenProject> reactorProjects )
65      {
66          ReleaseResult result = new ReleaseResult();
67  
68          simulated = true;
69  
70          result.setResultCode( ReleaseResult.SUCCESS );
71  
72          return result;
73      }
74  
75      public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List<MavenProject> reactorProjects )
76      {
77          ReleaseResult result = new ReleaseResult();
78  
79          executed = true;
80  
81          result.setResultCode( ReleaseResult.SUCCESS );
82  
83          return result;
84      }
85  
86      public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List<MavenProject> reactorProjects )
87      {
88          ReleaseResult result = new ReleaseResult();
89  
90          simulated = true;
91  
92          result.setResultCode( ReleaseResult.SUCCESS );
93  
94          return result;
95      }
96  
97      public ReleaseResult clean( List<MavenProject> reactorProjects )
98      {
99          ReleaseResult result = new ReleaseResult();
100 
101         cleaned = true;
102 
103         result.setResultCode( ReleaseResult.SUCCESS );
104 
105         return result;
106     }
107 
108     public boolean isExecuted()
109     {
110         return executed;
111     }
112 
113     public boolean isSimulated()
114     {
115         return simulated;
116     }
117 
118     public boolean isCleaned()
119     {
120         return cleaned;
121     }
122 }