Package org.codehaus.plexus.configuration

Examples of org.codehaus.plexus.configuration.DefaultPlexusConfiguration.addChild()


  }
 
  @Test
  public void canConfigureMojo_usingConfig() throws Exception {
    PlexusConfiguration config = new DefaultPlexusConfiguration("configuration");
    config.addChild("greeting", "configWorld");
   
    GreetMojo greetMojo = (GreetMojo) rule.configureMojo(new GreetMojo(), config);
    Assert.assertEquals("configWorld", greetMojo.getGreeting());
  }
 
View Full Code Here


  @Test
  public void canInjectProject_usingConfig() throws Exception {
    PlexusConfiguration config = new DefaultPlexusConfiguration("configuration");
    XmlPlexusConfiguration xmlConfig = new XmlPlexusConfiguration("project");
    xmlConfig.setAttribute("implementation", "ch.inftec.ju.maven.test.GreetMojoTest_MavenProject");
    config.addChild(xmlConfig);
   
    GreetMojo greetMojo = (GreetMojo) rule.configureMojo(new GreetMojo(), config);
   
    Assert.assertNotNull(greetMojo.getProject());
    Assert.assertEquals(GreetMojoTest_MavenProject.class, greetMojo.getProject().getClass());
View Full Code Here

    // lookupMojo needs the actual version as it seems to use the Maven local repo to lookup stuff...
    String version = new XPathGetter(XmlUtils.loadXml(JuUrl.toUrl(JuUrl.existingFile("pom.xml")))).getSingle("project/parent/version");
   
    // Default value setting will not work when using explicit (or no) PlexusConfiguration
    PlexusConfiguration config = new DefaultPlexusConfiguration("configuration");
    config.addChild("greeting", "NoPomWorld");
    GreetMojo greetMojo = (GreetMojo) this.lookupMojo("ch.inftec.ju", "ju-maven-plugin", version, "greet", config);
    Assert.assertEquals("NoPomWorld", greetMojo.getGreeting());
    greetMojo.execute();
  }
}
View Full Code Here

  @Test
  public void canExecute_debugPropertiesMojo() throws Exception {
    PlexusConfiguration config = new DefaultPlexusConfiguration("configuration");
    XmlPlexusConfiguration xmlConfig = new XmlPlexusConfiguration("project");
    xmlConfig.setAttribute("implementation", "ch.inftec.ju.maven.test.GreetMojoTest_MavenProject");
    config.addChild(xmlConfig);
//    config.addChild("greeting", "configWorld");
   
    DebugMojo m = (DebugMojo) rule.configureMojo(new DebugMojo(), config);
   
    m.execute();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.