Package org.codehaus.plexus.configuration

Examples of org.codehaus.plexus.configuration.DefaultPlexusConfiguration


  /**
   * Default values are not set when providing an explicit config...
   */
  @Test
  public void defaultValues_areNotSet_usingConfig() throws Exception {
    PlexusConfiguration config = new DefaultPlexusConfiguration("configuration");
   
    GreetMojo greetMojo = (GreetMojo) rule.configureMojo(new GreetMojo(), config);
    Assert.assertNull(greetMojo.getGreeting());
  }
View Full Code Here


    Assert.assertNull(greetMojo.getGreeting());
  }
 
  @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

    Assert.assertEquals("configWorld", greetMojo.getGreeting());
  }
 
  @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

  public void testGreetingWithoutPom() throws Exception {
    // 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

  @Rule
  public MojoRule rule = new MojoRule();
 
  @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

Related Classes of org.codehaus.plexus.configuration.DefaultPlexusConfiguration

Copyright © 2018 www.massapicom. 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.