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