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