1 package org.apache.maven.lifecycle.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23 import org.apache.maven.execution.MavenSession;
24 import org.apache.maven.lifecycle.internal.stub.LifecycleTaskSegmentCalculatorStub;
25 import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
26
27 import java.util.List;
28
29
30
31
32 public class LifecycleTaskSegmentCalculatorImplTest
33 extends TestCase
34 {
35 public void testCalculateProjectBuilds()
36 throws Exception
37 {
38 LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator = getTaskSegmentCalculator();
39 BuildListCalculator buildListCalculator = new BuildListCalculator();
40 final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
41 List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
42
43 final ProjectBuildList buildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );
44 final ProjectBuildList segments = buildList.getByTaskSegment( taskSegments.get( 0 ) );
45 assertEquals( "Stub data contains 3 segments", 3, taskSegments.size() );
46 assertEquals( "Stub data contains 6 items", 6, segments.size() );
47 final ProjectSegment build = segments.get( 0 );
48 assertNotNull( build );
49 }
50
51 private static LifecycleTaskSegmentCalculator getTaskSegmentCalculator()
52 {
53 return new LifecycleTaskSegmentCalculatorStub();
54 }
55
56
57 }