use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidatorTest method createMockEarModule.
private EarModule createMockEarModule(String groupId, String artifactId, String classifier, String version) {
EarModule earModule = mock(EarModule.class);
Artifact artifact = mock(Artifact.class);
when(earModule.getArtifact()).thenReturn(artifact);
when(earModule.getArtifact().getGroupId()).thenReturn(groupId);
when(earModule.getArtifact().getArtifactId()).thenReturn(artifactId);
when(earModule.getArtifact().getClassifier()).thenReturn(classifier);
when(earModule.getArtifact().getVersion()).thenReturn(version);
when(earModule.getArtifact().getId()).thenReturn(groupId + ":" + artifactId + ":" + classifier + ":" + version);
return earModule;
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class EarMavenArchiverTest method testTwoModules.
@Test
public void testTwoModules() {
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 EarModule module2 = new EjbModule(createArtifact("bar", "war"));
setUri(module2, "bar-2.0.1.war");
modules.add(module2);
final EarMavenArchiver archiver = new EarMavenArchiver(modules);
assertEquals("foo-1.0.jar bar-2.0.1.war", archiver.generateClassPathEntry(""));
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidatorTest method shouldFailCauseTheArtifactIdsAreIdenticalWithClassifiers.
@Test
public void shouldFailCauseTheArtifactIdsAreIdenticalWithClassifiers() {
EarModule earModule1 = createMockEarModule("org.apache.maven.test", "result-artifact", "first", "1.0.0");
EarModule earModule2 = createMockEarModule("org.apache.maven", "result-artifact", "second", "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());
}
use of org.apache.maven.plugins.ear.EarModule in project maven-plugins by apache.
the class ModuleIdentifierValidatorTest method shouldFailWithAppropriateInformationAboutTheIdenticalArtifactIds.
@Test
public void shouldFailWithAppropriateInformationAboutTheIdenticalArtifactIds() {
EarModule earModule_1 = createMockEarModule("org.apache", "artifact-2", "1.0.0");
EarModule earModule_2 = createMockEarModule("org.apache.maven", "artifact-2", "1.0.0");
earModules.add(createMockEarModule("org.apache", "artifact-1", "1.0.0"));
earModules.add(earModule_1);
earModules.add(createMockEarModule("org.apache.maven", "aid-1", "1.0.0"));
earModules.add(earModule_2);
earModules.add(createMockEarModule("org.apache.maven.test", "result-artifact-a", "1.0.0"));
earModules.add(createMockEarModule("org.apache.maven.test", "result-artifact-b", "1.0.0"));
miv.checkForDuplicateArtifacts();
Map<String, List<EarModule>> result = miv.getDuplicateArtifacts();
assertFalse(result.isEmpty());
assertEquals(1, result.size());
assertTrue(result.containsKey("artifact-2:1.0.0"));
List<EarModule> list = result.get("artifact-2:1.0.0");
assertEquals(2, list.size());
assertTrue(list.contains(earModule_1));
assertTrue(list.contains(earModule_2));
}
Aggregations