Search in sources :

Example 6 with ArtifactRepository

use of org.apache.maven.plugins.ear.util.ArtifactRepository in project maven-plugins by apache.

the class ArtifactRepositoryTest method testRepositoryWithMultipleClassifiedArtifactsAndMainArtifact.

@Test
public void testRepositoryWithMultipleClassifiedArtifactsAndMainArtifact() throws PlexusConfigurationException, EarPluginException {
    ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
    ArtifactRepository repo = new ArtifactRepository(createArtifacts(new String[] { "myartifact", "myartifact", "myartifact" }, null, null, new String[] { "class1", "class2", null }), MAIN_ARTIFACT_ID, artifactTypeMappingService);
    assertNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar"));
    assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", "class1"));
    assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", "class2"));
    assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", MAIN_ARTIFACT_ID));
    assertNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", "wrong"));
}
Also used : ArtifactRepository(org.apache.maven.plugins.ear.util.ArtifactRepository) ArtifactTypeMappingService(org.apache.maven.plugins.ear.util.ArtifactTypeMappingService) Test(org.junit.Test)

Example 7 with ArtifactRepository

use of org.apache.maven.plugins.ear.util.ArtifactRepository in project maven-plugins by apache.

the class ArtifactRepositoryTest method testEmptyRepository.

@Test
public void testEmptyRepository() {
    ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
    ArtifactRepository repo = new ArtifactRepository(createArtifacts(null), MAIN_ARTIFACT_ID, artifactTypeMappingService);
    assertNull(repo.getUniqueArtifact("ear", "ar", "jar"));
    assertNull(repo.getUniqueArtifact("ear", "ar", "jar", null));
    assertNull(repo.getUniqueArtifact("ear", "ar", "jar", "class"));
}
Also used : ArtifactRepository(org.apache.maven.plugins.ear.util.ArtifactRepository) ArtifactTypeMappingService(org.apache.maven.plugins.ear.util.ArtifactTypeMappingService) Test(org.junit.Test)

Aggregations

ArtifactRepository (org.apache.maven.plugins.ear.util.ArtifactRepository)7 ArtifactTypeMappingService (org.apache.maven.plugins.ear.util.ArtifactTypeMappingService)5 Test (org.junit.Test)5 Artifact (org.apache.maven.artifact.Artifact)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1