1 package org.apache.maven.plugin.lifecycle; 2 3 18 19 import org.apache.maven.plugin.lifecycle.io.xpp3.LifecycleMappingsXpp3Reader; 20 import org.codehaus.plexus.util.xml.Xpp3Dom; 21 import org.codehaus.plexus.util.xml.pull.XmlPullParserException; 22 23 import java.io.IOException ; 24 import java.io.InputStreamReader ; 25 26 import junit.framework.TestCase; 27 28 34 public class LifecycleXpp3ReaderTest 35 extends TestCase 36 { 37 public void testLifecycleReader() 38 throws IOException , XmlPullParserException 39 { 40 LifecycleMappingsXpp3Reader reader = new LifecycleMappingsXpp3Reader(); 41 LifecycleConfiguration config = reader.read( new InputStreamReader ( getClass().getResourceAsStream( "/lifecycle.xml" ) ) ); 42 assertEquals( "check number of lifecycles", 1, config.getLifecycles().size() ); 43 Lifecycle l = (Lifecycle) config.getLifecycles().iterator().next(); 44 assertEquals( "check id", "clover", l.getId() ); 45 assertEquals( "check number of phases", 1, l.getPhases().size() ); 46 Phase p = (Phase) l.getPhases().iterator().next(); 47 assertEquals( "check id", "generate-sources", p.getId() ); 48 assertEquals( "check number of executions", 1, p.getExecutions().size() ); 49 Execution e = (Execution) p.getExecutions().iterator().next(); 50 assertEquals( "check configuration", "true", ((Xpp3Dom) e.getConfiguration()).getChild( "debug" ).getValue() ); 51 assertEquals( "check number of goals", 1, e.getGoals().size() ); 52 String g = (String ) e.getGoals().iterator().next(); 53 assertEquals( "check goal", "clover:compiler", g ); 54 } 55 } 56 | Popular Tags |