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.lifecycle;
20  
21  import org.apache.maven.AbstractCoreMavenComponentTestCase;
22  import org.apache.maven.exception.ExceptionHandler;
23  import org.apache.maven.lifecycle.internal.LifecycleDependencyResolver;
24  import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
25  import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
26  import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
27  import org.apache.maven.lifecycle.internal.MojoExecutor;
28  import org.codehaus.plexus.component.annotations.Requirement;
29  
30  /**
31   * Just asserts that it's able to create those components. Handy when plexus gets a nervous breakdown.
32   *
33   * @author Kristian Rosenvold
34   */
35  public class LifecycleExecutorSubModulesTest extends AbstractCoreMavenComponentTestCase {
36      @Requirement
37      private DefaultLifecycles defaultLifeCycles;
38  
39      @Requirement
40      private MojoExecutor mojoExecutor;
41  
42      @Requirement
43      private LifecycleModuleBuilder lifeCycleBuilder;
44  
45      @Requirement
46      private LifecycleDependencyResolver lifeCycleDependencyResolver;
47  
48      @Requirement
49      private LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
50  
51      @Requirement
52      private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
53  
54      @Requirement
55      private LifecycleTaskSegmentCalculator lifeCycleTaskSegmentCalculator;
56  
57      protected void setUp() throws Exception {
58          super.setUp();
59          defaultLifeCycles = lookup(DefaultLifecycles.class);
60          mojoExecutor = lookup(MojoExecutor.class);
61          lifeCycleBuilder = lookup(LifecycleModuleBuilder.class);
62          lifeCycleDependencyResolver = lookup(LifecycleDependencyResolver.class);
63          lifeCycleExecutionPlanCalculator = lookup(LifecycleExecutionPlanCalculator.class);
64          lifeCyclePluginAnalyzer = lookup(LifeCyclePluginAnalyzer.class);
65          lifeCycleTaskSegmentCalculator = lookup(LifecycleTaskSegmentCalculator.class);
66          lookup(ExceptionHandler.class);
67      }
68  
69      @Override
70      protected void tearDown() throws Exception {
71          defaultLifeCycles = null;
72          super.tearDown();
73      }
74  
75      protected String getProjectsDirectory() {
76          return "src/test/projects/lifecycle-executor";
77      }
78  
79      public void testCreation() throws Exception {
80          assertNotNull(defaultLifeCycles);
81          assertNotNull(mojoExecutor);
82          assertNotNull(lifeCycleBuilder);
83          assertNotNull(lifeCycleDependencyResolver);
84          assertNotNull(lifeCycleExecutionPlanCalculator);
85          assertNotNull(lifeCyclePluginAnalyzer);
86          assertNotNull(lifeCycleTaskSegmentCalculator);
87      }
88  }