View Javadoc
1   package org.apache.maven.lifecycle.internal;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
5    * agreements. See the NOTICE file distributed with this work for additional information regarding
6    * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance with the License. You may obtain a
8    * 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, software distributed under the License
13   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14   * or implied. See the License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  
18  import junit.framework.TestCase;
19  
20  import org.apache.maven.artifact.Artifact;
21  import org.apache.maven.execution.MavenSession;
22  import org.apache.maven.lifecycle.MavenExecutionPlan;
23  import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
24  import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
25  import org.apache.maven.lifecycle.internal.stub.LoggerStub;
26  import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
27  
28  import java.util.HashSet;
29  
30  /**
31   * @author Kristian Rosenvold
32   */
33  public class BuilderCommonTest
34      extends TestCase
35  {
36      public void testResolveBuildPlan()
37          throws Exception
38      {
39          MavenSession original = ProjectDependencyGraphStub.getMavenSession();
40  
41          final TaskSegment taskSegment1 = new TaskSegment( false );
42          final MavenSession session1 = original.clone();
43          session1.setCurrentProject( ProjectDependencyGraphStub.A );
44  
45          final BuilderCommon builderCommon = getBuilderCommon();
46          final MavenExecutionPlan plan =
47              builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
48                                              new HashSet<Artifact>() );
49          assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );
50  
51      }
52  
53  
54      public void testHandleBuildError()
55          throws Exception
56      {
57      }
58  
59      public void testAttachToThread()
60          throws Exception
61      {
62      }
63  
64      public void testGetKey()
65          throws Exception
66      {
67      }
68  
69      public static BuilderCommon getBuilderCommon()
70      {
71          final LifecycleDebugLogger logger = new LifecycleDebugLogger( new LoggerStub() );
72          return new BuilderCommon( logger, new LifecycleExecutionPlanCalculatorStub(),
73                                    new LoggerStub() );
74      }
75  
76  }