001package 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
018import junit.framework.TestCase;
019
020import org.apache.maven.artifact.Artifact;
021import org.apache.maven.execution.MavenSession;
022import org.apache.maven.lifecycle.MavenExecutionPlan;
023import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
024import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
025import org.apache.maven.lifecycle.internal.stub.LoggerStub;
026import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
027
028import java.util.HashSet;
029
030/**
031 * @author Kristian Rosenvold
032 */
033public class BuilderCommonTest
034    extends TestCase
035{
036    public void testResolveBuildPlan()
037        throws Exception
038    {
039        MavenSession original = ProjectDependencyGraphStub.getMavenSession();
040
041        final TaskSegment taskSegment1 = new TaskSegment( false );
042        final MavenSession session1 = original.clone();
043        session1.setCurrentProject( ProjectDependencyGraphStub.A );
044
045        final BuilderCommon builderCommon = getBuilderCommon();
046        final MavenExecutionPlan plan =
047            builderCommon.resolveBuildPlan( session1, ProjectDependencyGraphStub.A, taskSegment1,
048                                            new HashSet<Artifact>() );
049        assertEquals( LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan().size(), plan.size() );
050
051    }
052
053
054    public void testHandleBuildError()
055        throws Exception
056    {
057    }
058
059    public void testAttachToThread()
060        throws Exception
061    {
062    }
063
064    public void testGetKey()
065        throws Exception
066    {
067    }
068
069    public static BuilderCommon getBuilderCommon()
070    {
071        final LifecycleDebugLogger logger = new LifecycleDebugLogger( new LoggerStub() );
072        return new BuilderCommon( logger, new LifecycleExecutionPlanCalculatorStub(),
073                                  new LoggerStub() );
074    }
075
076}