1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.apache.maven.lifecycle.internal;
16
17 import junit.framework.TestCase;
18 import org.apache.maven.lifecycle.Schedule;
19 import org.apache.maven.lifecycle.internal.stub.MojoExecutorStub;
20 import org.apache.maven.plugin.MojoExecution;
21
22
23
24
25 public class ExecutionPlanItemTest
26 extends TestCase
27 {
28
29 public void testSetComplete()
30 throws Exception
31 {
32 ExecutionPlanItem item = createExecutionPlanItem( "testMojo", null );
33 item.setComplete();
34 assertTrue( item.isDone() );
35 }
36
37 public void testWaitUntilDone()
38 throws Exception
39 {
40
41 final ExecutionPlanItem item =
42 createExecutionPlanItem( "testMojo", createExecutionPlanItem( "testMojo2", null ) );
43 new Thread( new Runnable()
44 {
45 public void run()
46 {
47 item.setComplete();
48 }
49 } ).start();
50 item.waitUntilDone();
51 }
52
53
54 public static ExecutionPlanItem createExecutionPlanItem( String mojoDescription, ExecutionPlanItem downStream )
55 {
56 return createExecutionPlanItem( mojoDescription, downStream, null );
57 }
58
59 public static ExecutionPlanItem createExecutionPlanItem( String mojoDescription, ExecutionPlanItem downStream,
60 Schedule schedule )
61 {
62 return new ExecutionPlanItem( new MojoExecution( MojoExecutorStub.createMojoDescriptor( mojoDescription ) ),
63 schedule );
64 }
65
66
67 }