use of org.apache.maven.plugins.install.stubs.AttachedArtifactStub0 in project maven-plugins by apache.
the class InstallMojoTest method testBasicInstallWithAttachedArtifacts.
public void testBasicInstallWithAttachedArtifacts() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/basic-install-test-with-attached-artifacts/" + "plugin-config.xml");
AbstractInstallMojo mojo = (AbstractInstallMojo) lookupMojo("install", testPom);
assertNotNull(mojo);
MavenProject project = (MavenProject) getVariableValueFromObject(mojo, "project");
updateMavenProject(project);
setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(project));
setVariableValueToObject(mojo, "session", createMavenSession());
List<Artifact> attachedArtifacts = project.getAttachedArtifacts();
mojo.execute();
String packaging = project.getPackaging();
String groupId;
for (Object attachedArtifact1 : attachedArtifacts) {
AttachedArtifactStub0 attachedArtifact = (AttachedArtifactStub0) attachedArtifact1;
groupId = dotToSlashReplacer(attachedArtifact.getGroupId());
File installedArtifact = new File(getBasedir(), LOCAL_REPO + groupId + "/" + attachedArtifact.getArtifactId() + "/" + attachedArtifact.getVersion() + "/" + attachedArtifact.getArtifactId() + "-" + attachedArtifact.getVersion() + "." + packaging);
assertTrue(installedArtifact.getPath() + " does not exist", installedArtifact.exists());
}
assertEquals(13, FileUtils.getFiles(new File(LOCAL_REPO), null, null).size());
}
Aggregations