001    package org.apache.maven.lifecycle.internal;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
005     * agreements. See the NOTICE file distributed with this work for additional information regarding
006     * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance with the License. You may obtain a
008     * copy of the License at
009     *
010     * http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software distributed under the License
013     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
014     * or implied. See the License for the specific language governing permissions and limitations under
015     * the License.
016     */
017    
018    import junit.framework.TestCase;
019    import org.apache.maven.artifact.Artifact;
020    import org.apache.maven.execution.MavenSession;
021    import org.apache.maven.lifecycle.MavenExecutionPlan;
022    import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
023    import org.apache.maven.lifecycle.internal.stub.LoggerStub;
024    import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
025    
026    import java.util.HashSet;
027    
028    /**
029     * @author Kristian Rosenvold
030     */
031    public class BuilderCommonTest
032        extends TestCase
033    {
034        public void testResolveBuildPlan()
035            throws Exception
036        {
037            MavenSession original = ProjectDependencyGraphStub.getMavenSession();
038    
039            final TaskSegment taskSegment1 = new TaskSegment( false );
040            final MavenSession session1 = original.clone();
041            session1.setCurrentProject( ProjectDependencyGraphStub.A );
042    
043            final BuilderCommon builderCommon = getBuilderCommon();
044            final MavenExecutionPlan plan =
045                builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
046                                                new HashSet<Artifact>() );
047            assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );
048    
049        }
050    
051    
052        public void testHandleBuildError()
053            throws Exception
054        {
055        }
056    
057        public void testAttachToThread()
058            throws Exception
059        {
060        }
061    
062        public void testGetKey()
063            throws Exception
064        {
065        }
066    
067        public static BuilderCommon getBuilderCommon()
068        {
069            final LifecycleDebugLogger logger = new LifecycleDebugLogger( new LoggerStub() );
070            return new BuilderCommon( logger, new LifecycleExecutionPlanCalculatorStub(),
071                                      new LoggerStub() );
072        }
073    
074    }