Search in sources :

Example 26 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testReservedRepositoryId.

@Test
public void testReservedRepositoryId() throws Exception {
    SimpleProblemCollector result = validate("reserved-repository-id.xml");
    assertViolations(result, 0, 4, 0);
    assertContains(result.getErrors().get(0), "'repositories.repository.id'" + " must not be 'local'");
    assertContains(result.getErrors().get(1), "'pluginRepositories.pluginRepository.id' must not be 'local'");
    assertContains(result.getErrors().get(2), "'distributionManagement.repository.id' must not be 'local'");
    assertContains(result.getErrors().get(3), "'distributionManagement.snapshotRepository.id' must not be 'local'");
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 27 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testMissingDependencyManagementArtifactId.

@Test
public void testMissingDependencyManagementArtifactId() throws Exception {
    SimpleProblemCollector result = validate("missing-dependency-mgmt-artifactId-pom.xml");
    assertViolations(result, 0, 1, 0);
    assertTrue(result.getErrors().get(0).contains("'dependencyManagement.dependencies.dependency.artifactId' for groupId:null:jar is missing"));
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 28 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testCiFriendlySha1.

@Test
public void testCiFriendlySha1() throws Exception {
    SimpleProblemCollector result = validateRaw("raw-model/ok-ci-friendly-sha1.xml");
    assertViolations(result, 0, 0, 0);
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 29 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testMissingVersion.

@Test
public void testMissingVersion() throws Exception {
    SimpleProblemCollector result = validate("missing-version-pom.xml");
    assertViolations(result, 0, 1, 0);
    assertEquals("'version' is missing.", result.getErrors().get(0));
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 30 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testMissingPluginDependencyGroupId.

@Test
public void testMissingPluginDependencyGroupId() throws Exception {
    SimpleProblemCollector result = validate("missing-plugin-dependency-groupId.xml");
    assertViolations(result, 0, 1, 0);
    assertTrue(result.getErrors().get(0).contains(":a:"));
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Aggregations

SimpleProblemCollector (org.apache.maven.model.building.SimpleProblemCollector)102 Test (org.junit.jupiter.api.Test)97 Model (org.apache.maven.model.Model)37 File (java.io.File)26 Properties (java.util.Properties)21 DefaultModelBuildingRequest (org.apache.maven.model.building.DefaultModelBuildingRequest)20 ModelBuildingRequest (org.apache.maven.model.building.ModelBuildingRequest)16 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Dependency (org.apache.maven.model.Dependency)4 Scm (org.apache.maven.model.Scm)3 Organization (org.apache.maven.model.Organization)2 Repository (org.apache.maven.model.Repository)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 Future (java.util.concurrent.Future)1 FutureTask (java.util.concurrent.FutureTask)1 Build (org.apache.maven.model.Build)1 InputLocation (org.apache.maven.model.InputLocation)1 InputSource (org.apache.maven.model.InputSource)1 Resource (org.apache.maven.model.Resource)1