use of org.apache.maven.plugins.ear.util.ArtifactTypeMappingService in project maven-plugins by apache.
the class ArtifactTypeMappingServiceTest method testGetStandardTypeForUknonwnType.
public void testGetStandardTypeForUknonwnType() {
try {
ArtifactTypeMappingService service = getDefaultService();
service.getStandardType("MyKoolCustomType");
fail("Should have failed to retrieve a unknwon custom type");
} catch (UnknownArtifactTypeException e) {
// That's good
}
}
use of org.apache.maven.plugins.ear.util.ArtifactTypeMappingService in project maven-plugins by apache.
the class ArtifactTypeMappingServiceTest method getDefaultService.
protected ArtifactTypeMappingService getDefaultService() {
try {
ArtifactTypeMappingService service = new ArtifactTypeMappingService();
service.configure(new XmlPlexusConfiguration("dummy"));
return service;
} catch (EarPluginException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (PlexusConfigurationException e) {
e.printStackTrace();
fail(e.getMessage());
}
// Won't occur
return null;
}
use of org.apache.maven.plugins.ear.util.ArtifactTypeMappingService in project maven-plugins by apache.
the class ArtifactTypeMappingServiceTest method testConfigWithSameCustomType.
public void testConfigWithSameCustomType() {
try {
XmlPlexusConfiguration rootConfig = new XmlPlexusConfiguration("dummy");
XmlPlexusConfiguration childConfig = new XmlPlexusConfiguration(ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT);
childConfig.setAttribute("type", "generic");
childConfig.setAttribute("mapping", "rar");
XmlPlexusConfiguration childConfig2 = new XmlPlexusConfiguration(ArtifactTypeMappingService.ARTIFACT_TYPE_MAPPING_ELEMENT);
childConfig.setAttribute("type", "generic");
childConfig.setAttribute("mapping", "ejb");
rootConfig.addChild(childConfig);
rootConfig.addChild(childConfig2);
ArtifactTypeMappingService service = new ArtifactTypeMappingService();
service.configure(rootConfig);
fail("Should have failed");
} catch (EarPluginException e) {
// OK
} catch (PlexusConfigurationException e) {
e.printStackTrace();
fail("Unexpected " + e.getMessage());
}
}
use of org.apache.maven.plugins.ear.util.ArtifactTypeMappingService in project maven-plugins by apache.
the class ArtifactRepositoryTest method testRepositoryWithOneUnclassifiedArtifact.
@Test
public void testRepositoryWithOneUnclassifiedArtifact() {
ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
ArtifactRepository repo = new ArtifactRepository(createArtifacts(new String[] { "myartifact" }), MAIN_ARTIFACT_ID, artifactTypeMappingService);
assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar"));
assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", null));
}
use of org.apache.maven.plugins.ear.util.ArtifactTypeMappingService in project maven-plugins by apache.
the class ArtifactRepositoryTest method testRepositoryWithOneClassifiedArtifact.
@Test
public void testRepositoryWithOneClassifiedArtifact() {
ArtifactTypeMappingService artifactTypeMappingService = new ArtifactTypeMappingService();
ArtifactRepository repo = new ArtifactRepository(createArtifacts(new String[] { "myartifact" }, null, null, new String[] { "classified" }), MAIN_ARTIFACT_ID, artifactTypeMappingService);
assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar"));
assertNotNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", "classified"));
assertNull(repo.getUniqueArtifact(DEFAULT_GROUPID, "myartifact", "jar", "wrong"));
}
Aggregations