Search in sources :

Example 1 with Configuration

use of org.sonar.maven.model.maven2.PluginExecution.Configuration in project sonar-java by SonarSource.

the class PomParserTest method should_parse_incompletly_pom_with_complex_elements.

@Test
public void should_parse_incompletly_pom_with_complex_elements() throws Exception {
    MavenProject project = PomParser.parseXML(COMPLEX_ELEMENT_POM_FILE);
    Configuration config = project.getBuild().getPlugins().getPlugins().get(0).getExecutions().getExecutions().get(0).getConfiguration();
    checkPosition(config, 16, 13, 24, 13);
    assertThat(config).isNotNull();
    List<Element> values = config.getElements();
    assertThat(values).hasSize(2);
}
Also used : MavenProject(org.sonar.maven.model.maven2.MavenProject) Configuration(org.sonar.maven.model.maven2.PluginExecution.Configuration) Element(org.w3c.dom.Element) Test(org.junit.Test)

Example 2 with Configuration

use of org.sonar.maven.model.maven2.PluginExecution.Configuration in project sonar-java by SonarSource.

the class PomParserTest method should_retrieve_configurations.

@Test
public void should_retrieve_configurations() throws Exception {
    MavenProject project = PomParser.parseXML(SIMPLE_POM_FILE);
    List<Plugin> plugins = project.getBuild().getPlugins().getPlugins();
    Configuration configuration = plugins.get(0).getExecutions().getExecutions().get(0).getConfiguration();
    checkPosition(configuration, 88, 13, 90, 13);
    List<Element> values = configuration.getElements();
    assertThat(values).hasSize(1);
}
Also used : MavenProject(org.sonar.maven.model.maven2.MavenProject) Configuration(org.sonar.maven.model.maven2.PluginExecution.Configuration) Element(org.w3c.dom.Element) Plugin(org.sonar.maven.model.maven2.Plugin) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MavenProject (org.sonar.maven.model.maven2.MavenProject)2 Configuration (org.sonar.maven.model.maven2.PluginExecution.Configuration)2 Element (org.w3c.dom.Element)2 Plugin (org.sonar.maven.model.maven2.Plugin)1