1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.maven.lifecycle;
17
18 import junit.framework.TestCase;
19
20 import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
21 import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
22 import org.apache.maven.model.Plugin;
23
24 import java.util.Set;
25
26
27
28
29 public class MavenExecutionPlanTest
30 extends TestCase
31 {
32
33 public void testFindLastInPhase()
34 throws Exception
35 {
36 MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
37
38 ExecutionPlanItem expected = plan.findLastInPhase( "package" );
39 ExecutionPlanItem beerPhase = plan.findLastInPhase( "BEER" );
40 assertEquals( expected, beerPhase );
41 assertNotNull( expected );
42 }
43
44 public void testThreadSafeMojos()
45 throws Exception
46 {
47 MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
48 final Set<Plugin> unSafePlugins = plan.getNonThreadSafePlugins();
49
50 assertEquals( plan.size() - 1, unSafePlugins.size() );
51
52 }
53
54
55 public void testFindLastWhenFirst()
56 throws Exception
57 {
58 MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
59
60 ExecutionPlanItem beerPhase = plan.findLastInPhase(
61 LifecycleExecutionPlanCalculatorStub.VALIDATE.getPhase() );
62 assertNull( beerPhase );
63 }
64
65 public void testFindLastInPhaseMisc()
66 throws Exception
67 {
68 MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
69
70 assertNull( plan.findLastInPhase( "pacXkage" ) );
71
72 assertNotNull( plan.findLastInPhase( LifecycleExecutionPlanCalculatorStub.INITIALIZE.getPhase() ) );
73 }
74 }