use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidator method analyze.
private void analyze() {
final Map<String, List<EarModule>> newList = new HashMap<String, List<EarModule>>();
for (EarModule earModule : earModules) {
String earId = earModule.getArtifact().getArtifactId() + ":" + earModule.getArtifact().getVersion();
if (newList.containsKey(earId)) {
newList.get(earId).add(earModule);
} else {
List<EarModule> list = new ArrayList<EarModule>();
list.add(earModule);
newList.put(earId, list);
}
}
result.clear();
for (Map.Entry<String, List<EarModule>> item : newList.entrySet()) {
if (item.getValue().size() > 1) {
result.put(item.getKey(), item.getValue());
}
}
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class EarMavenArchiverTest method testSimpleJarModuleWithCustomBundleDir.
@Test
public void testSimpleJarModuleWithCustomBundleDir() {
final List<EarModule> modules = new ArrayList<EarModule>();
final EarModule module = new EjbModule(createArtifact("foo", "jar"));
setUri(module, "libs/foo-1.0.jar");
modules.add(module);
final EarMavenArchiver archiver = new EarMavenArchiver(modules);
assertEquals("libs/foo-1.0.jar", archiver.generateClassPathEntry(""));
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class EarMavenArchiverTest method testSimpleEjbModule.
@Test
public void testSimpleEjbModule() {
final List<EarModule> modules = new ArrayList<EarModule>();
final EarModule module = new EjbModule(createArtifact("foo", "ejb"));
setUri(module, "foo-1.0.jar");
modules.add(module);
final EarMavenArchiver archiver = new EarMavenArchiver(modules);
assertEquals("foo-1.0.jar", archiver.generateClassPathEntry(""));
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidatorTest method before.
@Before
public void before() {
this.earModules = new ArrayList<EarModule>();
this.miv = new ModuleIdentifierValidator(this.earModules);
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidatorTest method shouldFailCauseTheArtifactIdsAreIdenticalWithDifferentGroupIds.
@Test
public void shouldFailCauseTheArtifactIdsAreIdenticalWithDifferentGroupIds() {
EarModule earModule1 = createMockEarModule("org.apache.maven.test", "result-artifact", "1.0.0");
EarModule earModule2 = createMockEarModule("org.apache.maven", "result-artifact", "1.0.0");
earModules.add(earModule1);
earModules.add(earModule2);
miv.checkForDuplicateArtifacts();
Map<String, List<EarModule>> result = miv.getDuplicateArtifacts();
assertFalse(result.isEmpty());
assertEquals(1, result.size());
assertTrue(result.containsKey("result-artifact:1.0.0"));
assertEquals(2, result.get("result-artifact:1.0.0").size());
}
Aggregations